Skip to content

Commit 96de933

Browse files
ppisarjrohel
authored andcommitted
build: Fix searching libdnf header files
Previously, a search path for in-source libdnf header files was listed in the middle of paths for other dependencies. That caused swig to generate bindings from system header files, possible incompatible with the in-source library, leading to a build failure like this: cd /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python && /usr/bin/cmake -E env SWIG_LIB=/usr/share/swig/4.3.1 /usr/bin/swig -python -DSWIGWORDSIZE64 -DLIBDNF_UNSTABLE_API -outdir /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python -c++ -interface _repo -I/usr/include/gio-unix-2.0 -I/usr/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/json-c -I/usr/include/libxml2 -I/home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0 -I/home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/libdnf/utils -I/usr/include/python3.14 -o /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_repo.dir/repoPYTHON_wrap.cxx /home/test/fedora/ libdnf/libdnf-0.74.0-build/libdnf-0.74.0/bindings/swig/repo.i [...] /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx: In function ‘PyObject* _wrap_ConfigMain_usr_drift_protected_paths(PyObject*, PyObject*)’: /home/test/fedora/libdnf/libdnf-0.74.0-build/libdnf-0.74.0/build-py3/bindings/python/CMakeFiles/_conf.dir/confPYTHON_wrap.cxx:23913:54: error: ‘class libdnf::ConfigMain’ has no member named ‘usr_drift_protected_paths’ 23913 | result = (libdnf::OptionStringList *) &(arg1)->usr_drift_protected_paths(); | ^~~~~~~~~~~~~~~~~~~~~~~~~ This patch fixes the header search path order by placing both paths to the in-source header files at the very first place. Resolve: #1716
1 parent a067e64 commit 96de933

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ option(WITH_TESTS "Enables unit tests" ON)
4242
option(WITH_SANITIZERS "Build with address, leak and undefined sanitizers (DEBUG ONLY)" OFF)
4343

4444

45+
# always place our header files before system ones
46+
include_directories(${CMAKE_SOURCE_DIR} libdnf/utils/)
47+
4548
# load pkg-config first; it's required by other modules
4649
find_package(PkgConfig REQUIRED)
4750
if(APPLE)
@@ -69,9 +72,6 @@ pkg_check_modules(RPM REQUIRED rpm>=4.15.0)
6972
pkg_check_modules(SMARTCOLS REQUIRED smartcols)
7073
pkg_check_modules(SQLite3 REQUIRED sqlite3)
7174

72-
# always enable linking with libdnf utils
73-
include_directories(${CMAKE_SOURCE_DIR} libdnf/utils/)
74-
7575
if (WITH_ZCHUNK)
7676
pkg_check_modules(ZCHUNKLIB zck>=0.9.11 REQUIRED)
7777
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_ZCHUNK")

0 commit comments

Comments
 (0)