Hi Lide, I was able to reproduce the problem and I think I got a solution:
1) The linker being used by default by the crosstool built gcc is the correct one. so no change here. 2) Build zlib with the crosstool built gcc and glibc: 2a) download the zlib source code from here: http://www.zlib.net/zlib-1.2.3.tar.gz 2b) extract it, configure it and build it as follows: $ CC=/opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc ./configure --prefix=<Path to zlib> $ make $make install 3) Search for and modify the following environment variables in the TurboSMARTS makefile: MLIBS = `./sysprobe -libs` -L<path to zlib>/lib -lm -lz FFLAGS = -I<Path to zlib>/include (May not be the best place to set the include directory though, but lets try it for now) 4) Rebuild TurboSMARTS I hope this works well for you. Regards, Jesus 2010/1/6 Lide Duan <[email protected]>: > Jesus, > > First of all, as you suggested, I added -L/usr/lib into the makefile. Here > is what is shown: > > /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/ld:/usr/lib/libc.so: > file format not recognized; treating as linker script > /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/ld:/usr/lib/libc.so:5: > parse error > collect2: ld returned 1 exit status > > I also noticed that there is no "ld" in the above directory (i.e. > /opt/crosstool/.../bin), which only contains a "i686-unknown-linux-gnu-ld". > "ld" is in /usr/bin. I suspect that I used a wrong linker? How can I tell > gcc to use /usr/bin/ld? > > The followings are the related content from my Makefile: > > CC = > /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc > CXX = > /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-g++ > OFLAGS = -O3 -Wall > MFLAGS = `./sysprobe -flags` > MLIBS = `./sysprobe -libs` -L/usr/lib -lm -lz > ENDIAN = `./sysprobe -s` > MAKE = make > AR = ar qcv > AROPT = > RANLIB = ranlib > RM = rm -f > RMDIR = rm -f > LN = ln -s > LNDIR = ln -s > DIFF = diff > OEXT = o > LEXT = a > EEXT = > CS = ; > X=/ > > > Thank you very much!! > Lide > > 2010/1/6 Jesus Hernandez Tapia <[email protected]> >> >> Lide, >> >> One more thing I noticed is that you are using >> >> /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/ld >> , and it should be /usr/bin/ld. >> >> Could you please insert the part of the Makefile where you define the >> environment variables for your build?, then I can take a look to it. >> >> Jesus >> >> 2010/1/6 Jesus Hernandez Tapia <[email protected]>: >> > Hi Lide, >> > >> > I would like to suggest one more thing: >> > >> > Please find in the Makefile the following line: >> > >> > MLIBS = `./sysprobe -libs` -lm -lz >> > >> > and change it to : >> > >> > MLIBS = `./sysprobe -libs` -L/usr/lib -lm -lz >> > >> > Rebuild the application after the change to Makefile >> > >> > Regards, >> > >> > Jesus >> > >> > 2010/1/6 Lide Duan <[email protected]>: >> >> Yes, they are there...I found both files in /usr/lib. Actually, other >> >> gcc >> >> versions I tried seemed to link correctly although they could not >> >> compile >> >> successfully at the end. I have no idea why the crosstool built gcc >> >> cannot >> >> link to zlib... >> >> >> >> 2010/1/6 Jesus Hernandez Tapia <[email protected]> >> >>> >> >>> Lida, >> >>> >> >>> Do you have the library files installed in your system? Please search >> >>> for libz in /usr/lib. There should be files like libz.so and libz.a. >> >>> >> >>> If the library is not there, you may need to install it. >> >>> >> >>> Regards, >> >>> >> >>> Jesus >> >>> >> >>> >> >>> >> >>> 2010/1/6 Lide Duan <[email protected]>: >> >>> > Hi Jesus, >> >>> > >> >>> > I think I successfully used the crosstool to build gcc-2.95.3 and >> >>> > glibc-2.2.5, as you suggested. But when I compiled SMARTS with the >> >>> > new >> >>> > installed gcc, it gave me the following error: >> >>> > >> >>> > >> >>> > >> >>> > /opt/crosstool/gcc-2.95.3-glibc-2.2.5/i686-unknown-linux-gnu/i686-unknown-linux-gnu/bin/ld: >> >>> > cannot find -lz >> >>> > collect2: ld returned 1 exit status >> >>> > >> >>> > Looks like the linker cannot link to zlib? Do you have any idea >> >>> > about >> >>> > this? >> >>> > Thank you! >> >>> > >> >>> > Lide >> >>> > >> >>> > 2010/1/6 Jesus Hernandez Tapia <[email protected]> >> >>> >> >> >>> >> Lide, >> >>> >> >> >>> >> If I remember correctly I used glibc version 2.2.5. >> >>> >> Please let us know if this version works for you. >> >>> >> >> >>> >> Regards, >> >>> >> >> >>> >> Jesus >> >>> >> >> >>> >> 2010/1/6 Lide Duan <[email protected]>: >> >>> >> > Hi Jesus, >> >>> >> > >> >>> >> > Thank you for your reply! I suspect that the error I encountered >> >>> >> > is >> >>> >> > due >> >>> >> > to >> >>> >> > the glibc version. The current one in my machine is 2.5, but I >> >>> >> > believe >> >>> >> > gcc >> >>> >> > 2.95.3 used an older version. Could you please tell me the glibc >> >>> >> > version >> >>> >> > you >> >>> >> > used with gcc 2.95.3 to compile SMARTS? (Is it something 2.3.x?) >> >>> >> > >> >>> >> > Thanks, >> >>> >> > Lide >> >>> >> > >> >>> >> > 2010/1/6 Jesus Hernandez Tapia <[email protected]> >> >>> >> >> >> >>> >> >> Hi Lide, >> >>> >> >> >> >>> >> >> You are right, to compile SMARTS you need gcc version 2.95.3. >> >>> >> >> >> >>> >> >> It has been a long time since I did this, but I remember I used >> >>> >> >> "crosstool" to install the required version of GCC along with >> >>> >> >> its >> >>> >> >> corresponding version of glibc. After this, SMARTS compiled with >> >>> >> >> no >> >>> >> >> problems. >> >>> >> >> >> >>> >> >> Here is the link to crosstool: http://www.kegel.com/crosstool/ >> >>> >> >> >> >>> >> >> Regards. >> >>> >> >> >> >>> >> >> 2010/1/5 Lide Duan <[email protected]>: >> >>> >> >> > Thank you for the info, Zhibin! >> >>> >> >> > >> >>> >> >> > Are you sure it is 2.9.53 but not 2.95.3? Since 2.95.3 is the >> >>> >> >> > gcc >> >>> >> >> > 2.9x >> >>> >> >> > version I can find on GNU website. I could not find any GCC >> >>> >> >> > version >> >>> >> >> > as >> >>> >> >> > 2.9.53. (If it turns out to be 2.9.53, is there anyway for me >> >>> >> >> > to >> >>> >> >> > download >> >>> >> >> > it?) >> >>> >> >> > >> >>> >> >> > Unfortunately, gcc 2.95.3 still gave me the same error...Is >> >>> >> >> > there >> >>> >> >> > any >> >>> >> >> > known >> >>> >> >> > gcc version that is for sure compatible with TurboSMARTS? >> >>> >> >> > >> >>> >> >> > Thanks, >> >>> >> >> > Lide >> >>> >> >> > >> >>> >> >> > 2010/1/5 yuzhibin <[email protected]> >> >>> >> >> >> >> >>> >> >> >> Hi >> >>> >> >> >> >> >>> >> >> >> You need to use gcc 2.9.53 to compile the TurboSMARTS. >> >>> >> >> >> Good >> >>> >> >> >> luck! >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> Best regards, >> >>> >> >> >> >> >>> >> >> >> Zhibin >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> ________________________________ >> >>> >> >> >> >> >>> >> >> >> 发件人: Lide Duan [mailto:[email protected]] >> >>> >> >> >> 发送时间: Tuesday, January 05, 2010 8:35 AM >> >>> >> >> >> 收件人: [email protected] >> >>> >> >> >> 主题: What was the gcc/g++ version used to build TurboSMARTS? >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> >> >>> >> >> >> Hello, >> >>> >> >> >> >> >>> >> >> >> I am trying to compile the TurboSMARTS codebase on Suse Linux >> >>> >> >> >> 10.2. >> >>> >> >> >> I >> >>> >> >> >> tried two versions of gcc/g++: 3.4.1 and 4.1.2, but they all >> >>> >> >> >> gave >> >>> >> >> >> the >> >>> >> >> >> following errors: >> >>> >> >> >> >> >>> >> >> >> /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section >> >>> >> >> >> .tbss >> >>> >> >> >> mismatches non-TLS reference in eval.o >> >>> >> >> >> /lib/libc.so.6: could not read symbols: Bad value >> >>> >> >> >> collect2: ld returned 1 exit status >> >>> >> >> >> >> >>> >> >> >> Any idea about this? Could anyone tell me the exact version >> >>> >> >> >> used >> >>> >> >> >> to >> >>> >> >> >> compile TurboSMARTS? >> >>> >> >> >> >> >>> >> >> >> Thanks, >> >>> >> >> >> Lide >> >>> >> >> > >> >>> >> > >> >>> >> > >> >>> > >> >>> > >> >> >> >> >> > > >
