You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I include libconfig in my cmake project with find_package(libconfig++ REQUIRED) and target_link_libraries(${PROJECT_NAME} config++). Both on Archlinux and Fedora 31 this works fine. However on a remote machine to which I don't have root access, therefore only a local libconfig installation, linking fails with /usr/bin/ld: cannot find -lconfig++.
To install libconfig, I used the tarball from the project site, ran configure --prefix=$HOME/.local and make install and make test ran without a problem. Compiling my project works fine. I think the header files are found due to spdlog also being installed locally. When spdlog is not installed, the libconfig headers aren't found, either. So I guess there must be something wrong in the cmake configuration.
Is this supposed to happen during runtime? Printing those out results in /lib and /include. In Fedora, on the other hand, the file itself has both prefixes already replaced with /usr/lib64. But then again, on Archlinux the file looks the same, the prefixes are not substituted in, either, and everything works fine.
autoreconf in libconfig fails with "none" is not exported by the List::Util module.
g++ (GCC) 9.1.0
cmake version 3.15.2
Edit:
I didn't know I had to use the find script from the contrib directory. I assumed finding the library had worked since LIBCONFIG++_FOUND was set to 1. I now use pkg_check_modules to load the PkgConfig into cmake which works on any of my machines.
The text was updated successfully, but these errors were encountered:
zyzzyxdonta
changed the title
Linking fails when installed locally (cmake)
Compiling fails when installed locally (cmake)
Nov 15, 2019
I include libconfig in my cmake project with
find_package(libconfig++ REQUIRED)
andtarget_link_libraries(${PROJECT_NAME} config++)
. Both on Archlinux and Fedora 31 this works fine. However on a remote machine to which I don't have root access, therefore only a local libconfig installation, linking fails with/usr/bin/ld: cannot find -lconfig++
.To install libconfig, I used the tarball from the project site, ran
configure --prefix=$HOME/.local
andmake install
andmake test
ran without a problem. Compiling my project works fine. I think the header files are found due to spdlog also being installed locally. When spdlog is not installed, the libconfig headers aren't found, either. So I guess there must be something wrong in the cmake configuration.Printing all cmake variables shows:
On further investigation, I found that in the file
~/.local/lib/cmake/libconfig++/libconfig++Config.cmake
the prefix variables are not substituted in:Is this supposed to happen during runtime? Printing those out results in
/lib
and/include
. In Fedora, on the other hand, the file itself has both prefixes already replaced with/usr/lib64
. But then again, on Archlinux the file looks the same, the prefixes are not substituted in, either, and everything works fine.autoreconf
in libconfig fails with"none" is not exported by the List::Util module
.g++ (GCC) 9.1.0
cmake version 3.15.2
Edit:
I didn't know I had to use the find script from the contrib directory. I assumed finding the library had worked since
LIBCONFIG++_FOUND
was set to 1. I now usepkg_check_modules
to load the PkgConfig into cmake which works on any of my machines.The text was updated successfully, but these errors were encountered: