From be4a550261d5baac35482c773f56095e890e1b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Tue, 24 Nov 2020 11:14:49 +0100 Subject: [PATCH] Set CMAKE_SKIP_RPATH to TRUE When skipping RPATH make doc raise: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file execfile_(filename, namespace) File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_ exec_(code, _globals) File "/home/user/librepo/doc/python/conf.py", line 15, in import librepo File "/home/user/librepo/build/librepo/python/python3/librepo/__init__.py", line 1081, in import librepo._librepo ImportError: librepo.so.0: cannot open shared object file: No such file or directory A fix is to set properly LD_LIBRARY_PATH in sphinx env call --- CMakeLists.txt | 1 + doc/python/CMakeLists.txt | 2 +- librepo/CMakeLists.txt | 2 ++ librepo/python/CMakeLists.txt | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68ce9537f..af1a434f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ SET (VERSION "${LIBREPO_MAJOR}.${LIBREPO_MINOR}.${LIBREPO_PATCH}") SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall") SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb -O0 -Wall -Wextra -DDEBUG") +SET (CMAKE_SKIP_RPATH TRUE) IF(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "debug")) MESSAGE("Build type is set do DEBUG!") diff --git a/doc/python/CMakeLists.txt b/doc/python/CMakeLists.txt index 2e3c84674..4e75d7194 100644 --- a/doc/python/CMakeLists.txt +++ b/doc/python/CMakeLists.txt @@ -1,5 +1,5 @@ ADD_CUSTOM_TARGET (doc-python - PYTHONPATH=${CMAKE_BINARY_DIR}/librepo/python/ sphinx-build -E -b html + LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/librepo PYTHONPATH=${CMAKE_BINARY_DIR}/librepo/python sphinx-build -E -b html ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Building Python API documentation with Sphinx") diff --git a/librepo/CMakeLists.txt b/librepo/CMakeLists.txt index 68d78677b..9dd0e09d8 100644 --- a/librepo/CMakeLists.txt +++ b/librepo/CMakeLists.txt @@ -102,3 +102,5 @@ INSTALL(FILES "${CMAKE_BINARY_DIR}/librepo.pc" IF (ENABLE_PYTHON) ADD_SUBDIRECTORY(python) ENDIF (ENABLE_PYTHON) + +SET(CMAKE_SKIP_RPATH TRUE) diff --git a/librepo/python/CMakeLists.txt b/librepo/python/CMakeLists.txt index 8523ca767..91b738552 100644 --- a/librepo/python/CMakeLists.txt +++ b/librepo/python/CMakeLists.txt @@ -44,3 +44,5 @@ TARGET_LINK_LIBRARIES(_librepo INSTALL(FILES ${pylibrepo_SRCDIR}/__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/librepo) INSTALL(TARGETS _librepo LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/librepo) + +SET(CMAKE_SKIP_RPATH TRUE)