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

broken zycore_INCLUDE_DIR in zycore-config.cmake #74

Open
milahu opened this issue Aug 8, 2024 · 1 comment
Open

broken zycore_INCLUDE_DIR in zycore-config.cmake #74

milahu opened this issue Aug 8, 2024 · 1 comment
Labels
A-build Area: Build system C-bug Category: This is a bug P-medium Priority: Medium

Comments

@milahu
Copy link

milahu commented Aug 8, 2024

on nixos (zycore.nix)
both PACKAGE_PREFIX_DIR and CMAKE_INSTALL_INCLUDEDIR are absolute paths
so the resulting zycore-config.cmake looks something like

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
# ...
set_and_check(zycore_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}//nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/include")
set_and_check(zycore_LIB_DIR "${PACKAGE_PREFIX_DIR}//nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/lib")

zycore_INCLUDE_DIR evals to something like
/nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0//nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/include

example: zydis build fails with

CMake Error at /nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/lib/cmake/zycore/zycore-config.cmake:13 (message):
  File or directory
  /nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0//nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/include
  referenced by variable zycore_INCLUDE_DIR does not exist !
Call Stack (most recent call first):
  /nix/store/ny0cljlv9dnbf6m123mlcr0n2v1bp08q-zycore-c-1.5.0/lib/cmake/zycore/zycore-config.cmake:38 (set_and_check)
  CMakeLists.txt:109 (find_package)
  CMakeLists.txt:141 (locate_zycore)

set_and_check(zycore_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(zycore_LIB_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")

zycore-c/CMakeLists.txt

Lines 200 to 203 in 419cde9

configure_package_config_file(cmake/zycore-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/zycore-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/zycore"
)

possible solutions:
remove ${PACKAGE_PREFIX_DIR}/
use cmake_path(APPEND ...) to join paths

@athre0z
Copy link
Member

athre0z commented Aug 8, 2024

Ah yeah -- I forgot to fix this in the last release. I maintain the nixpkgs package for it and worked around it there via:

https://github.com/NixOS/nixpkgs/blob/fa12935a32af71ab3a8b4ff60ab3c37490eea336/pkgs/development/libraries/zydis/default.nix#L27-L30

We should really fix this here, though.

@athre0z athre0z added C-bug Category: This is a bug P-medium Priority: Medium A-build Area: Build system labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: Build system C-bug Category: This is a bug P-medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

2 participants