linking error lazarus / 8-Other ---------------------------------------------------------------------- kristofv · 2007-05-24 17:29 Hi, I'm trying to compile some code on a red hat machine 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?? ---------------------------------------------------------------------- antonio · 2007-05-24 20:27 Perhaps something on path settings. ---------------------------------------------------------------------- Marc · 2007-05-25 09:06 did you use a 32 or 64 bits fpc ? ---------------------------------------------------------------------- kristofv · 2007-05-25 09:26 Marc, I used the first rpm installer (13 megs) of this site: http://www.freepascal.org/down/i386/linux-russia.var#linuxrpm so I guess it's the 32 bit version. ---------------------------------------------------------------------- Marc · 2007-05-25 09:36 to be sure, do you run ppc386 of ppcx64 ?  You can also find out by running fpc in a terminal. The first line will tell you. But I guess it is a 32bit version, so trying to link 64bit libs won't work. So look in your /etc/fpc.cfg for a line like Code: [Select]# searchpath for libraries -Fl/usr/lib/gcc-lib/i386-redhat-linux/3.3.3 at least that is what I have, I guess your line is likeCode: [Select] -Fl/usr/lib/gcc/x86_64-redhat-linux/4.1.1 So look if you have a similar location where 32bit libs are stored and add that path as an extra line to the fpc.cfg ---------------------------------------------------------------------- kristofv · 2007-05-25 09:48 Thx Marc, it did the trick! but now we have another error [root@PS9999 VoipAnalyzer]# 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: [Select] # searchpath for libraries -Fl/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32 -Fl/usr/local/lib ---------------------------------------------------------------------- kristofv · 2007-05-25 13:40 now I found a source file (EndaceNICDecoderUnit.pas) that has the following line: Code: [Select] {$link /usr/lib64/libdag.so} so I changed this to: Code: [Select] {$link /usr/local/lib/libdag.so} and then I call fpc again: Code: [Select] # 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 Compiling EndaceNICDecoderUnit.pas EndaceNICDecoderUnit.pas(146,3) Note: Local variable "PacketData" not used EndaceNICDecoderUnit.pas(148,3) Note: Local variable "data" not used EndaceNICDecoderUnit.pas(149,3) Note: Local variable "i" not used EndaceNICDecoderUnit.pas(177,14) Warning: range check error while evaluating constants EndaceNICDecoderUnit.pas(177,46) Warning: range check error while evaluating constants Linking OrchidFW /usr/bin/ld: skipping incompatible /usr/local/lib/libdag.so when searching for /usr/local/lib/libdag.so /usr/bin/ld: cannot find /usr/local/lib/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) ---------------------------------------------------------------------- kristofv · 2007-05-29 08:20 we made some progress, I isntalled the 64 bit version of fpc and compiled the code with that 64 bit compiler. now we don't get the errors about an incompatible libdag.so anymore but we get a new error: Code: [Select] Free Pascal Compiler version 2.1.4 [2007/05/07] for x86_64 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Linux for x86-64 Compiling OrchidFW.lpr OrchidFW.lpr(74,1) Warning: Object /usr/lib64/libdag.o not found, Linking may fail ! Linking OrchidFW /usr/bin/ld: cannot find /usr/lib64/libdag.o OrchidFW.lpr(74,1) Error: Error while linking OrchidFW.lpr(74,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled) I searched all the soruce code files and OrchidFW.lpr for a reference to libdag.o, but libdag.o isn't in any of the sourcecode files. there is only one source code file (EndaceNICDecoderUnit.pas) which has a reference to libdag.so: Code: [Select] {$link /usr/lib64/libdag.so} any idea?? *edit: I also searched for libdag.o on the system but it doesn't exist, but libdag.so does exist ---------------------------------------------------------------------- kristofv · 2007-05-29 09:45 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 ---------------------------------------------------------------------- Marc · 2007-05-29 09:46 is there any reference to libdag ? (without .o) in the source. Normally is isn't needed to specify the {$link} in your source since, as you found out, lead to troubles on different platforms