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

pkg_config doesn't work on Windows #3

Closed
chadaustin opened this issue Jun 18, 2023 · 3 comments
Closed

pkg_config doesn't work on Windows #3

chadaustin opened this issue Jun 18, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@chadaustin
Copy link

I think fcfba4e broke the build on Windows:

The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit code: 1

error: failed to run custom build command for `libheif-sys v1.14.3`

Caused by:
  process didn't exit successfully: `D:\HOME\vault\projects\imagehash\target\debug\build\libheif-sys-5ea8e5c56504397d\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBHEIF_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBHEIF_STATIC
  cargo:rerun-if-env-changed=LIBHEIF_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=LIBHEIF_STATIC
  cargo:rerun-if-env-changed=LIBHEIF_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"pkg-config" "--libs" "--cflags" "libheif" "libheif >= 1.14"` did not exit successfully: exit code: 1
  error: could not find system library 'libheif' required by the 'libheif-sys' crate

  --- stderr
  Package libheif was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libheif.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'libheif', required by 'virtual:world', not found
  Package 'libheif', required by 'virtual:world', not found
chadaustin referenced this issue Jun 18, 2023
The previous approach relied on the library being in the
linker's default paths.
@Cykooz Cykooz self-assigned this Jun 18, 2023
@Cykooz Cykooz added the bug Something isn't working label Jun 18, 2023
@chadaustin
Copy link
Author

Oh, the original diff broke the build on my Ubuntu 18 machine too, but that's because the pkg-config invocation is constrained to libheif 1.14 and the PPA only has 1.13 for Ubuntu 18.

I'm not blocked -- I can stick with my current Cargo.lock -- but I wanted to mention that too.

@Cykooz
Copy link
Owner

Cykooz commented Jun 21, 2023

I've released version 1.14.4.
This version of the crate uses vcpkg crate instead of pkg-config if build target is Windows.

Also you can use cargo-vcpkg to build libheif with help of cargo command:

cargo vcpkg -v build

@chadaustin
Copy link
Author

Thank you!

@Cykooz Cykooz closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants