Open mgerhardy opened 8 years ago
Maybe we can somehow wrap -Wl,--whole-archive
around the TBUI link parameter
This is not totally related but the reason for the duplicate TBUI symbols when linking. It is important that the tb_config.h file under code/TBUI/tb is included before the 'official' TBUI config file. There's this line in oryol/fips-include.cmake:
https://github.com/floooh/oryol/blob/master/fips-include.cmake#L20
However, since the path there is relative, it very likely fails when included from another project, at least that's my current theory. The whole fips-include.cmake thing as an include file isn't perfect. It would be better to import the root CMakeLists.txt file (that's how importing projects in cmake is supposed to work). Most fipsifided projects already 'do the right thing' I will have to think about a proper solution. In the meantime you could try to manually set the TBUI include path directly in your project.
Can you check whether at least the duplicate symbols you had on Friday are fixed with this oryol commit? I'm basically making the header search for TBUI absolute:
https://github.com/floooh/oryol/commit/0cc9f27f8f338954912ef9fed0674c845d8a8313
Doesn't fix it:
Linking CXX executable /home/mgerhardy/dev/fips-deploy/wov/linux-make-debug/wov
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBStrC::operator char const*() const':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:12: multiple definition of `tb::TBSystem::GetTimeMS()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_system_linux.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_system_linux.cpp:27: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBSystem::GetLongClickDelayMS()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:24: multiple definition of `tb::TBSystem::GetLongClickDelayMS()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_system_linux.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_system_linux.cpp:40: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBSystem::GetPanThreshold()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:30: multiple definition of `tb::TBSystem::GetPanThreshold()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_system_linux.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_system_linux.cpp:45: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBSystem::GetDPI()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:42: multiple definition of `tb::TBSystem::GetDPI()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_system_linux.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_system_linux.cpp:55: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBSystem::GetPixelsPerLine()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:36: multiple definition of `tb::TBSystem::GetPixelsPerLine()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_system_linux.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_system_linux.cpp:50: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBClipboard::Empty()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:50: multiple definition of `tb::TBClipboard::Empty()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_clipboard_glfw.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_clipboard_glfw.cpp:17: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBClipboard::HasText()':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:57: multiple definition of `tb::TBClipboard::HasText()'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_clipboard_glfw.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_clipboard_glfw.cpp:22: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBClipboard::SetText(char const*)':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:64: multiple definition of `tb::TBClipboard::SetText(char const*)'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_clipboard_glfw.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_clipboard_glfw.cpp:33: first defined here
../../oryol_TBUI/libTBUI.a(tbOryolSystem.cc.o): In function `tb::TBClipboard::GetText(tb::TBStr&)':
/home/mgerhardy/dev/oryol/code/Modules/TBUI/tb/tbOryolSystem.cc:71: multiple definition of `tb::TBClipboard::GetText(tb::TBStr&)'
../../fips-turbobadger_turbobadger/libturbobadger.a(tb_clipboard_glfw.cpp.o):/home/mgerhardy/dev/fips-turbobadger/turbobadger/src/tb/tb_clipboard_glfw.cpp:43: first defined here
collect2: error: ld returned 1 exit status
src/client/CMakeFiles/wov.dir/build.make:258: recipe for target '/home/mgerhardy/dev/fips-deploy/wov/linux-make-debug/wov' failed
make[2]: *** [/home/mgerhardy/dev/fips-deploy/wov/linux-make-debug/wov] Error 1
CMakeFiles/Makefile2:1302: recipe for target 'src/client/CMakeFiles/wov.dir/all' failed
make[1]: *** [src/client/CMakeFiles/wov.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: *** [all] Error 2
Meh, guess I should create a standalone TBUI sample to catch errors like that and catch regressions. Is your code which reproduces this on github?
it's linked in the order
That means the unused symbols from TBUI are removed from linking because libturbobadger didn't yet had the chance to claim them for it.
And cmake doesn't even has a chance to resolve this imo - because it's circular, TBUI depends on turbobadger and turbobadger needs the symbols of TBUI (even though this is of course not stated explicitly)