Can't link demos


30-08-2013 16:34:22

I'm Arch Linux user and quite new to both Ogre and MyGUI (and Cmake too). I did:
svn co my-gui
And then in the build directory:
cmake ../my-gui

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/ so try adding it to the linker command line
/usr/lib/ 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!


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. ... LinkChange ... dlibraries

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"

Common X11 boost_system


05-09-2013 11:51:48

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