FS#71086 - [nlohmann-json] pkgconfig and cmake files have incorrect paths
Attached to Project:
Community Packages
Opened by Jed Brown (jedbrown) - Tuesday, 01 June 2021, 15:05 GMT
Last edited by David Runge (dvzrv) - Sunday, 01 August 2021, 19:45 GMT
Opened by Jed Brown (jedbrown) - Tuesday, 01 June 2021, 15:05 GMT
Last edited by David Runge (dvzrv) - Sunday, 01 August 2021, 19:45 GMT
|
Details
Description:
Cflags here should be -I/usr/include: $ cat /usr/lib/pkgconfig/nlohmann_json.pc Name: nlohmann_json Description: JSON for Modern C++ Version: 3.9.1 Cflags: -I/usr/local/include The logic is more obtuse for CMake, but by default, it finds a prefix of / instead of /usr/, and thus fails to find headers in /include (which doesn't exist by default). Additional info: * package version(s) 3.9.1-2 |
This task depends upon
Closed by David Runge (dvzrv)
Sunday, 01 August 2021, 19:45 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed with nlohmann-json 3.9.1-4
Sunday, 01 August 2021, 19:45 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed with nlohmann-json 3.9.1-4
Judging from the input file we probably have to add/define CMAKE_INSTALL_INCLUDEDIR.
-- Found nlohmann_json: /lib64/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.9.1")
[...]
CMake Error in citnames/CMakeLists.txt:
Imported target "nlohmann_json::nlohmann_json" includes non-existent path
"/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
This means on a totally unrelated note, you're invoking cmake as /bin/cmake rather than /usr/bin/cmake
This is problematic since cmake sucks and will then try to find /bin/../include rather than /usr/bin/../include
Check your $PATH, and if it has /bin in it -- and *especially* if it has it before /usr/bin -- fix your system to *not* have /bin in $PATH since it's totally wrong and completely incompatible with Arch Linux's filesystem layout.
...
However:
$ pkg-list-linked-libraries -g nlohmann-json /include
==> grepping nlohmann-json-3.9.1-3-any.pkg.tar.zst ...
[...]
usr/lib/pkgconfig/nlohmann_json.pc:Cflags: -I/usr/local/include
[...]
is still broken
FS#62028FS#61952FS#66518IIRC the problematic code is created by cmake's builtin helper function for creating *Config.cmake files, using the rationale "we should try to detect the paths relative to the cmake binary because on Windows this is relocatable".
After some additional digging it appears that it's (yet again) the tests of the project having an adverse effect on the installed files.
I have opened an upstream ticket about this [1] and will close this ticket, as the pkgconfig integration *should be* fixed with nlohmann-json 3.9.1-4.
[1] https://github.com/nlohmann/json/issues/2907