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

[vcpkg] Halide builds but CMake imports fail #8403

Open
kwsp opened this issue Aug 29, 2024 · 2 comments
Open

[vcpkg] Halide builds but CMake imports fail #8403

kwsp opened this issue Aug 29, 2024 · 2 comments
Assignees

Comments

@kwsp
Copy link

kwsp commented Aug 29, 2024

I'm using VCPKG to build Halide. It builds correctly and outputs the following usage

[cmake] The package halide provides CMake targets:
[cmake] 
[cmake]     set(CMAKE_CXX_STANDARD 17)
[cmake]     set(CMAKE_CXX_STANDARD_REQUIRED YES)
[cmake]     set(CMAKE_CXX_EXTENSIONS NO)
[cmake] 
[cmake]     find_package(Halide REQUIRED)
[cmake] 
[cmake]     # JIT mode:
[cmake]     add_executable(my_halide_app main.cpp)
[cmake]     target_link_libraries(my_halide_app PRIVATE Halide::Halide)
[cmake] 
[cmake]     # AOT mode:
[cmake]     add_executable(my_generators my_generators.cpp)
[cmake]     target_link_libraries(my_generators PRIVATE Halide::Generator)
[cmake]     add_halide_library(my_first_generator FROM my_generators)
[cmake]     add_halide_library(my_second_generator FROM my_generators
[cmake]         PARAMS parallel=false scale=3.0 rotation=ccw output.type=uint16)
[cmake]     add_halide_library(my_second_generator_2 FROM my_generators
[cmake]         GENERATOR my_second_generator
[cmake]         PARAMS scale=9.0 rotation=ccw output.type=float32)
[cmake]     add_halide_library(my_second_generator_3 FROM my_generators
[cmake]         GENERATOR my_second_generator
[cmake]         PARAMS parallel=false output.type=float64)
[cmake] 
[cmake] For more information see:
[cmake]     https://github.com/halide/Halide/blob//README_cmake.md

However, the next part of CMake configure fails

[cmake] -- Running vcpkg install - done
[cmake] CMake Error at build/clang/vcpkg_installed/arm64-osx/share/HalideHelpers/Halide-Interfaces.cmake:127 (message):
[cmake]   The imported target "Halide::Adams2019" references the file
[cmake] 
[cmake]      "/Users/tnie/code/cpp/HalideTutorial/build/clang/vcpkg_installed/arm64-osx/tools/halide/libautoschedule_adams2019.so"
[cmake] 
[cmake]   but this file does not exist.  Possible reasons include:
[cmake] 
[cmake]   * The file was deleted, renamed, or moved to another location.
[cmake] 
[cmake]   * An install or uninstall procedure did not complete successfully.
[cmake] 
[cmake]   * The installation package was faulty and contained
[cmake] 
[cmake]      "/Users/tnie/code/cpp/HalideTutorial/build/clang/vcpkg_installed/arm64-osx/share/HalideHelpers/Halide-Interfaces.cmake"
[cmake] 
[cmake]   but not all the files it references.
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   build/clang/vcpkg_installed/arm64-osx/share/HalideHelpers/HalideHelpersConfig.cmake:5 (include)
[cmake]   /Users/tnie/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
[cmake]   /opt/homebrew/Cellar/cmake/3.30.0/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
[cmake]   build/clang/vcpkg_installed/arm64-osx/share/halide/HalideConfig.cmake:59 (find_dependency)
[cmake]   /Users/tnie/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
[cmake]   src/CMakeLists.txt:6 (find_package)
[cmake] 

Looks like Halide's CMake script is trying to find the dynamic libraries

build/clang/vcpkg_installed/arm64-osx/tools/halide/libautoschedule_adams2019.so

but they are actually here:

~ fd -I libautoschedule_adams2019.so
clang/vcpkg_installed/arm64-osx/bin/libautoschedule_adams2019.so
clang/vcpkg_installed/arm64-osx/debug/bin/libautoschedule_adams2019.so

This is not just a problem with the version of Halide port currently in the VCPKG repo (v17.0.1), since I created my own VCPKG port of Halide by bundling the prebuilt v18.0.0 binaries and got the same error on mac.

The same repo builds on Windows. I wonder if CMake on mac handles paths differently.

Repo to reproduce failure on mac but success on Windows: https://github.com/kwsp/HalideTutorial
By default this uses the Halide port in VCPKG. To try v18.0.0 on mac, change halide to halide-prebuilt in vcpkg.json

@alexreinking
Copy link
Member

alexreinking commented Sep 4, 2024

I wasn't the last person to update the vcpkg port for Halide, unfortunately. Please open an issue with the vcpkg maintainers.

@alexreinking alexreinking self-assigned this Sep 4, 2024
@alexreinking alexreinking changed the title [mac] Halide builds but CMake imports fail [vcpkg] Halide builds but CMake imports fail Sep 4, 2024
@alexreinking
Copy link
Member

alexreinking commented Sep 4, 2024

@yurybura might be interested in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@alexreinking @kwsp and others