Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-08

[ANNOUNCEMENT] fpcup diving deeper into crosscompiling

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

fpcup is a program that automates downloading and installing fpc and Lazarus from svn.

I've finished the first "real" crosscompiling module [2] for win=>linux i386 using the cross binutils and libs supplied by www.crossfpc.com [1]

If you want to test it, add a cross directory under the fpcup "root" installdir directory (e.g. c:\development\cross, and e.g. regular fpc sources in c:\development\fpc etc)

Then place the directory layout provided by the crossfpc project there, so you get

c:\development\cross\bin\arm-android\arm-linux-androideabi-ar.exe c:\development\cross\bin\arm-android\arm-linux-androideabi-as.exe ...
c:\development\cross\bin\i386-linux\i386-linux-ar.exe c:\development\cross\bin\i386-linux\i386-linux-as.exe ...
c:\development\cross\lib\arm-android\libc.a
c:\development\cross\lib\arm-android\libc.so
...
c:\development\cross\lib\x86_64-linux\libc.a
c:\development\cross\lib\x86_64-linux\libc.so
...

then run regular fpcup
fpcup
followed by the cross compiler version:
fpcup --cputarget=i386 --ostarget=linux

Now continuing to work on:
- win32=>arm-android
- win32=>arm-linux
- win64=>linux

Contributions for other cross compilers are welcome - see the m_cross*.pas units for simple examples (you only need to fill in the code that checks for the proper binutils and crosslibs in the right location).

The fpcup source code can be downloaded via
https://bitbucket.org/reiniero/fpcup/src
Haven't updated the binary downloads yet

Lots of thanks to the crossfpc guys!

[1] You can also download them via
https://bitbucket.org/reiniero/fpcup/downloads/CrossFPC_binutils_libs.7z [2] the Linux,FreeBSD,OSX=>Windows one was not too hard thanks to built in FPC support ;)

Jonas Maebe
to Reinier Olislagers
Reinier Olislagers wrote 5 lines
c:\development\cross\lib\arm-android\libc.a c:\development\cross\lib\arm-android\libc.so ... c:\development\cross\lib\x86_64-linux\libc.a c:\development\cross\lib\x86_64-linux\libc.so

That is only guaranteed to produce binaries that will work correctly on whatever distribution these *.so files come from (linking against the static versions will in principle work fine anywhere, although there have been some bug reports about statically linking FPC programs to libc). You cannot distribute a "generic" version of Linux shared libraries libraries to which you can link and after which the result will always work anywhere. It may work most of the time, but definitely not always and should not be promoted. Developers should always link against the libraries from the Linux distribution/version they want to support.

Jonas

Reinier Olislagers
to Jonas Maebe
Jonas Maebe wrote
That is only guaranteed to produce binaries that will work correctly on whatever distribution these *.so files come from

<snip>

Developers should always link against the libraries from the Linux distribution/version they want to support.

Yes, that is why fpcup does not automatically download any .so/.a files. Users can download whatever libraries they want. fpcup will check for a couple of filenames to see if attempting the cross compile makes sense and go. It does not force a certain library version.

The crossfpc package is a nice way to get a lot of cross compiling binutils in one go... having some libs is a bonus.

NB: currently working on modifying fpc.cfg for cross compilation. Had forgotten about that :)