-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
Operating system
Windows
Compiler
MSVC + Clang[++]
Steps to reproduce the behavior
1. Create vcpkg project (in manifest mode) with dependency on `dlib`
2. Set toolchain file to `[vcpkg location]/scripts/buildsystems/vcpkg.cmake`
3. Set `CMAKE_CXX_COMPILER` to `clang++` and `CMAKE_C_COMPILER` to `clang`
4. Attempt to build the projectFailure logs
Build failure happens at consumption, rather than initial dependency build, so I don't have a full log, This is the output I'm seeing though:
C:\Users\Nyoma\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Release --preset release -S "C:\Users\Nyoma\Documents\MyProject" -B "C:\Users\Nyoma\Documents\MyProject\build\release"
-- Running vcpkg install
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
* blas:x64-windows@2023-04-14#5 -- git+https://github.com/microsoft/vcpkg@240d6e92a04768c856492186df3e2b5f642c5e37
dlib:x64-windows@20.0#3 -- git+https://github.com/microsoft/vcpkg@99b774fa20444e1478612c7c4deb712575a510a9
* lapack:x64-windows@2023-06-10#3 -- git+https://github.com/microsoft/vcpkg@12ac83a3627b42dd68a96751ec39051b89761656
* lapack-reference[blas-select,core,noblas]:x64-windows@3.12.1#2 -- git+https://github.com/microsoft/vcpkg@f50927961bf58450be5c919b3f2e66584cd6585c
* libjpeg-turbo:x64-windows@3.1.2 -- git+https://github.com/microsoft/vcpkg@26b02f049c1cbfc9d996c7b56cfd1f4598f6f158
* libpng:x64-windows@1.6.53 -- git+https://github.com/microsoft/vcpkg@6bf3aa4213d63a42bdcf18f229df7e703f80c5aa
* openblas:x64-windows@0.3.29 -- git+https://github.com/microsoft/vcpkg@3d3d198cfb372ccd328a36248c4c12fb7c6b3bb6
* vcpkg-cmake:x64-windows@2024-04-23 -- git+https://github.com/microsoft/vcpkg@e74aa1e8f93278a8e71372f1fa08c3df420eb840
* vcpkg-cmake-config:x64-windows@2024-05-23 -- git+https://github.com/microsoft/vcpkg@97a63e4bc1a17422ffe4eff71da53b4b561a7841
* vcpkg-gfortran:x64-windows@3#3 -- git+https://github.com/microsoft/vcpkg@1af46bd54a9156a9f24fc7c8715488699522b382
* zlib:x64-windows@1.3.1 -- git+https://github.com/microsoft/vcpkg@3f05e04b9aededb96786a911a16193cdb711f0c9
Additional packages (*) will be modified to complete this operation.
Restored 11 package(s) from C:\Users\Nyoma\AppData\Local\vcpkg\archives in 2.4 s. Use --debug to see more details.
Installing 1/11 vcpkg-cmake-config:x64-windows@2024-05-23...
Elapsed time to handle vcpkg-cmake-config:x64-windows: 4.71 ms
vcpkg-cmake-config:x64-windows package ABI: a7cde937e07b52f493addace9e3aa089247fe1bf22f2335a5ecbb08087ad2ffe
Installing 2/11 vcpkg-cmake:x64-windows@2024-04-23...
Elapsed time to handle vcpkg-cmake:x64-windows: 6.73 ms
vcpkg-cmake:x64-windows package ABI: 142c6890ae89ffb525b057fffca388ced5d359956cc90f08b5d65b1491e6a47f
Installing 3/11 zlib:x64-windows@1.3.1...
Elapsed time to handle zlib:x64-windows: 12.4 ms
zlib:x64-windows package ABI: 12e0bb22626acaa80a4bbd3e9a6fd1b7687b74b8c253b919f20b3422e4be31bf
Installing 4/11 libpng:x64-windows@1.6.53...
Elapsed time to handle libpng:x64-windows: 13 ms
libpng:x64-windows package ABI: 276159224203f4544819944d33e348320a1180fed76e1e859827758e137266b4
Installing 5/11 libjpeg-turbo:x64-windows@3.1.2...
Elapsed time to handle libjpeg-turbo:x64-windows: 18.3 ms
libjpeg-turbo:x64-windows package ABI: 663a64f067f3ac82b10c5fa9ad4415a27757bf77a6367bb783e89e7c35537c38
Installing 6/11 openblas:x64-windows@0.3.29...
Elapsed time to handle openblas:x64-windows: 29.8 ms
openblas:x64-windows package ABI: f8da97986d34730c01dfd7d5022b8a4b240e233957909bb6195f78842b17972f
Installing 7/11 blas:x64-windows@2023-04-14#5...
Elapsed time to handle blas:x64-windows: 21 ms
blas:x64-windows package ABI: 7e1d60e8361400e9483921411b844c3bfdb22bbe8d3c885ea13af8492ac11bcb
Installing 8/11 vcpkg-gfortran:x64-windows@3#3...
Elapsed time to handle vcpkg-gfortran:x64-windows: 20.9 ms
vcpkg-gfortran:x64-windows package ABI: 6bed9ff4c4369847d089571ecb6c30aed707a783f204c9dc87dac90cfcc834ae
Installing 9/11 lapack-reference[blas-select,core,noblas]:x64-windows@3.12.1#2...
Elapsed time to handle lapack-reference:x64-windows: 29.2 ms
lapack-reference:x64-windows package ABI: e102bf6371e15e324ca6382ac7da72adcd91eda6f6ba75b236acd01e4b33a10e
Installing 10/11 lapack:x64-windows@2023-06-10#3...
Elapsed time to handle lapack:x64-windows: 5.08 ms
lapack:x64-windows package ABI: c1b8f82d0569d91282f243c724714fcfb8f428e47508992f0ccd29f62a98f5b3
Installing 11/11 dlib:x64-windows@20.0#3...
Elapsed time to handle dlib:x64-windows: 282 ms
dlib:x64-windows package ABI: e80d0fa2c638cec0bc029cddb8fce7f6d8d2f4251e684bcf83d120c7c522086a
Total install time: 467 ms
dlib provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(dlib CONFIG REQUIRED)
target_link_libraries(main PRIVATE dlib::dlib)
dlib provides pkg-config modules:
# Numerical and networking C++ library
dlib-1
-- Running vcpkg install - done
-- The CXX compiler identification is Clang 19.1.5 with GNU-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/Llvm/x64/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: C:/Users/Nyoma/Documents/MyProject/build/release/vcpkg_installed/x64-windows/lib/openblas.lib
-- Using VCPKG FindLAPACK from package 'lapack-reference'
-- The C compiler identification is Clang 19.1.5 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/Llvm/x64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
-- Configuring done (13.7s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/Nyoma/Documents/MyProject/build/release
Cannot get compiler information:
Compiler exited with error code 1: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin\clang++.exe -xc++ "-isystemC:/Users/Nyoma/Documents/MyProject/build/release/vcpkg_installed/x64-windows/include" -O3 -DNDEBUG -std=gnu++20 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt /bigobj -fpch-preprocess -v -dD -E
clang version 19.1.5
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin
clang++: error: no such file or directory: '/bigobj'
Additional context
The problem occurs when allowing vcpkg to build dlib using MSVC (in my case, using cl as the default), and then manually specifying a non-MSVC compiler (in my case Clang++) for the consuming project. To my understanding, this behavior should be supported just fine by vcpkg. I've used other dependencies with this methodology with no issue (e.g., CGAL, OpenCascade, boost).
The problem appears to be caused by the /bigobj variable being forced into the dlib.cmake target during compile/build-time for the dependency, whether or not the consumer actually uses MSVC.
I suspect this may actually be more of a bug with dlib itself, rather than a problem with the vcpkg port. However, since this use-case is much more likely to occur via vcpkg, I thought it would also be valuable to submit an issue here to potentially implement a workaround patch until a solution is found within the dlib source.
For more details/analysis, see: davisking/dlib#3125