This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Multiply defined symbols during linking...


Hi,

I'm using the 970924 snapshot on a i586-pc-linux-gnulibc1 configuration.
I'm building a shared library that uses the STL. I get errors, during
linking, for multiply defined symbols in algobase.h:

__copy_dispatch<T **, T **>::__copy_dispatch(void)
__copy_backward_dispatch<T **, T **>::__copy_backward_dispatch(void)

where T is any one of the various classes I have defined in my library.

I checked out the NEWS file in the gcc directory of the snapshot and
found the following bit of information:

   * On ELF systems, duplicate copies of symbols with 'initialized
common'
     linkage (such as template instantiations, vtables, and extern
inlines)
     will now be discarded by the GNU linker, so you don't need to use
-frepo.
     This support requires GNU ld from binutils 2.8 or later.

This prompted my to download version 2.8.1 of ld in hopes of the linker
just ignoring the multiple template instantiations. Unfortunately, it
didn't appear to have any effect.

I then tried compiling with the -frepo option (I couldn't find any
documentation on it) and the shared library linked with no problems
until I tried to build a test program that linked against the library.
During the linking of the test program, there were a whole bunch of
undefined symbols. From mulitply defined symbols to undefined
symbols....

What exactly do I need to do in order for this to work???


-- Rick Harding

====================================================================
   ...Be careful whose advice you buy, but be patient with those
   who supply it. Advice is a form of nostalgia.  Dispensing it
   is a way of fishing the past from the disposal, wiping it off,
   painting over the ugly parts and recycling it for more	
   than it's worth...
                                         - K. Vonnegut
====================================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]