Skip to content
Snippets Groups Projects
Commit 30422956 authored by Tomáš Pecka's avatar Tomáš Pecka Committed by Tomáš Pecka
Browse files

cmake: Link alib2cli with CMAKE_DL_LIBS

OpenSuse Leap package builds fail with undefined reference to dlclose
and dlopen. The -ldl link flag is missing (see the error below).
Let's fix that by adding the ${CMAKE_DL_LIBS} link target [1] to
alib2cli.

 /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/alib2cli.dir/src/common/LibraryLoader.cpp.o: in function `cli::LibraryLoader::Library::unload()':
 /build/pkg/build/pkgs/opensuse-leap-15.3/algorithms-library-snapshot-0.0.0.r1277.gf2a2ccf62-1/rpmbuild/BUILD/algorithms-library-v0.0.0.r1277.gf2a2ccf62/alib2cli/src/common/LibraryLoader.h:44: undefined reference to `dlclose'
 /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /build/pkg/build/pkgs/opensuse-leap-15.3/algorithms-library-snapshot-0.0.0.r1277.gf2a2ccf62-1/rpmbuild/BUILD/algorithms-library-v0.0.0.r1277.gf2a2ccf62/alib2cli/src/common/LibraryLoader.h:44: undefined reference to `dlclose'
 /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/alib2cli.dir/src/common/LibraryLoader.cpp.o: in function `cli::LibraryLoader::Library::load()':
 /build/pkg/build/pkgs/opensuse-leap-15.3/algorithms-library-snapshot-0.0.0.r1277.gf2a2ccf62-1/rpmbuild/BUILD/algorithms-library-v0.0.0.r1277.gf2a2ccf62/alib2cli/src/common/LibraryLoader.h:37: undefined reference to `dlopen'
 /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /build/pkg/build/pkgs/opensuse-leap-15.3/algorithms-library-snapshot-0.0.0.r1277.gf2a2ccf62-1/rpmbuild/BUILD/algorithms-library-v0.0.0.r1277.gf2a2ccf62/alib2cli/src/common/LibraryLoader.h:39: undefined reference to `dlerror'
 collect2: error: ld returned 1 exit status
 make[2]: *** [alib2cli/CMakeFiles/alib2cli.dir/build.make:500: alib2cli/libalib2cli.so.0.0.0] Error 1
 make[1]: *** [CMakeFiles/Makefile2:1017: alib2cli/CMakeFiles/alib2cli.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs....
 make: *** [Makefile:150: all] Error 2

[1] https://cmake.org/cmake/help/latest/variable/CMAKE_DL_LIBS.html
parent 9fe1cfbf
No related branches found
No related tags found
1 merge request!202CI apkg
project(alt-libcli VERSION ${CMAKE_PROJECT_VERSION})
find_package(LibXml2 REQUIRED)
alt_library(alib2cli
DEPENDS alib2xml alib2common alib2abstraction alib2measure alib2std
DEPENDS alib2xml alib2common alib2abstraction alib2measure alib2std ${CMAKE_DL_LIBS}
TEST_DEPENDS LibXml2::LibXml2 stdc++fs
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment