FAQ #16: Linker warning "multiple common of ..." [gcc]

Frequently Asked Questions regarding DCMTK

Moderator: FAQ Team

Post Reply
Message
Author
Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

FAQ #16: Linker warning "multiple common of ..." [gcc]

#1 Post by Jörg Riesmeier »

:?: I am using GNU gcc (or egcs) to compile DCMTK, and receive many warnings of the following type:
libXXX.a(XXX.o): warning: multiple common of `XXX type_info node'
XXX.o: warning: previous common is here

Is this a bug in DCMTK? Can I avoid this warning somehow?

:!: This is not a bug in DCMTK but a problem with GNU's implementation of RTTI. It affects at least egcs and gcc 2.9x when used with GNU "ld", a combination that typically found in recent Linux distributions. The warning is harmless and can be ignored.

If you are really annoyed by this warning, there are two ways to avoid it:
  1. You can compile DCMTK with RTTI support switched off. DCMTK does not use RTTI, so this is safe and will also result in smaller binaries. However, the resulting libraries cannot be linked with other C++ libraries that were compiled with RTTI support switched on. To disable RTTI, add the flag "-fno-rtti" to the CXXFLAGS setting in "config/Makefile.def" after configuration, but before compiling.
  2. You can globally switch the warning off by changing gcc's configuration. This is located in <install_prefix>/lib/gcc-lib/<platform>/<release>/specs, e.g. /usr/local/lib/gcc-lib/i486-linux/2.95/specs. This is a text file. You just need to remove the flag "-warn-common" in the section beginning with "*lib:". Make sure you know what you're doing!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest