microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.01k stars 6.12k forks source link

[realsense2] Build error on x64-windows #38777

Open sidy3d opened 4 weeks ago

sidy3d commented 4 weeks ago

Package: realsense2:x64-windows@2.54.2#2

Host Environment

To Reproduce

vcpkg install Failure logs

-- Using cached IntelRealSense-librealsense-v2.54.2.tar.gz.
-- Cleaning sources at C:/dev/vcpkg/buildtrees/realsense2/src/v2.54.2-e3f135a521.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/dev/vcpkg/downloads/IntelRealSense-librealsense-v2.54.2.tar.gz
-- Applying patch fix_openni2.patch
-- Applying patch fix-osx.patch
-- Using source at C:/dev/vcpkg/buildtrees/realsense2/src/v2.54.2-e3f135a521.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
CMake Error at C:/Users/sidyn/AppData/Local/vcpkg/registries/git-trees/b15354f0a205d2288e63564e2789e317442bd999/portfile.cmake:54 (file):
  file INSTALL cannot find
  "C:/dev/vcpkg/buildtrees/realsense2/x64-windows-rel/common/fw/fw.res": File
  exists.
Call Stack (most recent call first):
  scripts/ports.cmake:175 (include)

Additional context

vcpkg.json ``` { "dependencies": [ "opencv2", "tiff", "realsense2" ] } ```
LilyWangLL commented 4 weeks ago

I can't repro this issue locally.

 .\vcpkg.exe install realsense2:x64-windows --binarysource=clear
Computing installation plan...
The following packages will be built and installed:
    realsense2:x64-windows@2.54.2#2
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
Installing 1/1 realsense2:x64-windows@2.54.2#2...
Building realsense2:x64-windows@2.54.2#2...
-- Downloading https://github.com/IntelRealSense/librealsense/archive/v2.54.2.tar.gz -> IntelRealSense-librealsense-v2.54.2.tar.gz...
-- Extracting source F:/0515/downloads/IntelRealSense-librealsense-v2.54.2.tar.gz
-- Applying patch fix_openni2.patch
-- Applying patch fix-osx.patch
-- Using source at F:/0515/buildtrees/realsense2/src/v2.54.2-e3f135a521.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
-- Installing: F:/0515/packages/realsense2_x64-windows/common/fw/fw.res
-- Installing: F:/0515/packages/realsense2_x64-windows/share/realsense2/copyright
-- Fixing pkgconfig file: F:/0515/packages/realsense2_x64-windows/lib/pkgconfig/realsense2.pc
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.4.10-4-x86_64.pkg.tar.zst.
-- Using msys root at F:/0515/downloads/tools/msys2/d33df895d441a36d
-- Fixing pkgconfig file: F:/0515/packages/realsense2_x64-windows/debug/lib/pkgconfig/realsense2.pc
-- Performing post-build validation
Elapsed time to handle realsense2:x64-windows: 2.4 min
realsense2:x64-windows package ABI: 1941d4dbbd287bbe6bddd08e50fbef1e4b9c2015e4988af583bc9bb6bab98460
Total install time: 2.4 min
realsense2 provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(realsense2 CONFIG REQUIRED)
  target_link_libraries(main PRIVATE realsense2::fw realsense2::rsutils realsense2::realsense2 realsense2::realsense-file)

realsense2 provides pkg-config modules:

  # Intel(R) RealSense(tm) Cross Platform API
  realsense2

 .\vcpkg.exe --version
vcpkg package management program version 2024-04-23-d6945642ee5c3076addd1a42c331bbf4cfc97457
sidy3d commented 4 weeks ago

Hi @LilyWangLL, I am using vcpkg with manifests mode in a standard Visual Studio project. Can you try to repo again?

sidy3d commented 4 weeks ago

This seems to be related to this, not sure how to fix: https://github.com/IntelRealSense/librealsense/issues/7947

dg0yt commented 4 weeks ago

And https://github.com/IntelRealSense/librealsense/issues/9772.

The port installs common/fw/fw.res. Apart from the unusal common prefix... IIUC the INTERFACE_LINK_LIBRARIES property of the exported realsense2::fw must be replaced with a relative path, so that it is found in the installed dir instead of buildtrees.