Started by ingar, 09 April 2019, 16:58:06
QuoteI managed to install TGUI as Dynamic Library on my Raspberry PI 386 Debian Linux.
QuoteIn the long run it creates a lot of support issues.
cmake_minimum_required(VERSION 3.5)project(CMake-test)add_executable(Test main.cpp)set(SFML_STATIC_LIBRARIES TRUE)find_package(SFML 2 COMPONENTS graphics window system REQUIRED)target_link_libraries(Test PRIVATE sfml-graphics)
Quote from: texus on 09 April 2019, 19:01:02QuoteI managed to install TGUI as Dynamic Library on my Raspberry PI 386 Debian Linux.Did you encounter any issues in doing this? It's been a few years since I tested TGUI on a Respberry Pi, so I'm interested to hear whether or not it still works without manual changes.QuoteIn the long run it creates a lot of support issues.What kind of problems would you expect? I know it is possible to bundle the .so files with the application. It takes a lot of experimenting and you missed a file which causes it to break on newer linux systems several years later then you just need to ship that extra file. But I would consider the issues with .so files more on a short term, once you figure out how to do it properly it should continue to work on newer systems.I've never build statically on linux so I can't help much. How did you get the other .a files? I'm not sure if they are all going to be compatible with each other when you download some random versions, but building them yourself is probably too difficult.XRRQueryVersion and XRRGetScreenResources are part of the xrandr library. So maybe you have an incompatible libxrandr.a file or something?I don't think this is specific to TGUI, if you reproduce it with only SFML then maybe you could ask it on their forum. Hopefully someone on the SFML forum would be able to help you further. You should try to make your own simple cmake project (which only uses SFML and not TGUI) and see if the issue still occurs, e.g. something like this:Code (cmake) Select Expandcmake_minimum_required(VERSION 3.5)project(CMake-test)add_executable(Test main.cpp)set(SFML_STATIC_LIBRARIES TRUE)find_package(SFML 2 COMPONENTS graphics window system REQUIRED)target_link_libraries(Test PRIVATE sfml-graphics)
Quote from: texus on 09 April 2019, 19:09:56I didn't notice earlier that your last error was after the TGUI library was already build. Try disabling TGUI_BUILD_GUI_BUILDER when building TGUI. In the cmake gui uncheck the option or in the command line pass -DTGUI_BUILD_GUI_BUILDER=FALSEThis might be a problem with how the gui builder is linked.Update:I just tested it here and I also get these errors when TGUI_BUILD_GUI_BUILDER is on (default). I'll look into it.Disabling the TGUI_BUILD_GUI_BUILDER fixes the issue.Update 2:I figured out why the gui-builder is giving these undefined reference errors.SFML radically changed their cmake script in SFML 2.5 but in order to remain compatible with older SFML versions I added a compatibility layer. Since SFML_DIR is not defined, TGUI is using it's own way to find SFML which was apparently broken for static linking. This has now been fixed in the latest version on github.However it turns out that if the compatibility layer isn't used (by setting SFML_DIR to /usr/local/lib/cmake/SFML/ or wherever SFML is installed), it will give undefined references to GLX functions instead. I had to manually link to GLX to build statically. This does look like an issue with SFML itself. I'll try to investigate it further in the next few days.
Quote from: texus on 25 April 2019, 17:54:51How did you check which libraries TGUI depends on (to exclude that you are linking to the dynamic libraries yourself, and more importantly so that I can try it here)?TGUI is supposed to always link in the same way as SFML unless you manually specify otherwise. Did you change some cmake flags? Are you adding defines other than SFML_STATIC in your project?
Quote from: texus on 26 April 2019, 17:53:15That option has to be set to FALSE, but it should be done in cmake (either by unchecking it in the gui or by specifying -DTGUI_SHARED_LIBS=FALSE at the command line). If that option is TRUE then you are building dynamic tgui libraries (which will obviously link to dynamic sfml libraries).