Multiple definition errors when natively compiling CLN 1.1.13 with GCC 3.4 for ARM target
Hello, I'm attempting to compile CLN 1.1.13 using GCC 3.4 (inside scratchbox using qemu which allows GCC to be a native ARM compiler). I am compiling for the Nokia N800. I'm compiling with the following configure command: ./configure --with-gmp --prefix=/usr and with the following env vars: CPPFLAGS="-DNO_ASM" CXXFLAGS="-O2 -fno-exceptions -finline-limit=1000 -mfpu=vfp -mfloat-abi=softfp" I get the following error (trimmed as the preceeding command is very long): /bin/sh ../libtool --mode=link g++ -o libcln.la -rpath /usr/lib -version-info 4:2:0 -lgmp -objectlist libcln.objectlist g++ -shared -nostdlib /scratchbox/compilers/cs2005q3.2-glibc-arm/lib/gcc/arm-none-linux-gnueabi/3.4.4/../../../../arm-none-linux-gnueabi/lib/crti.o <snip> .libs/cl_asm_.o /usr/lib/libgmp.so -L/scratchbox/compilers/cs2005q3.2-glibc-arm/lib/gcc/arm-none-linux-gnueabi/3.4.4 -L/usr/lib/gcc/arm-none-linux-gnueabi/3.4.4 -L/scratchbox/compilers/cs2005q3.2-glibc-arm/lib/gcc/arm-none-linux-gnueabi/3.4.4/../../../../arm-none-linux-gnueabi/lib -lstdc++ -lm -lc -lgcc_s /scratchbox/compilers/cs2005q3.2-glibc-arm/lib/gcc/arm-none-linux-gnueabi/3.4.4/crtendS.o /scratchbox/compilers/cs2005q3.2-glibc-arm/lib/gcc/arm-none-linux-gnueabi/3.4.4/../../../../arm-none-linux-gnueabi/lib/crtn.o -Wl,-soname -Wl,libcln.so.4 -o .libs/libcln.so.4.0.2 .libs/cl_I_ring.o: In function `cln::zerop(cln::cl_I const&)':cl_I_ring.cc:(.text._ZN3cln5zeropERKNS_4cl_IE[cln::zerop(cln::cl_I const&)]+0x0): multiple definition of `cln::zerop(cln::cl_I const&)' .libs/cl_I_zerop.o:cl_I_zerop.cc:(.text+0x0): first defined here .libs/cl_RA_ring.o: In function `cln::zerop(cln::cl_RA const&)':cl_RA_ring.cc:(.text._ZN3cln5zeropERKNS_5cl_RAE[cln::zerop(cln::cl_RA const&)]+0x0): multiple definition of `cln::zerop(cln::cl_RA const&)' .libs/cl_RA_zerop.o:cl_RA_zerop.cc:(.text+0x0): first defined here .libs/cl_R_signum.o: In function `cln::signum(cln::cl_I const&)':cl_R_signum.cc:(.text._ZN3cln6signumERKNS_4cl_IE[cln::signum(cln::cl_I const&)]+0x0): multiple definition of `cln::signum(cln::cl_I const&)' .libs/cl_I_signum.o:cl_I_signum.cc:(.text+0x0): first defined here collect2: ld returned 1 exit status make[2]: *** [libcln.la] Error 1 make[2]: Leaving directory `/home/simon/build/qcalculate/cln-1.1.13.orig/src' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/simon/build/qcalculate/cln-1.1.13.orig' make: *** [build] Error 2 I did a search of the mailing list archives and could only find this mentioned for MinGW. There was no solution as far as I could tell, but some talk of --param *inline* options that might make a difference. The installation instructions say the following: "If you use g++ on OSF/1 or Tru64 using gcc-2.95.x, you should specify `--disable-shared' because of linker problems with duplicate symbols in shared libraries.", which sounds like my problem, though obviously on a different platform & compiler version. I have tried altering -finline-limit (removing it, and changing the value to 10000), but to no avail, I still have the problem. I am trying to compile Qalculate, and even if I compile CLN to be a static library, I get linking errors due to the multiple functions when compiling libqalculate. Is there any way around this problem? Any other -finline*/--param options I could try, etc., or any other ideas? Many thanks, Simon P.S. I'm not subscribed to the list, but can do so if needed.
Hello! On Mon, Feb 26, 2007 at 11:03:38PM +0000, Simon Pickering wrote:
I'm attempting to compile CLN 1.1.13 using GCC 3.4 (inside scratchbox using qemu which allows GCC to be a native ARM compiler). I am compiling for the Nokia N800.
I'm compiling with the following configure command:
./configure --with-gmp --prefix=/usr
and with the following env vars:
CPPFLAGS="-DNO_ASM" CXXFLAGS="-O2 -fno-exceptions -finline-limit=1000 -mfpu=vfp -mfloat-abi=softfp"
I get the following error (trimmed as the preceeding command is very long):
[snipped infamous linker error due to duplicated symbols]
I did a search of the mailing list archives and could only find this mentioned for MinGW.
The same problem exits for Darwin (a.k.a. Mac OS X).
There was no solution as far as I could tell,
The solution is to use static library (I admit it is ugly). [snipped]
I am trying to compile Qalculate, and even if I compile CLN to be a static library, I get linking errors due to the multiple functions when compiling libqalculate.
Is there any way around this problem? Any other -finline*/--param options I could try, etc., or any other ideas?
Both CLN and Qalculate build just fine on Linux/arm (both dynamic and static libraries), see e.g. http://buildd.debian.org/fetch.cgi?pkg=cln;ver=1.1.13-2;arch=arm;stamp=11588... http://buildd.debian.org/fetch.cgi?pkg=libqalculate;ver=0.9.4-5;arch=arm;sta... The difference seems to be: 1) real hardware, 2) compilers (Debian uses GCC 4.1), 3) compiler flags (no '-mfpu=vfp -mfloat-abi=softfp'). So I suggest to 1) try to build with CXXFLAGS='-O2 -fno-exceptions -finline-limit=1000' and CPPFLAGS='-DNO_ASM', run make check after compilation 2) if that fails, upgrade the compiler Best regards, Alexei -- All science is either physics or stamp collecting.
Simon Pickering wrote:
.libs/cl_I_ring.o: In function `cln::zerop(cln::cl_I const&)':cl_I_ring.cc:(.text._ZN3cln5zeropERKNS_4cl_IE[cln::zerop(cln::cl_I const&)]+0x0): multiple definition of `cln::zerop(cln::cl_I const&)' .libs/cl_I_zerop.o:cl_I_zerop.cc:(.text+0x0): first defined here
That looks like a compiler bug. The C++ rules for 'inline' are summarized in [1], and the code in include/cln/integer.h and src/integer/cl_I.h follows these rules.
Is there any way around this problem? Any other -finline*/--param options I could try, etc., or any other ideas?
- Specify --disable-shared? - Try a newer compiler, such as gcc-4.1.2? Bruno [1] http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html
.libs/cl_I_ring.o: In function `cln::zerop(cln::cl_I const&)':cl_I_ring.cc:(.text._ZN3cln5zeropERKNS_4cl_IE[cln::zerop(cln: :cl_I const&)]+0x0): multiple definition of `cln::zerop(cln::cl_I const&)' .libs/cl_I_zerop.o:cl_I_zerop.cc:(.text+0x0): first defined here
That looks like a compiler bug. The C++ rules for 'inline' are summarized in [1], and the code in include/cln/integer.h and src/integer/cl_I.h follows these rules.
Okay.
Is there any way around this problem? Any other -finline*/--param options I could try, etc., or any other ideas?
- Specify --disable-shared?
I tried --disable-shared, and it will then compile the static library. But this doesn't really solve things for me as then the problem just occurs in whatever I want to link with the cln static library (in this case Qalculate!).
- Try a newer compiler, such as gcc-4.1.2?
I will do this once there's one available that targets the Nokia N800. Thanks, Simon
participants (3)
-
Alexei Sheplyakov
-
Bruno Haible
-
Simon Pickering