free pascal: linking error
Hi,
I'm trying to compile some code with this command: fpc -Sd -pg OrchidFW.lpr everything goed OK until the linking step: Linking OrchidFW /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.1/crtbegin.o when searching for /usr/lib/gcc/x86_64-redhat-linux/4.1.1/crtbegin.o /usr/bin/ld: cannot find /usr/lib/gcc/x86_64-redhat-linux/4.1.1/crtbegin.o OrchidFW.lpr(74,1) Error: Error while linking the file /usr/lib/gcc/x86_64-redhat-linux/4.1.1/crtbegin.o does exist however. any ideas?? |
Perhaps you compiled x86 object code and you’re linking with x86-64 object code?
|
how can i compile it for 32 bit then, any idea??
|
Quote:
|
you are right!
there is a directory gcc... /32/crtbegin.o so I should use that one. do you know how I can provide this specific 32 lib to the linker? all the source code seems to be compiled (every .pas file has a .o counterpart) so the only thing we need to do now is the linking to the 32 lib right? any idea on how to do that? the executable is called OrchidFW.o and the path to the 32 lib is /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/crtbegin.o |
a small update:
I got around the linking error by editing the /etc/fpc.cfg file from: Code:
# searchpath for libraries Code:
# searchpath for libraries # fpc -Sd -pg OrchidFW.lpr Free Pascal Compiler version 2.0.4 [2006/08/20] for i386 Copyright (c) 1993-2006 by Florian Klaempfl Target OS: Linux for i386 Compiling OrchidFW.lpr Linking OrchidFW /usr/bin/ld: skipping incompatible /usr/lib64/libdag.so when searching for /usr/lib64/libdag.so /usr/bin/ld: cannot find /usr/lib64/libdag.so OrchidFW.lpr(74,1) Error: Error while linking Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) /usr/lib64/libdag.so exists but that's the 64 bit version and we need the 32 bit version offcourse. /usr/lib/libdag.so, however, does not exist. but there is a file /usr/local/lib/libdag.so so that is a 32 bit version. there is also a /usr/local/lib64/libdag.so but I don't see where I need to put that in the fpc.cfg file. this is in fpc.cfg now: Code:
# searchpath for libraries Code:
{$link /usr/lib64/libdag.so} Code:
{$link /usr/local/lib/libdag.so} Code:
# fpc -Sd -pg OrchidFW.lpr |
Quote:
Code:
$ file /lib{32,64}/libz.so.1.2.3 Code:
$ fpc -i |
hi osor,
I installed the 64 bit version of fpc as you suggested, and indeed, we made some progress. We don't get the incompatible libdag.so errors anymore, but we still get 1 error while linking though: Code:
Free Pascal Compiler version 2.1.4 [2007/05/07] for x86_64 But there is one source code file (EndaceNICDecoderUnit.pas) which has a reference to libdag.so: Code:
{$link /usr/lib64/libdag.so} *edit: I also searched for libdag.o on the system but it doesn't exist, but libdag.so does exist |
problem solved!!
I found a file called libdag.a in the dag dir. the content looked binary so I figured it was a compiled object file that just ended with .a instead of .o I copied libdag.a to libdag.o, put in the right directory (/usr/lib64) and the program compiled/linked without problems Smile |
All times are GMT -5. The time now is 12:58 AM. |