aardappel / treesheets

TreeSheets : Free Form Data Organizer (see strlen.com/treesheets)
zlib License
2.49k stars 184 forks source link

/usr/bin/ld: lib/wxWidgets/lib/libwx_gtk3u_core-3.3.a(utilsx11.cpp.o): undefined reference to symbol 'XGetWindowAttributes' #644

Closed mclaudt closed 1 month ago

mclaudt commented 1 month ago

First of all, many thanks for unbelievably comfort software!

While building under Ubuntu 20.04.3 LTS, ld error appears:

/usr/bin/ld: lib/wxWidgets/lib/libwx_gtk3u_core-3.3.a(utilsx11.cpp.o): undefined reference to symbol 'XGetWindowAttributes'
/usr/bin/ld: /lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/treesheets.dir/build.make:115: treesheets] Error 1
make[1]: *** [CMakeFiles/Makefile2:449: CMakeFiles/treesheets.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Steps to reproduce:

Assume we have Linux with git installed, and cloned the repo.

  1. cd treesheets

  2. cmake -S . -B _build -DCMAKE_BUILD_TYPE=Release

  3. cmake --build _build

Solution:

Add this section to CMakesLists.txt:

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    find_package(X11 REQUIRED) 
    target_link_libraries(treesheets PRIVATE ${X11_LIBRARIES})  
endif()