Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

Help getting round compiler a error (compiling CLN)

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


S.G.Pickering at bath

Nov 13, 2007, 3:53 AM

Post #1 of 5 (311 views)
Permalink
Help getting round compiler a error (compiling CLN)

Hello all,

At the start of the year I tried to compile CLN
(http://www.ginac.de/CLN/) and although the compilation worked fine,
the linking into a shared library at the end didn't. I asked on the CLN
list and was given a couple of suggestions to fix this issue, the last
of which was to "change your compiler". Unfortunately this isn't
possible (unless OS2008 uses a different version of GCC?) so I thought
I'd ask and see if anyone has any other suggestions.

The error is this:

/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

The thread on the CLN mailing list starts here (only 4 posts long):
http://www.ginac.de/pipermail/cln-list/2007-February/000267.html

I tried the suggestions for various compiler flags and to compile as a
static library, but when the static library is linked it too produces
multiple definition errors.

Any thoughts?

Thanks,


Simon

P.S. I can provide a set of debian build files (.dsc, .diff, etc.) if
anyone wants to try it for themselves.
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


rael at edge

Nov 13, 2007, 4:27 AM

Post #2 of 5 (295 views)
Permalink
Re: Help getting round compiler a error (compiling CLN) [In reply to]

Hello!

> .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

Duplicate symbols during linking is normally cause by having code/functions
with the same name in to different object files. This could again be caused
in general having problems with code in headers or wrong includes, like for
example having functions in headers that are not marked as inline or using
defines that contain whole functions or similar...

I suggest to search (grep) for the named symbols in the header files of the
cod efirst and see if there is something suspicios. Of course it can also be
possible to have the function implemented in two source modules.

One would have to look at the source code to give better answers ;-) (and
I'm at work).

--
Gruß...
Tim.
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


vahakang at cs

Nov 13, 2007, 4:41 AM

Post #3 of 5 (293 views)
Permalink
Re: Help getting round compiler a error (compiling CLN) [In reply to]

On 11/13/2007, "rael [at] edge" <rael [at] edge> wrote:
> Hello!
>
> > .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
>
> Duplicate symbols during linking is normally cause by having code/functions
> with the same name in to different object files. This could again be caused
> in general having problems with code in headers or wrong includes, like for
> example having functions in headers that are not marked as inline or using
> defines that contain whole functions or similar...
>
> I suggest to search (grep) for the named symbols in the header files of the
> cod efirst and see if there is something suspicios. Of course it can also be
> possible to have the function implemented in two source modules.
>
> One would have to look at the source code to give better answers ;-) (and
> I'm at work).
>

If that fails, see that the Makefile does not list any object file more
than once per link target ... had that happen once, too, and it took
quite a long time figure out, because the Makefile was generated by
autotools (or more specifically configure).

Cheers,

Taneli


_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


S.G.Pickering at bath

Nov 13, 2007, 8:07 AM

Post #4 of 5 (288 views)
Permalink
RE: Help getting round compiler a error (compiling CLN) [In reply to]

Thank you both for your ideas,

> > Duplicate symbols during linking is normally cause by
> having code/functions
> > with the same name in to different object files. This could
> again be caused
> > in general having problems with code in headers or wrong
> includes, like for
> > example having functions in headers that are not marked as
> inline or using
> > defines that contain whole functions or similar...

Yes, the function is implemented in more than one source module, this is
because there are different implementations for different input variable
types (e.g. integer, floating point, very large).

I don't know what level of trickery should be needed to get this to work (or
not in this case) but in the CLN thread they were talking about a compiler
error to do with the "inline" keyword.

> If that fails, see that the Makefile does not list any object
> file more
> than once per link target ... had that happen once, too, and it took
> quite a long time figure out, because the Makefile was generated by
> autotools (or more specifically configure).

No object file is listed more than once. Thanks for the tip though.

If I compile the library statically, which was one of the suggestions of how
to get round this problem, whatever I try to link against this library will
only pull out and link the individual object files it needs to use. I
suppose my problem comes because it uses more than one object file with the
same function definition (i.e. one for integers one for floating point
inputs).

I thought that the use of the "inline" keyword for a function should
completely remove any mention of such a function from the relocation table?
Can anyone think why such a function would end up in the relocation table
(and then start causing these duplicated symbol errors)? From the CLN
mailing list it appears that the same thing happens on Darwin (MacOS). Is
this likely to be a compiler bug?

Thanks,


Simon

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


eero.tamminen at nokia

Nov 14, 2007, 8:23 AM

Post #5 of 5 (283 views)
Permalink
Re: Help getting round compiler a error (compiling CLN) [In reply to]

Hi,

ext Simon Pickering wrote:
> I thought that the use of the "inline" keyword for a function should
> completely remove any mention of such a function from the relocation table?

No, you need to use "static" keyword for that.


> Can anyone think why such a function would end up in the relocation table
> (and then start causing these duplicated symbol errors)? From the CLN
> mailing list it appears that the same thing happens on Darwin (MacOS). Is
> this likely to be a compiler bug?


- Eero

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.