[CMake] Problem linking to shared library (inside project) after upgrade to cmake 2.6

Bill Hoffman bill.hoffman at kitware.com
Mon Jul 14 10:05:15 EDT 2008


Yogesh Marwaha wrote:
> 2008/7/14 Bill Hoffman <bill.hoffman at kitware.com>:
>> OK, so this looks like some sort of moc issue.  Are you running moc on the
>> header?  You might want to run nm on all the .o files and find out where the
>> little "t" stuff is located.  Could it be that you have more than one file
>> called the same thing and the headers are getting included wrong, or the
>> .moc file is gettting over written?
>>
> I cant see this as a moc issue; what moc have to do with the
> constructor of a class? I'm directly including moc files into my
> source, and am generating moc files using qt4_automoc (please have a
> look at complete listing of CMakeLists.txt files of my project in the
> first mail of this thread)
> 
> Regarding duplicate names; no. Only "Gravity" was being duplicated, it
> was the name of the project and also the executable (generated by app
> branch), I've now changed that too.
> 
The Gravity self stuff was what made me think it was moc.  I did not 
look that close.
> One thing you may note is that if I generate library (GravityCore) as
> static, instead of dynamic/shared, then the project compiles and links
> correctly; I've not tried executing it though. Static library which is
> generated is about 12.x MB while dynamic/shared generated is around
> 6.x MB.
> Can you deduce something from that?
> 
> And regarding the t thing, I can only check this when I get back home
> later today(actually night) + try to have some basic knowledge of nm +
> do what you asked for. But I don't think I can do anything creative in
> this regard ;)
> 
> Also I'll try with similar qt4/KDE4 based projects and see the results.
> 
> Thank you all for your interest in solving my problem. Hope we'll fix it soon :)
> 
> Regards,
> 
> Yogesh M
> 
You should spend some time with nm and the .o files and make VERBOSE=1 
to try and figure out exactly what is going on.  Also, since you have 
the static build working, you should run nm on all the .o files in that 
build and figure out where the missing symbols are located in that 
build.   Also, try to get the problem down to only a few files so that 
you can post a complete example, that maybe only depends on qt?

-Bill


More information about the CMake mailing list