FTXUI
FTXUI copied to clipboard
Final link failed: Bad value
trafficstars
I've been trying to integrate FTXUI into Python, through scikit-build-core. CMakeLists.txt looks like this:
cmake_minimum_required(VERSION 3.15...3.26)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C CXX)
# Source code
file(GLOB lumberjack_C_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/_lumberjack/*.c
)
file(GLOB lumberjack_CXX_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/_lumberjack/*.cc
)
# Find Python
find_package(
Python
COMPONENTS Interpreter Development.Module
REQUIRED)
# Install FTXUI
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG main
)
FetchContent_MakeAvailable(ftxui)
# Link Python
python_add_library(_lumberjack MODULE ${lumberjack_C_SRC} ${lumberjack_CXX_SRC} WITH_SOABI)
# Link FTXUI
target_link_libraries(_lumberjack
PRIVATE ftxui::screen
PRIVATE ftxui::dom
PRIVATE ftxui::component
)
# Add include directories
target_include_directories(_lumberjack PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_include_directories(_lumberjack PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/lumberjack/)
# Install extension module
install(TARGETS _lumberjack DESTINATION .)
At the end of building, the linker fails with this error:
eps/ftxui-build/libftxui-component.a _deps/ftxui-build/libftxui-dom.a _deps/ftxui-build/libftxui-screen.a && :
/usr/bin/ld: _deps/ftxui-build/libftxui-component.a(event.cpp.o): warning: relocation against `_ZN5ftxui5Event4AltEE' in read-only section `.text.startup'
/usr/bin/ld: _deps/ftxui-build/libftxui-dom.a(border.cpp.o): relocation R_X86_64_PC32 against symbol `_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
(I'm new-ish to CMake - if I made some obvious mistake please let me know. I haven't run into this issue with any other library before, so there's likely some incompatibility with FTXUI)