Sign in Join

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

Mailing lists / fpc-pascal / 2010-02

Cross-compiling from 64-bit Linux to 32-bit Linux

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi

I'm running Ubuntu 9.04 (64-bit) and have FPC 2.4.1 installed. I cross-compiled a 32-bit version of FPC as well.

I'm not trying to compile my fpGUI based projects under my 64-bit system to 32-bit Linux executables. But I am getting the following linking errors. Does anybody know how to resolve this? What compatibility packages (*.deb) do I have to install so I can compile and link GUI applications.

---------------------------------
Linking Bin/i386-linux/tutoradmin
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libdl.so when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libdl.a when searching for -ldl
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libX11.a when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/lib/libX11.so when searching for -lX11 /usr/bin/ld: skipping incompatible /usr/lib/libX11.a when searching for -lX11 /usr/bin/ld: cannot find -lX11
tutoradmin.lpr(89,1) Error: Error while linking
tutoradmin.lpr(89,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
---------------------------------

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/
Patrick Chevalley
to Graeme Geldenhuys

Install the ia32-libs package.

also check if your fpc.cfg contain the following lines, I not remember if I add them:
#ifdef cpui386
-Fl/usr/lib32
-Xd
#endif

Patrick

Osvaldo Filho
to Patrick Chevalley

I have the same problem (or not?) :

-------
Free Pascal Compiler version 2.4.1 [2010/02/03] for i386 Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for i386
Compiling lazarus.pp
Compiling resource ../units/i386-linux/lazarus.or
Linking ../lazarus
ld: warning: ../link.res contains output sections; did you forget -T? ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o ld: cannot find /usr/lib/crti.o
lazarus.pp(127,1) Error: Error while linking
lazarus.pp(127,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
make[2]: ** [lazarus] Erro 1
make[2]: Saindo do diretório
`/home/deskx/desenvolvimento/instaladores/lazarus/ide' make[1]: ** [ide] Erro 2
make[1]: Saindo do diretório
`/home/deskx/desenvolvimento/instaladores/lazarus/ide' make: ** [ide] Erro 2
-------

2010/2/8 Patrick Chevalley :

Show quoted text 14 lines
Install the ia32-libs package. also check if your fpc.cfg contain the following lines, I not remember if I add them: #ifdef cpui386 -Fl/usr/lib32 -Xd #endif Patrick _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Patrick Chevalley
to Osvaldo Filho
I have the same problem (or not?) :

Maybe ...
try
$ locate crti.o
must return:
/usr/lib/crti.o
/usr/lib32/crti.o

On Debian/Ubuntu /usr/lib32/crti.o is in a package require by ia32-libs.

Beware the path are not the same with Redhat! /usr/lib is 32bit and /usr/lib64 for 64bit.

Patrick

Graeme Geldenhuys
to Patrick Chevalley: Install the ia32-libs package. also check if your fpc.cfg contain the following lines, I…
Patrick Chevalley wrote
Install the ia32-libs package.

I already had this installed and had many libraries available in /usr/lib32/

Show quoted text 6 lines
also check if your fpc.cfg contain the following lines, I not remember if I add them: #ifdef cpui386 -Fl/usr/lib32 -Xd #endif

I added this and the problem was still the same. It seems the linker can't find the libX11 library to link against. Your reply about 'locate crti.o' gave me an idea.

I did the following...

$ locate libX11.so
/usr/lib/libX11.so
/usr/lib/libX11.so.6
/usr/lib/libX11.so.6.2.0
/usr/lib32/libX11.so.6 <-- missing unversioned libX11.so /usr/lib32/libX11.so.6.2.0

I noticed the "unversioned" libX11.so is missing from the /usr/lib32/ directory. I manually added a symbolic link and it solved the linking -lX11 problem, but then prompted about -lXft. I did a another locate and it had the same problem. Added another "unversioned" symbolic for libXft.so and now my project successfully links!!! :-)

Thanks for getting me onto the right track.

What location in the wiki will be appropriate for such information, in case somebody else gets stuck with cross-compiling and a similar linking problem?

I used packages.ubuntu.com to search for packages that contain libX11.so. I noticed that only from Ubuntu 9.04 (Jaunty) does the ia32-libs include the unversioned symbolic link. I made a mistake in my original post, I am actually running Ubuntu 8.04.2 (Hardy) 64-bit.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/
Patrick Chevalley
to Graeme Geldenhuys

I use Ubuntu 9.10 64bit and I can confirm this link are present with this release.

To search for the package that contain a file I find apt-file handy: sudo apt-get install apt-file
sudo apt-file update
and then
apt-file search libX11