Also see the earlier thread:
http://www.lazarus.freepascal.org/index.php/topic,15557.0.htmlIf I understood correctly, the problem is the linker. A summary of my conclusions:
1. Linkers have a path (prefix) internally where they look first. Normal linkers have /usr (and they append "lib" to that), and crosslinkers have a different path internally. (usually some dummy path on the system the binlinkers were generated)
2. On (Linux) biarch systems (systems that are 32/64-bit) there is one linker that handles everything, and is switchable between 32-bit and 64-bit using a parameter (which FPC supports)
3. However, the linker doesn't seem to change the path if the 32-bit mode is selected. (to use /usr/lib32 instead of /usr/lib)
4. This doesn't turn up with GCC, because GCC only passes absolute paths to the linker. (IOW it does searching itself).
Possible solutions, in decreasing preference.
1. Report a bug with your distro or GNU, and have them fix the biarch situation. If they use alternative paths for different architectures, the distribution shipped linker should respect that.
2. Change FPC to the GCC model. I think FPC should at least have an option to search everything itself in the case of defective linkers. The trouble is that this is a long term solution.
3. Use the workaround luke!
The (untested, theory only) workaround is based on the fact that there is a linker parameter that overrides the internal prefix. But it wants to look in lib always (-XR), so we give it a lib.
a. Make a new directory say /usr/exp This is going to be our new prefix. Make its owners and permissions the same as /usr
b. Symlink /usr/exp/lib to point to /usr/lib32
c. Pass -XR/usr/exp to FPC, or put it in your fpc.cfg under #ifdef i386
Problems:
- still untested, based on certain workarounds I used for linux crosscompiling.
- might make the binaries dependent on the system it was build (use -Xr to fix that?)
Note, if you want to test this, start on the cmdline with FPC first, and only then go to Lazarus.