Please note that tutorial is made for 2.70, and most of this things are not needed anymore!
Please read updated tutorial available
here
As I promised, here is a little guide to help you compile and run both 32bit and 64bit Lazarus in Mandriva and ROSA.
You should be able to compile for those 4 targets, even if you do not install 32bit Lazarus:
1. x86_64-linux
2. i386-linux
3. x86_64-win64
4. i386-win32
Mandriva and ROSA are both dualarc (means that they can run 32 and 64bit apps in 64bit OS), but both of those distributions need a little push in order to became usable for dual CT.
As we all know official CT way is to have both 64bit and 32bit Lazarus on 64bit machine. On the other hand I want to use only one 64bit Lazarus for compiling of both 32bit and 64bit apps.
Please note that this is not a perfect way to accomplish dual CT compiling on Linux, but it works.
In addition, it is also possible to make this to compile Windows apps (both 32bit and 64bit), but I will leave that for some other post (in next few days).
1. Add yourself to the "wheel" group if you are not already part of that group.
usermod -aG wheel your_user
Log out and log in again to make this change active. This is clean and proper way to add yourself to sudo users.
2. If you do not want to enter password for sudo every time, open console, and type
and enter your password. Comment line
and uncomment line
%wheel ALL=(ALL) NOPASSWD: ALL
3. Now it is time to add repositories in order to update your system. I also added 32bit repositories (since we want to compile for 32bit too). Only Main 32 release and update are active. MIB repositories are included too (not needed for CT, but very useful for yourself.
FOR ROSA 2012sudo urpmi.removemedia -a
sudo urpmi.addmedia Main_64_release http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/main/release/
sudo urpmi.addmedia --update Main_64_updates http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/main/updates/
sudo urpmi.addmedia Contrib_64_release http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/contrib/release/
sudo urpmi.addmedia --update Contrib_64_updates http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/contrib/updates/
sudo urpmi.addmedia NonFree_64_release http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/non-free/release/
sudo urpmi.addmedia --update NonFree_64_updates http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/non-free/updates/
sudo urpmi.addmedia Restricted_64_release http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/restricted/release/
sudo urpmi.addmedia --update Restricted_64_updates http://mirrors.coreix.net/rosa/rosa2012lts/x86_64/media/restricted/updates/
sudo urpmi.addmedia --update MIB-basic_64 http://mirrors.coreix.net/MIB/rosa2012lts/64/basic/
sudo urpmi.addmedia --raw --update MIB-experts_64 http://mirrors.coreix.net/MIB/rosa2012lts/64/experts/
#
sudo urpmi.addmedia Main_32_release http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/main/release/
sudo urpmi.addmedia --update Main_32_updates http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/main/updates/
sudo urpmi.addmedia --raw Contrib_32_release http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/contrib/release/
sudo urpmi.addmedia --raw --update Contrib_32_updates http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/contrib/updates/
sudo urpmi.addmedia --raw NonFree_32_release http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/non-free/release/
sudo urpmi.addmedia --raw --update NonFree_32_updates http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/non-free/updates/
sudo urpmi.addmedia --raw Restricted_32_release http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/restricted/release/
sudo urpmi.addmedia --raw --update Restricted_32_updates http://mirrors.coreix.net/rosa/rosa2012lts/i586/media/restricted/updates/
sudo urpmi.addmedia --raw --update MIB-basic_32 http://mirrors.coreix.net/MIB/rosa2012lts/32/basic/
#
FOR MANDRIVA 2011
sudo urpmi.removemedia -a
sudo urpmi.addmedia Main_64_release ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/main/release
sudo urpmi.addmedia --update Main_64_updates ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/main/updates
sudo urpmi.addmedia --update Main_64_backports ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/main/backports
sudo urpmi.addmedia Contrib_64_release ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/contrib/release
sudo urpmi.addmedia --update Contrib_64_updates ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/contrib/updates
sudo urpmi.addmedia --update Contrib_64_backports ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/contrib/backports
sudo urpmi.addmedia NonFree_64_release ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/non-free/release
sudo urpmi.addmedia --update NonFree_64_updates ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/non-free/updates
sudo urpmi.addmedia --update NonFree_64_backports ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/x86_64/media/non-free/backports
sudo urpmi.addmedia --update MDV-restricted_64 http://mirror.yandex.ru/mandriva/official/restricted/2011.0/x86_64/
sudo urpmi.addmedia --update MIB-basic_64 http://mib.pianetalinux.org/MIB/2011.0/64/basic/
sudo urpmi.addmedia --update --raw MIB-experts_64 http://mib.pianetalinux.org/MIB/2011.0/64/experts/
#
sudo urpmi.addmedia Main_32_release ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/main/release
sudo urpmi.addmedia --update Main_32_updates ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/main/updates
sudo urpmi.addmedia --update Main_32_backports ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/main/backports
sudo urpmi.addmedia --raw Contrib_32_release ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/contrib/release
sudo urpmi.addmedia --update --raw Contrib_32_updates ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/contrib/updates
sudo urpmi.addmedia --update --raw Contrib_32_backports ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2011/i586/media/contrib/backports
sudo urpmi.addmedia --update --raw MDV-restricted_32 http://mirror.yandex.ru/mandriva/official/restricted/2011.0/i586/
sudo urpmi.addmedia --update --raw MIB-basic_32 http://mib.pianetalinux.org/MIB/2011.0/32/basic/
#
4. Now it is time to update all.
That was standard and usual part.
Real fun begins here.
You can try something similar on other distributions too, but I can not guaranty that it will work.
5. Install 32bit OpenGL Extension to GTK+2
6. Next step is to make 32bit apps looks same as 64bit apps.
sudo urpmi libcanberra-gtk0
sudo urpmi libmurrine
7. I am sure that I had to add this library On Mandriva, but in ROSA it was installed in step 5, so use this only if needed.
sudo urpmi libgtk-aurora-engine-1
8.
This is the trickiest part. You need to fix all missing 32bit symbolic links. You can lost days trying to do that checking file by file and making symbolic links one by one, or you can use a little magic for that.
cd /lib
find *.so.? -exec sh -c '[[ ! -f `echo {} | sed 's/\.so\.[0-9]/\.so/'` ]] && [[ ! -h `echo {} | sed 's/\.so\.[0-9]/\.so/'` ]] && sudo ln -s {} `echo {} | sed 's/\.so\.[0-9]/\.so/'`' \;
cd /usr/lib
find *.so.? -exec sh -c '[[ ! -f `echo {} | sed 's/\.so\.[0-9]/\.so/'` ]] && [[ ! -h `echo {} | sed 's/\.so\.[0-9]/\.so/'` ]] && sudo ln -s {} `echo {} | sed 's/\.so\.[0-9]/\.so/'`' \;
Now I feel like Harry Potter and you are ready to compile both 64bit and 32bit apps.
9. Make as and ld ready for cross compile. Create i386-linux-ld and i386-linux-as.
sudo touch /usr/bin/i386-linux-as
sudo touch /usr/bin/i386-linux-ld
I forgot to add next three steps in original posts, so I am adding them now.
10. Edit /usr/bin/i386-linux-as like this
11. Edit /usr/bin/i386-linux-ld like this
#!/bin/bash
ld -A elf32-i386 $@
12. Make i386-linux-as and i386-linux-ld executable
sudo chmod +x /usr/bin/i386-linux-as
sudo chmod +x /usr/bin/i386-linux-ld
Finally, it is time to download and unpack CodeTyphon.
Form this point you can follow one of two paths. You need to decide which one will you follow.
A - Compile both 64bit and 32bit Lazarus
Open "ln_All_Functions.sh" and change those lines
if [ $(uname) = "SunOS" ] ;
then
vsysfpc32sub=1
vsyslaz32sub=1
fi
to
if [ $(uname) = "SunOS" -o -f /etc/mandriva-release ] ;
then
vsysfpc32sub=1
vsyslaz32sub=1
fi
B - Compile only 64bit Lazarus
Open "ln_All_Functions.sh" and change those lines
if [ -f /etc/SuSE-release ] ;
then
vsysfpc32sub=1
vsyslaz32sub=0
fi
to
if [ -f /etc/SuSE-release -o -f /etc/mandriva-release ] ;
then
vsysfpc32sub=1
vsyslaz32sub=0
fi
Install CT as usual.
IMPORTANT NOTE. DO NOT TRY TO RECOMPILE LCL, this is obsolete action in latest versions of Lazarus.
If you followed path A - now you have both 32bit and 64bit FPC and both 32bit and 64bit Lazarus.
The only problem is that I do not know how to install 32bit GDB.
If you followed path B - now you have both 32bit and 64bit FPC but only one 64bit Lazarus.
At this moment you can only compile 64bit Lazarus apps, but FPC can compile both 64bit and 32bit.
I know I promised you 32bit Lazarus apps too, but that requires a touch of magic again.
B1. Start lazarus. Go to Tools and click on Options. Find Environment and then Files.
Change
Compiler path line. Replace
/usr/lib/codetyphon/fpc/bin/x86_64-linux/ppcx64
with
/usr/lib/codetyphon/fpc/bin/$(TargetCPU)-linux/fpc
Now you can compile both 32bit and 64bit apps from one single 64bit Lazarus. This is what I use.
I really do not have enough strength to write more at this moment. Info about Windows compiling comes soon.