Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsoncpp: fix generated pkg-config file #92307

Merged
merged 1 commit into from Jul 8, 2020

Conversation

lopsided98
Copy link
Contributor

Motivation for this change

Using jsoncpp's imported CMake targets currently results in the following error:

CMake Error in src/CMakeLists.txt:
  Imported target "JSONCPP::JSONCPP" includes non-existent path

    "/nix/store/gg18a1zlj0wkdlx3qv5549vwhyqiidzg-jsoncpp-1.9.2//nix/store/gg18a1zlj0wkdlx3qv5549vwhyqiidzg-jsoncpp-1.9.2/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.

This happens because jsoncpp uses the install(EXPORT ...) CMake function, which does not work with absolute paths in the CMAKE_INSTALL_INCLUDEDIR variable. This PR makes the package use a relative path for CMAKE_INSTALL_INCLUDEDIR, which is fine in this case because this package does not use split outputs.

cc @ttuegel @cpages @nand0p

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@jtojnar
Copy link
Contributor

jtojnar commented Jul 5, 2020

install(EXPORT ...) should support absolute install directories, the only difference I see is the following, which I would expect to work:

--- /nix/store/1krp64nddlrz0lv3nmfj0c7dlphl9lng-jsoncpp-1.9.2/lib/cmake/jsoncpp/jsoncppConfig.cmake
+++ /nix/store/37mfb95lf2nc3pvbkl4zj49d11wzs8ls-jsoncpp-1.9.2/lib/cmake/jsoncpp/jsoncppConfig.cmake
@@ -42,14 +42,14 @@
 
 
 # The installation prefix configured by this project.
-set(_IMPORT_PREFIX "/nix/store/1krp64nddlrz0lv3nmfj0c7dlphl9lng-jsoncpp-1.9.2")
+set(_IMPORT_PREFIX "/nix/store/37mfb95lf2nc3pvbkl4zj49d11wzs8ls-jsoncpp-1.9.2")
 
 # Create imported target jsoncpp_lib
 add_library(jsoncpp_lib SHARED IMPORTED)
 
 set_target_properties(jsoncpp_lib PROPERTIES
   INTERFACE_COMPILE_FEATURES "cxx_std_11;cxx_auto_type;cxx_decltype;cxx_default_function_template_args;cxx_defaulted_functions;cxx_delegating_constructors;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_lambdas;cxx_long_long_type;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_right_angle_brackets;cxx_rvalue_references;cxx_static_assert;cxx_strong_enums;cxx_trailing_return_types;cxx_uniform_initialization;cxx_variadic_macros;cxx_variadic_templates"
-  INTERFACE_INCLUDE_DIRECTORIES "/nix/store/1krp64nddlrz0lv3nmfj0c7dlphl9lng-jsoncpp-1.9.2/include"
+  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
 )
 
 # Load information for each installed configuration.

Where are you seeing the error?


Now there is actually an issue with the .pc file generation but that should be fixed as described in https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files.

@lopsided98
Copy link
Contributor Author

lopsided98 commented Jul 5, 2020

Yeah, the problem is in the pkgconfig file. I mistakenly assumed it was using the CMake config file.

I submitted a PR: open-source-parsers/jsoncpp#1199.

It looks like they support meson now, but I think at least ethminer depends on jsoncpp's CMake config files.

@lopsided98 lopsided98 changed the title jsoncpp: fix generated CMake config file jsoncpp: fix generated pkg-config file Jul 5, 2020
@lopsided98
Copy link
Contributor Author

I added the patch to this PR.

@lopsided98 lopsided98 force-pushed the jsoncpp-cmake branch 2 times, most recently from 5a25c2c to 8635977 Compare July 5, 2020 21:59
@jtojnar jtojnar added this to In progress in CMake breakage Jul 8, 2020
@jtojnar jtojnar merged commit 9b763e2 into NixOS:master Jul 8, 2020
CMake breakage automation moved this from In progress to Done Jul 8, 2020
@jtojnar
Copy link
Contributor

jtojnar commented Jul 8, 2020

Thanks.

@lopsided98 lopsided98 deleted the jsoncpp-cmake branch July 8, 2020 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants