Fwd: Duplicate Symbols when compiling with arm-linux-gnueabihf

U.Mutlu um@mutluit.com
Sat Jul 14 09:48:00 GMT 2018


Can't say if that's the reason, but "#pragma once" could be the culprit.
In my prev posting I suggested to use classical include guards instead.

https://en.wikipedia.org/wiki/Pragma_once
"
Caveats
Identifying the same file on a file system is not a trivial task.[5] Symbolic 
links and especially hard links may cause the same file to be found under 
different names in different directories. Compilers may use a heuristic that 
compares file size, modification time and content.[6] This backfires when the 
same file is intentionally copied into several parts of a project. With 
include guard based on file path these copies would be treated differently 
while #pragma once may arbitrarily treat them as the same file in a 
compiler-dependent way.
"


Ignitus Boyone wrote on 07/13/2018 10:01 PM:
> I apologize about that. I must have left that extra path in from before I
> started to package the example for external use. I've updated the tarball
> to remove it.
>
> The issue still occurs.  I'm going to include new copies fo the compiler
> output for armel and x86_64 and selected objdumps grepped for simple_type
> below.
> The armel objects definitely include more symbol lines, but I just don't
> know enough about the target arch to actually determine what is
> normal/abnormal.  I'm assuming the core problem is the following
> but I need help on if this is something that can be worked around or even
> expected behavior.
>
> 00000000 UNKNOWN
>   .text._ZN3xsd3cxx4tree11simple_typeIcNS1_4typeEEC2Ev
> 00000018 UNKNOWN           typeinfo for xsd::cxx::tree::simple_type<char,
> xsd::cxx::tree::type>
> 00000020 UNKNOWN           typeinfo name for
> xsd::cxx::tree::simple_type<char, xsd::cxx::tree::type>
>
>
> #armel
> arm-linux-gnueabihf-g++ --std=c++14 -I. -Ibiogears/schema -fPIC -o
> DoubleList.o -c DoubleList.cxx
> arm-linux-gnueabihf-g++ --std=c++14 -I. -Ibiogears/schema -fPIC -o
> IntegerList.o -c IntegerList.cxx
> Building libbiogears_cdm.so
> arm-linux-gnueabihf-g++ -shared -Wl,-soname,libbiogears_cdm_d.so -o
> libbiogears_cdm_d.so DoubleList.o IntegerList.o
> IntegerList.o:(.data.rel.ro+0x1c): multiple definition of `typeinfo for
> xsd::cxx::tree::simple_type<char, xsd::cxx::tree::type>'
> DoubleList.o:(.data.rel.ro+0x1c): first defined here
> IntegerList.o:(.rodata+0x40): multiple definition of `typeinfo name for
> xsd::cxx::tree::simple_type<char, xsd::cxx::tree::type>'
> DoubleList.o:(.rodata+0x40): first defined here
> collect2: error: ld returned 1 exit status
> Makefile:32: recipe for target 'libbiogears_cdm.so' failed
> make: *** [libbiogears_cdm.so] Error 1
<snip>



More information about the Gcc-help mailing list