Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

gcc_personality and strtol

dmatt0001
Beginner
466 Views
Hi All,

I'm trying to do a test compile of a library (contains one function with a for loop just for fun) and main routine which prints the program name using iostream and then calls the library routine. Sounds simple eh?

Well this is where I am having some problems. If I use the i_static icpc option everything is good. If I just use the static option, things go bad. I have included the output below.

I suspect it is something to do with the default lib and include paths. If I use the -# option, I see that in fact icpc is intentionally linking with

I am using the intel version 9.0 compilers installed on a linux machine in my home directory. There is nothing strange in my environment. I sourced iccvars.sh only.

Thanks for your time, I have included compile output below incase there is an obvious missuse of the tool on my part!

Regards,

Matt


Here is the good:

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -c -o build/sub2/mult_ij_j.o build/sub2/mult_ij_j.cpp
ar r build/sub2/libmult.a build/sub2/mult_ij_j.o
ranlib build/sub2/libmult.a
ar: creating build/sub2/libmult.a
Install file: "build/sub2/libmult.a" as "build/lib/libmult.a"

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -fPIC -c -o build/sub2/mult_ij_j.os build/sub2/mult_ij_j.cpp
icpc -Wl,-rpath=$ORIGIN/../lib -z origin -cxxlib-icc -i-static -shared -o build/sub2/libmult.so build/sub2/mult_ij_j.os
Install file: "build/sub2/libmult.so" as "build/lib/libmult.so"

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -Isub2 -c -o build/sub1/main.o build/sub1/main.cpp
icpc -Wl,-rpath=$ORIGIN/../lib -z origin -cxxlib-icc -i-static -o build/sub1/prog1 build/sub1/main.o -Lbuild/lib -lmult

Here is the bad:

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -c -o build/sub2/mult_ij_j.o build/sub2/mult_ij_j.cpp
ar r build/sub2/libmult.a build/sub2/mult_ij_j.o
ranlib build/sub2/libmult.a
ar: creating build/sub2/libmult.a
Install file: "build/sub2/libmult.a" as "build/lib/libmult.a"

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -fPIC -c -o build/sub2/mult_ij_j.os build/sub2/mult_ij_j.cpp
icpc -Wl,-rpath=$ORIGIN/../lib -z origin -cxxlib-icc -static -shared -o build/sub2/libmult.so build/sub2/mult_ij_j.os
Install file: "build/sub2/libmult.so" as "build/lib/libmult.so"

icpc -malign-double -align -mtune=pentium4 -no-gcc -cxxlib-icc -Isub2 -c -o build/sub1/main.o build/sub1/main.cpp
icpc -Wl,-rpath=$ORIGIN/../lib -z origin -cxxlib-icc -static -o build/sub1/prog1 build/sub1/main.o -Lbuild/lib -lmult
/usr/lib/libc.a(strtol.o): In function `strtol':
strtol.c:(.text+0x3d): multiple definition of `strtol'
/home/matt/apps/intel/cc/9.0/lib/libcprts.a(strtol.o):strtol.c:(.text+0x11a): first defined here
ld: Warning: size of symbol `strtol' changed from 260 in /home/matt/apps/intel/cc/9.0/lib/libcprts.a(strtol.o) to 62 in /usr/lib/libc.a(strtol.o)
/usr/lib/libc.a(iofclose.o):(.eh_frame+0x12): undefined reference to `__gcc_personality_v0'
/usr/lib/libc.a(iofflush.o):(.eh_frame+0x12): undefined reference to `__gcc_personality_v0'
/usr/lib/libc.a(iofgetpos.o):(.eh_frame+0x12): undefined reference to `__gcc_personality_v0'
/usr/lib/libc.a(iofputs.o):(.eh_frame+0x12): undefined reference to `__gcc_personality_v0'
/usr/lib/libc.a(iofsetpos.o):(.eh_frame+0x12): undefined reference to `__gcc_personality_v0'
/usr/lib/libc.a(iofwrite.o):(.eh_frame+0x12): more undefined references to `__gcc_personality_v0' follow
0 Kudos
1 Reply
Otto_B_Intel
Employee
466 Views
From my experience this has to do with exception handling. If you add -lgcc_s to your link command it links fine. I don't know excactly where the problem comes from though. You can also try compiling without exception support if you dont need it. The option for that is -fno-exceptions.
I hope this helps,
Otto
0 Kudos
Reply