Can't link demos

PLkolek

30-08-2013 16:34:22

Hello!
I'm Arch Linux user and quite new to both Ogre and MyGUI (and Cmake too). I did:
svn co http://svn.code.sf.net/p/my-gui/code/trunk my-gui
And then in the build directory:
cmake ../my-gui
make

Everything was OK, but only until it started to compile demos:
Linking CXX executable ../../bin/Demo_Colour
/usr/bin/ld: ../../lib/libCommon.a(BaseManager.cpp.o): undefined reference to symbol 'XSetWMName'
/usr/bin/ld: note: 'XSetWMName' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [bin/Demo_Colour] Błąd 1
make[1]: *** [Demos/Demo_Colour/CMakeFiles/Demo_Colour.dir/all] Błąd 2
make: *** [all] Błąd 2

I guess that output tells me the solution, but why did the error come in the first place? I read a bit on cmake and tried "adding it to the linker command line" but it didn't help at all, so probably I did it wrong. Please help!

dermont

05-09-2013 02:50:34

Not sure but you could check if your distro has changed the default linker flags to include --as-needed and --no-copy-dt- needed-entries.

http://fedoraproject.org/wiki/Understan ... LinkChange
https://wiki.debian.org/ToolChain/DSOLi ... dlibraries
http://www.gentoo.org/proj/en/qa/asneeded.xml

A quick fix would be setting the exe linker flags from the cmake gui.

CMAKE_EXE_LINKER_FLAGS -Wl,--copy-dt-needed-entries


Alternatively link against X11 and boost_system)if needed). I think this is in CMake/Utils/MyGUIConfigTargets.cmake function "mygui_app"


target_link_libraries(${PROJECTNAME}
Common X11 boost_system
)

Altren

05-09-2013 11:51:48

I see the problem now. I added X11 to linker to avoid this problem.