[CMake] Linking problems

Alexander Neundorf a.neundorf-work at gmx.net
Fri Apr 17 12:51:27 EDT 2009


On Friday 17 April 2009, you wrote:
> Alex,
>
> Again thanks for your continuing support.  I must admit things are
> getting a little technical for me.
>
> OS X 10.5 has nm but no -C option.  I am attaching the manual page.  I
> tried various options but I could produce clean unmangled references.
> For you information I am attaching the output from RtMidi.o run
> against the version that links--goodRtMidi.txt and the one that
> doesn't (produced from cmake)--badRtMidi.txt.  I have also attached
> the manual page for nm.  Any for guidance, request or suggestions will
> be greatly appreciated.

The -C would have "demangled" the C++ symbols from their mangled form back to 
readable form. So we have to check the mangled names.

E.g. you get an undefined reference to 
   "RtMidiOut::initialize()", referenced from:
       RtMidiOut::RtMidiOut()in RtMidi.cpp.o
       RtMidiOut::RtMidiOut()in RtMidi.cpp.o

Now searching for "initialize" in goodRtMidi.txt gives:
00000660 T __ZN8RtMidiIn10initializeEv

The "T" means the symbol is there, in the "text" section. 
The "__ZN8RtMidiIn10initializeEv" is the mangled C++ symbol name, encoding 
e.g. the argument types etc.

Doing the same in badRtMidi.txt gives:
         U __ZN9RtMidiOut10initializeEv

"U" means it is undefined, i.e. it must come from somewhere else. The symbol 
name is exactly the same as before.

So, something goes wrong when compiling the source file to the object file. 
Are there some ifdefs in this file ?

Alex


More information about the CMake mailing list