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

Philip Lowman philip at yhbt.com
Sat Jul 12 14:33:33 EDT 2008


On Sat, Jul 12, 2008 at 10:43 AM, Yogesh Marwaha <yogeshm.007 at gmail.com>
wrote:

> Here is a part from outpur of make VERBOSE=1
>
> ---------------------------
> Linking CXX executable Gravity
> cd /home/yogesh/gravity/New/app && /usr/bin/cmake -E cmake_link_script
> CMakeFiles/Gravity.dir/link.txt --verbose=1
> /usr/bin/c++    -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef
> -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith
> -Wformat-security -fno-exceptions -fno-check-new -fno-common
> -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden
> -fvisibility-inlines-hidden -g -O2 -fno-reorder-blocks
> -fno-schedule-insns -fno-inline  -fPIC -Wl,--enable-new-dtags
> CMakeFiles/Gravity.dir/main.o  -o Gravity -rdynamic
> -L/home/yogesh/gravity/New/library -L/home/yogesh/gravity/New/lib
> ../lib/libGravityCore.so -ltag -lphonon -lsolid -lkdecore -lkdeui
> -lkdeui -lQtSvg -lSM -lICE -lX11 -lXext -lXft -lXau -lXdmcp -lXpm
> -lstreamanalyzer -lstreams -lsolid -lQtGui -lkdecore -lQtCore
> -lpthread -lQtNetwork -lQtDBus -lQtXml-lz -lbz2 -lresolv -lXtst
> -lXcursor -lXfixes -lfam -lXrender -lkio -lsqlite3
> -Wl,-rpath,/usr/local/lib
> CMakeFiles/Gravity.dir/main.o: In function `main':
> --------------------------
>
> libGravityCore is being included, so this seems not the problem.
>
> I'm unable (atm) to grasp output of 'nm libGravityCore.so'; so am
> attching its output for you to see (in a separate mail, awaiting
> moderator's approval).
>

No need to post the contents of the entire thing, just grep for the symbols
you care about:

nm --demangle libGravityCore.so | grep "Gravity::self"
nm --demangle libGravityCore.so | grep "GApplication::GApplication"

If you see a big "U" on the second column (undefined) you're referencing the
method but not defining it.  This is usually due to having the method
defined in a header file but no implementation provided.

If you don't see any matching symbol for the method, the method is not
defined in libGravityCore.so and you will need to link your executable
against additional libraries to resolve the symbol.

Hope that helps

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080712/2f21ba39/attachment.htm>


More information about the CMake mailing list