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

zig c++ doesn't recognize --version option used by vcpkg's boost-build, fails to build #17739

Open
bherw opened this issue Oct 27, 2023 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@bherw
Copy link

bherw commented Oct 27, 2023

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

I'm trying to use Zig as a drop-in C/C++ compiler in a cmake/vcpkg-based project to build portable binaries for older glibc. It seems to be mostly working with one exception: when building boost-build, it looks like boost-build is trying to get the clang version with --version instead of version. I've extracted a small sample that reproduces the problem I'm seeing:

vcpkg.json:

{
  "name" : "zig_boost",
  "version-string" : "0.1.0",
  "builtin-baseline" : "a618637937298060bdbe5fbcfb628eabd1082c8a",
  "dependencies" : [ {
    "name" : "boost-system",
    "version>=" : "1.82.0#1"
  }
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(zig_boost)

find_package(Boost REQUIRED)

set(CMAKE_CXX_STANDARD 17)

add_executable(zig_boost main.cpp)
target_link_libraries(zig_boost Boost::system)

Clone vcpkg somewhere:

git clone https://github.com/Microsoft/vcpkg.git

Try to build with zig:

$ CXX="zig c++ -target x86_64-linux-gnu" cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=<path to vcpkg>/vcpkg/scripts/buildsystems/vcpkg.cmake
-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
The following packages will be built and installed:
  * boost-assert[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-assert/f07d2980139502309087821ca9a78a9a43a766ec
  * boost-build[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-build/9d4a35930b7414144551dc9c2e00b31bcb0ca8b2
  * boost-config[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-config/af2f41ef14357f44466182d783e8cb218d677b1f
  * boost-modular-build-helper[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-modular-build-helper/5c1a238cc20c885e785bc05a36b974deb5e02db7
  * boost-mp11[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-mp11/80e104d697b7ff7a283c5f7ee83ae25fe1192bd7
  * boost-predef[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-predef/3a0c5194d7a4d8825efff8d67e0c75cae0b058d7
    boost-system[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-system/48fb125e52a85de87f4ff03475742d79f84b42cb
  * boost-throw-exception[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-throw-exception/c51c9fa76f925c5824688c6ca9f451716373b5d5
  * boost-uninstall[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-uninstall/d96807810fa612b038f9268c8df545d421fda1a6
  * boost-variant2[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-variant2/3acfc977da209b860fd7cf1365180af919be0eeb
  * boost-vcpkg-helpers[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-vcpkg-helpers/f99477ea8dcfb463d2f0a2cce3c60914c2e5adb4
  * boost-winapi[core]:x64-linux -> 1.82.0#1 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-winapi/db66242e796c29abd3622cf41d506bee622b4d10
  * vcpkg-cmake[core]:x64-linux -> 2022-12-22 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake/1913f86defd2140d0a6751be2d51952e4090efa4
  * vcpkg-cmake-get-vars[core]:x64-linux -> 2023-03-02 -- /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake-get-vars/2e624c2cf12a97a7a802e31ff1d28b9fa6ba9bde
Additional packages (*) will be modified to complete this operation.
Restored 0 package(s) from /home/bherweyer/.cache/vcpkg/archives in 8.01 ms. Use --debug to see more details.
Installing 1/14 vcpkg-cmake:x64-linux...
Building vcpkg-cmake[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake/1913f86defd2140d0a6751be2d51952e4090efa4
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle vcpkg-cmake:x64-linux: 20.8 ms
Installing 2/14 boost-uninstall:x64-linux...
Building boost-uninstall[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-uninstall/d96807810fa612b038f9268c8df545d421fda1a6
-- 
Please use the following command when you need to remove all boost ports/components:
    "./vcpkg remove boost-uninstall:x64-linux --recurse"

-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-uninstall:x64-linux: 12.8 ms
Installing 3/14 boost-vcpkg-helpers:x64-linux...
Building boost-vcpkg-helpers[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-vcpkg-helpers/f99477ea8dcfb463d2f0a2cce3c60914c2e5adb4
-- Using cached boost_LICENSE_1_0.txt.
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-vcpkg-helpers_x64-linux/share/boost-vcpkg-helpers/boost-modular-headers.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-vcpkg-helpers_x64-linux/share/boost-vcpkg-helpers/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-vcpkg-helpers_x64-linux/share/boost-vcpkg-helpers/boost_LICENSE_1_0.txt
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-vcpkg-helpers_x64-linux/share/boost-vcpkg-helpers/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-vcpkg-helpers:x64-linux: 13.5 ms
Installing 4/14 boost-predef:x64-linux...
Building boost-predef[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-predef/3a0c5194d7a4d8825efff8d67e0c75cae0b058d7
-- Using cached boostorg-predef-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-predef/src/ost-1.82.0-b3fd508ceb.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-predef-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-predef/src/ost-1.82.0-b3fd508ceb.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-predef_x64-linux/share/boost-predef/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-predef_x64-linux/share/boost-predef/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-predef:x64-linux: 80.3 ms
Installing 5/14 boost-config:x64-linux...
Building boost-config[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-config/af2f41ef14357f44466182d783e8cb218d677b1f
-- Using cached boostorg-config-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-config/src/ost-1.82.0-7635c4bf67.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-config-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-config/src/ost-1.82.0-7635c4bf67.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-config_x64-linux/share/boost-config/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-config_x64-linux/share/boost-config/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-config:x64-linux: 124 ms
Installing 6/14 boost-winapi:x64-linux...
Building boost-winapi[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-winapi/db66242e796c29abd3622cf41d506bee622b4d10
-- Using cached boostorg-winapi-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-winapi/src/ost-1.82.0-bdc8a0a03d.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-winapi-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-winapi/src/ost-1.82.0-bdc8a0a03d.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-winapi_x64-linux/share/boost-winapi/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-winapi_x64-linux/share/boost-winapi/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-winapi:x64-linux: 55 ms
Installing 7/14 boost-mp11:x64-linux...
Building boost-mp11[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-mp11/80e104d697b7ff7a283c5f7ee83ae25fe1192bd7
-- Using cached boostorg-mp11-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-mp11/src/ost-1.82.0-34a710e1f1.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-mp11-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-mp11/src/ost-1.82.0-34a710e1f1.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-mp11_x64-linux/share/boost-mp11/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-mp11_x64-linux/share/boost-mp11/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-mp11:x64-linux: 53.5 ms
Installing 8/14 boost-assert:x64-linux...
Building boost-assert[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-assert/f07d2980139502309087821ca9a78a9a43a766ec
-- Using cached boostorg-assert-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-assert/src/ost-1.82.0-06f958f88a.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-assert-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-assert/src/ost-1.82.0-06f958f88a.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-assert_x64-linux/share/boost-assert/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-assert_x64-linux/share/boost-assert/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-assert:x64-linux: 32 ms
Installing 9/14 boost-variant2:x64-linux...
Building boost-variant2[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-variant2/3acfc977da209b860fd7cf1365180af919be0eeb
-- Using cached boostorg-variant2-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-variant2/src/ost-1.82.0-f75f373b36.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-variant2-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-variant2/src/ost-1.82.0-f75f373b36.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-variant2_x64-linux/share/boost-variant2/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-variant2_x64-linux/share/boost-variant2/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-variant2:x64-linux: 49.7 ms
Installing 10/14 boost-throw-exception:x64-linux...
Building boost-throw-exception[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-throw-exception/c51c9fa76f925c5824688c6ca9f451716373b5d5
-- Using cached boostorg-throw_exception-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-throw-exception/src/ost-1.82.0-42cad9ccef.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-throw_exception-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-throw-exception/src/ost-1.82.0-42cad9ccef.clean
-- Copying headers
-- Copying headers done
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-throw-exception_x64-linux/share/boost-throw-exception/usage
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-throw-exception_x64-linux/share/boost-throw-exception/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-throw-exception:x64-linux: 33.5 ms
Installing 11/14 vcpkg-cmake-get-vars:x64-linux...
Building vcpkg-cmake-get-vars[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/vcpkg-cmake-get-vars/2e624c2cf12a97a7a802e31ff1d28b9fa6ba9bde
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake-get-vars_x64-linux/share/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake-get-vars_x64-linux/share/vcpkg-cmake-get-vars/cmake_get_vars
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake-get-vars_x64-linux/share/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake-get-vars_x64-linux/share/vcpkg-cmake-get-vars/vcpkg-port-config.cmake
-- Installing: /home/bherweyer/dev/vcpkg/packages/vcpkg-cmake-get-vars_x64-linux/share/vcpkg-cmake-get-vars/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle vcpkg-cmake-get-vars:x64-linux: 20.4 ms
Installing 12/14 boost-modular-build-helper:x64-linux...
Building boost-modular-build-helper[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-modular-build-helper/5c1a238cc20c885e785bc05a36b974deb5e02db7
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-modular-build-helper:x64-linux: 14.4 ms
Installing 13/14 boost-build:x64-linux...
Building boost-build[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-build/9d4a35930b7414144551dc9c2e00b31bcb0ca8b2
-- Using cached boostorg-build-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-build/src/ost-1.82.0-e88c66a4cd.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-build-boost-1.82.0.tar.gz
-- Applying patch 0002-fix-get-version.patch
-- Applying patch 0003-fix-emscripten.patch
-- Applying patch 0004-workaround-MSVC-codegen-bug-in-17.5-on-ARM64.patch
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-build/src/ost-1.82.0-e88c66a4cd.clean
-- Using cached boost_LICENSE_1_0.txt.
-- Using cached boost-1.82.0-boostcpp.jam.
-- Installing: /home/bherweyer/dev/vcpkg/packages/boost-build_x64-linux/share/boost-build/copyright
-- Bootstrapping...
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle boost-build:x64-linux: 10 s
Installing 14/14 boost-system:x64-linux...
Building boost-system[core]:x64-linux...
-- Installing port from location: /home/bherweyer/dev/vcpkg/buildtrees/versioning_/versions/boost-system/48fb125e52a85de87f4ff03475742d79f84b42cb
-- Using cached boostorg-system-boost-1.82.0.tar.gz.
-- Cleaning sources at /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/bherweyer/dev/vcpkg/downloads/boostorg-system-boost-1.82.0.tar.gz
-- Using source at /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean
-- Getting CMake variables for x64-linux
-- Configuring x64-linux
-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: /home/bherweyer/dev/vcpkg/downloads/tools/cmake-3.25.1-linux/cmake-3.25.1-linux-x86_64/bin/cmake --build . --config Debug --target install -- -v -j25
    Working Directory: /home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg
    See logs for more information:
      /home/bherweyer/dev/vcpkg/buildtrees/boost-system/install-x64-linux-dbg-out.log

Call Stack (most recent call first):
  /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/share/boost-build/boost-modular-build.cmake:140 (vcpkg_cmake_install)
  buildtrees/versioning_/versions/boost-system/48fb125e52a85de87f4ff03475742d79f84b42cb/portfile.cmake:14 (boost_modular_build)
  scripts/ports.cmake:147 (include)


error: building boost-system:x64-linux failed with: BUILD_FAILED
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+boost-system
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?title=[boost-system]+Build+error&body=Copy+issue+body+from+%2Fhome%2Fbherweyer%2FCLionProjects%2Fzig-boost%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at /home/bherweyer/dev/vcpkg/scripts/buildsystems/vcpkg.cmake:893 (message):
  vcpkg install failed.  See logs for more information:
  /home/bherweyer/CLionProjects/zig-boost/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:2 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

The build fails. Inspecting vcpkg/buildtrees/boost-system/install-x64-linux-dbg-out.log:

[1/2] cd /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
FAILED: CMakeFiles/boost /home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/CMakeFiles/boost 
cd /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
notice: loading B2 from /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/bootstrap.jam
notice: Site configuration files will be ignored due to the
notice: --ignore-site-config command-line option.
notice: Loading explicitly specified user configuration file:
    /home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam
notice: Searching '/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg'.
info: Usage: zig [command] [options]

Commands:

  build            Build project from build.zig
  init-exe         Initialize a `zig build` application in the cwd
  init-lib         Initialize a `zig build` library in the cwd

  ast-check        Look for simple compile errors in any set of files
  build-exe        Create executable from source or object files
  build-lib        Create library from source or object files
  build-obj        Create object from source or object files
  fmt              Reformat Zig source into canonical form
  run              Create executable and run immediately
  test             Create and run a test build
  translate-c      Convert C code to Zig code

  ar               Use Zig as a drop-in archiver
  cc               Use Zig as a drop-in C compiler
  c++              Use Zig as a drop-in C++ compiler
  dlltool          Use Zig as a drop-in dlltool.exe
  lib              Use Zig as a drop-in lib.exe
  ranlib           Use Zig as a drop-in ranlib
  objcopy          Use Zig as a drop-in objcopy

  env              Print lib path, std path, cache directory, and version
  help             Print this help and exit
  libc             Display native libc paths file or validate one
  targets          List available compilation targets
  version          Print version number and exit
  zen              Print Zen of Zig and exit

General Options:

  -h, --help       Print command-specific usage

error: unknown command: --version
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/common.jam:1164: in common.match-command-output from module common
error: '"/snap/bin/zig" --version' exited with error code 1
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:101: in get-full-version from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:106: in get-short-version from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:55: in clang-linux.init from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang.jam:33: in clang.init from module clang
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/project.jam:1109: in using from module project-rules
/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam:11: in modules.load from module user-config
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:255: in load-config from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:449: in load-configuration-files from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:607: in load from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/modules.jam:294: in import from module modules
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/bootstrap.jam:135: in module scope from module

ninja: build stopped: subcommand failed.
❯ cat       /home/bherweyer/dev/vcpkg/buildtrees/boost-system/install-x64-linux-dbg-out.log

[1/2] cd /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
FAILED: CMakeFiles/boost /home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/CMakeFiles/boost 
cd /home/bherweyer/dev/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
notice: loading B2 from /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/bootstrap.jam
notice: Site configuration files will be ignored due to the
notice: --ignore-site-config command-line option.
notice: Loading explicitly specified user configuration file:
    /home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam
notice: Searching '/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg'.
info: Usage: zig [command] [options]

Commands:

  build            Build project from build.zig
  init-exe         Initialize a `zig build` application in the cwd
  init-lib         Initialize a `zig build` library in the cwd

  ast-check        Look for simple compile errors in any set of files
  build-exe        Create executable from source or object files
  build-lib        Create library from source or object files
  build-obj        Create object from source or object files
  fmt              Reformat Zig source into canonical form
  run              Create executable and run immediately
  test             Create and run a test build
  translate-c      Convert C code to Zig code

  ar               Use Zig as a drop-in archiver
  cc               Use Zig as a drop-in C compiler
  c++              Use Zig as a drop-in C++ compiler
  dlltool          Use Zig as a drop-in dlltool.exe
  lib              Use Zig as a drop-in lib.exe
  ranlib           Use Zig as a drop-in ranlib
  objcopy          Use Zig as a drop-in objcopy

  env              Print lib path, std path, cache directory, and version
  help             Print this help and exit
  libc             Display native libc paths file or validate one
  targets          List available compilation targets
  version          Print version number and exit
  zen              Print Zen of Zig and exit

General Options:

  -h, --help       Print command-specific usage

error: unknown command: --version
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/common.jam:1164: in common.match-command-output from module common
error: '"/snap/bin/zig" --version' exited with error code 1
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:101: in get-full-version from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:106: in get-short-version from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang-linux.jam:55: in clang-linux.init from module clang-linux
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/tools/clang.jam:33: in clang.init from module clang
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build/project.jam:1109: in using from module project-rules
/home/bherweyer/dev/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam:11: in modules.load from module user-config
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:255: in load-config from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:449: in load-configuration-files from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/build-system.jam:607: in load from module build-system
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/modules.jam:294: in import from module modules
/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/bootstrap.jam:135: in module scope from module

ninja: build stopped: subcommand failed.

Expected Behavior

zig c++ should act as a drop-in replacement for clang's C++ compiler.

@bherw bherw added the bug Observed behavior contradicts documented or intended behavior label Oct 27, 2023
@rohlem
Copy link
Contributor

rohlem commented Oct 27, 2023

Without having tried a full reproduction, on my slightly newer Zig version 0.12.0-dev.1139+4d106076c I notice that
both zig cc --version and zig c++ --version do produce output that looks like it identifies the clang version (as 17.0.3).
Please check whether that's the same for you (I wouldn't expect a recent change in such fundamental behavior).

The usage texts in your second paste contain info: Usage: zig [command] [options], which is the header I also get for plain zig --version (without cc or c++ as second argument).
My guess is that the build tooling does not handle the whitespace in the build command correctly, which leads it to the wrong invocation, which obviously fails.

As a workaround, I imagine instead specifying a script without whitespace in its name should work.
Something like a file zig-c++.sh which redirects all further arguments to a correct zig c++ call.
Please try that also; if that still fails we'll need to reduce what the exact program invocation is and why/how it doesn't behave as expected.

@bherw
Copy link
Author

bherw commented Oct 27, 2023

Thanks for the quick reply. :)

$ zig cc --version
clang version 16.0.6 (https://github.com/ziglang/zig-bootstrap 1dda86241204c4649f668d46b6a37feed707c7b4)
Target: x86_64-unknown-linux-musl
Thread model: posix
InstalledDir: /usr/bin

Looks good; I'm on Ubuntu 22.04, but zig is installed in snap, so maybe that's the source of the "unknown".

You're right; the zig-c++.sh workaround worked to allow it to get the version. Here's what I used, for reference:

#!/bin/sh
exec zig c++ "$@"

The build then proceeds

[1/2] cd /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
FAILED: CMakeFiles/boost /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/CMakeFiles/boost 
cd /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build && /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/b2 toolset=clang --user-config=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam --stagedir=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage --build-dir=/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg runtime-link=shared link=static address-model=64 architecture=x86 target-os=linux threadapi=pthread variant=debug --layout=system -sICU_PATH="ICU_PATH-NOTFOUND" --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -j 25 -sBOOST_ROOT=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build -sBOOST_BUILD_PATH=/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build --debug-configuration --debug-building --debug-generators --ignore-site-config --hash -q debug-symbols=on -d +2 threading=multi stage
notice: loading B2 from /home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/tools/boost-build/src/kernel/bootstrap.jam
notice: Site configuration files will be ignored due to the
notice: --ignore-site-config command-line option.
notice: Loading explicitly specified user configuration file:
    /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/user-config.jam
notice: Searching '/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from '/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg'.
notice: will use '/home/bherweyer/CLionProjects/zig-boost/zig-c++2' for clang-linux, condition <toolset>clang-linux-16

Building target '../build/stage'
     Build request: object(property-set)@271 <address-model>64 <architecture>x86 <debug-symbols>on <link>static <runtime-link>shared <target-os>linux <threadapi>pthread <threading>multi <toolset>clang <variant>debug
     Command line free features:
     Target requirements: <define>BOOST_ALL_NO_LIB=1 <hardcode-dll-paths>false <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <location>/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage/lib <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <translate-path>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>.stage-translate-path

     Common properties:  <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>false <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <location>/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage/lib <optimization>off <os>LINUX <pch>on <profiling>off <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <translate-path>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>.stage-translate-path <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on

     Building target '../build/boost_system'
         Build request: object(property-set)@278 <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <exception-handling>on <extern-c-nothrow>off <inlining>off <link>static <optimization>off <os>LINUX <pch>on <profiling>off <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
         Command line free features:
         Target requirements: <define>BOOST_ALL_NO_LIB=1 <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <link>shared:<define>BOOST_SYSTEM_DYN_LINK=1 <link>static:<define>BOOST_SYSTEM_STATIC_LINK=1 <relevant>define:<relevant>link <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag

         Common properties:  <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>true <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <optimization>off <os>LINUX <pch>on <profiling>off <relevant>define:<relevant>link <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on

         Usage requirements for boost_system: 
         Build properties:  <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>true <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <optimization>off <os>LINUX <pch>on <profiling>off <relevant>define:<relevant>link <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
     *** construct LIB
         from { error_code.cpp.CPP }
         properties: <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>true <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <main-target-type>LIB <optimization>off <os>LINUX <pch>on <profiling>off <relevant>define:<relevant>link <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
     find-viable-generators target-type= LIB property-set=
     trying type LIB
     there are generators for this type
     trying generator builtin.prebuilt ( -> LIB )
     trying generator builtin.lib-generator ( -> LIB )
       is viable
     trying generator unix.prebuilt ( -> LIB )
     trying generator gcc.prebuilt ( -> LIB )
     trying generator clang-linux.prebuilt ( -> LIB )
     ***  1  viable generators
         *** construct STATIC_LIB
             from { error_code.cpp.CPP }
             properties: <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>true <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <main-target-type>LIB <optimization>off <os>LINUX <pch>on <profiling>off <relevant>define:<relevant>link <relevant>link <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
         find-viable-generators target-type= STATIC_LIB property-set= link-static
         trying type STATIC_LIB
         there are generators for this type
         trying generator unix.archive ( OBJ -> STATIC_LIB )
         trying generator gcc.archive ( OBJ -> STATIC_LIB )
         trying generator clang-linux.archive ( OBJ -> STATIC_LIB )
           is viable
         ***  1  viable generators
           ** generator clang-linux.archive
           composing: true
             *** construct OBJ
                 from { error_code.cpp.CPP }
                 properties: <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>true <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <main-target-type>LIB <optimization>off <os>LINUX <pch>on <profiling>off <relevant>define:<relevant>link <relevant>link <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
             find-viable-generators target-type= OBJ property-set= link-static
             trying type OBJ
             there are generators for this type
             trying generator rc.compile.resource ( RC -> OBJ )
               is viable
             trying generator gcc.compile.c++ ( CPP -> OBJ )
             trying generator gcc.compile.c ( C -> OBJ )
             trying generator gcc.compile.asm ( ASM -> OBJ )
             trying generator gcc.compile.m ( OBJECTIVE_C -> OBJ )
             trying generator gcc.compile.mm ( OBJECTIVE_CPP -> OBJ )
             trying generator gcc.compile.fortran ( FORTRAN FORTRAN90 -> OBJ )
             trying generator clang-linux.compile.c++ ( CPP -> OBJ )
               is viable
             trying generator clang-linux.compile.c ( C -> OBJ )
               is viable
             trying generator clang-linux.compile.asm ( ASM -> OBJ )
               is viable
             trying generator clang-linux.compile.m ( OBJECTIVE_C -> OBJ )
               is viable
             trying generator clang-linux.compile.mm ( OBJECTIVE_CPP -> OBJ )
               is viable
             trying generator clang-linux.compile.fortran ( FORTRAN FORTRAN90 -> OBJ )
               is viable
             ***  7  viable generators
               ** generator 'rc.compile.resource' pruned
               ** generator clang-linux.compile.c++
               composing:
               SUCCESS:  [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ] { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } }

             returned [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ] { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } }
               generator clang-linux.compile.c++  spawned 
               { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } }
               with usage requirements: [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ]
               ** generator 'clang-linux.compile.c' pruned
               ** generator 'clang-linux.compile.asm' pruned
               ** generator 'clang-linux.compile.m' pruned
               ** generator 'clang-linux.compile.mm' pruned
               ** generator 'clang-linux.compile.fortran' pruned
           SUCCESS:  [ <relevant>address-model <relevant>architecture <relevant>archiveflags <relevant>instruction-set <relevant>response-file <relevant>target-os <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version ] { clang-linux%clang-linux.archive-libboost_system.a.STATIC_LIB { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } } }

         returned [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>archiveflags <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ] { clang-linux%clang-linux.archive-libboost_system.a.STATIC_LIB { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } } }
           generator clang-linux.archive  spawned 
           { clang-linux%clang-linux.archive-libboost_system.a.STATIC_LIB { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } } }
           with usage requirements: [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>archiveflags <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ]
     returned [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>archiveflags <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ] { clang-linux%clang-linux.archive-libboost_system.a.STATIC_LIB { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } } }
       generator builtin.lib-generator  spawned 
       { clang-linux%clang-linux.archive-libboost_system.a.STATIC_LIB { clang-linux%clang-linux.compile.c++-error_code.o.OBJ { error_code.cpp.CPP } } }
       with usage requirements: [ <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>archiveflags <relevant>c++-template-depth <relevant>cflags <relevant>coverage <relevant>cxxflags <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>define <relevant>exception-handling <relevant>force-include <relevant>include <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>local-visibility <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>pch-file <relevant>profiling <relevant>response-file <relevant>rtti <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>warnings <relevant>warnings-as-errors ]
         Usage requirements from boost_system:  <define>BOOST_SYSTEM_STATIC_LINK=1 <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>coverage <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>deduced-address-model <relevant>deduced-architecture <relevant>define:<relevant>link <relevant>exception-handling <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>profiling <relevant>rtti <relevant>segmented-stacks <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>variant <relevant>visibility <relevant>warnings <relevant>warnings-as-errors

     Usage requirements for stage:  <define>BOOST_SYSTEM_STATIC_LINK=1 <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>coverage <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>deduced-address-model <relevant>deduced-architecture <relevant>define:<relevant>link <relevant>exception-handling <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>profiling <relevant>rtti <relevant>segmented-stacks <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>variant <relevant>visibility <relevant>warnings <relevant>warnings-as-errors
     Build properties:  <address-model>64 <architecture>x86 <asynch-exceptions>off <coverage>off <debug-symbols>on <define>BOOST_ALL_NO_LIB=1 <define>BOOST_SYSTEM_STATIC_LINK=1 <exception-handling>on <extern-c-nothrow>off <hardcode-dll-paths>false <host-os>linux <include>../include&&/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include <inlining>off <install-dependencies>off <link>static <location>/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage/lib <optimization>off <os>LINUX <pch>on <profiling>off <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>coverage <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>deduced-address-model <relevant>deduced-architecture <relevant>define:<relevant>link <relevant>exception-handling <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>profiling <relevant>rtti <relevant>segmented-stacks <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>variant <relevant>visibility <relevant>warnings <relevant>warnings-as-errors <response-file>auto <rtti>on <runtime-debugging>on <runtime-link>shared <stdlib>native <strip>off <suppress-import-lib>false <symlink-location>project-relative <tag>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean>.tag <target-os>linux <threadapi>pthread <threading>multi <toolset-clang:platform>linux <toolset-clang:version>16 <toolset>clang <translate-path>@Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>%Jamfile</home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/src/ost-1.82.0-6fabddb1d7.clean/build>.stage-translate-path <user-interface>console <variant>debug <vectorize>off <warnings-as-errors>off <warnings>on
     Usage requirements from stage:  <define>BOOST_SYSTEM_STATIC_LINK=1 <relevant>address-model <relevant>address-sanitizer <relevant>architecture <relevant>c++-template-depth <relevant>coverage <relevant>cxxstd <relevant>cxxstd-dialect <relevant>debug-symbols <relevant>deduced-address-model <relevant>deduced-architecture <relevant>define:<relevant>link <relevant>exception-handling <relevant>inlining <relevant>instruction-set <relevant>leak-sanitizer <relevant>link <relevant>lto <relevant>lto-mode <relevant>optimization <relevant>pch <relevant>profiling <relevant>rtti <relevant>segmented-stacks <relevant>stdlib <relevant>target-os <relevant>thread-sanitizer <relevant>threading <relevant>toolset <relevant>toolset-clang:platform <relevant>toolset-clang:version <relevant>undefined-sanitizer <relevant>variant <relevant>visibility <relevant>warnings <relevant>warnings-as-errors
common.mkdir /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage

        mkdir -p "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage"
    
common.mkdir /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost

        mkdir -p "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost"
    
common.mkdir /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage/lib

        mkdir -p "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/stage/lib"
    
common.mkdir /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build

        mkdir -p "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build"
    
common.mkdir /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build/343884cf2c124864d23ec3d11d30c6f5

        mkdir -p "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build/343884cf2c124864d23ec3d11d30c6f5"
    
clang-linux.compile.c++ /home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build/343884cf2c124864d23ec3d11d30c6f5/error_code.o

  "/home/bherweyer/CLionProjects/zig-boost/zig-c++" -c -x c++ -fPIC -g -m64 -pthread -O0 -fno-inline -Wall -g --target=x86_64-pc-linux  -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -I"../include" -I"/home/bherweyer/CLionProjects/zig-boost/build/vcpkg_installed/x64-linux/include"   -o "/home/bherweyer/dev/vendor/vcpkg/buildtrees/boost-system/x64-linux-dbg/boost/build/343884cf2c124864d23ec3d11d30c6f5/error_code.o" "../src/error_code.cpp"

error: UnknownOperatingSystem
...failed updating 1 target...
ninja: build stopped: subcommand failed.

Looks like the --target is unrecognized. It's also conflicting with the x86_64-linux-gnu.2.19 target I want to set. This issue seems related to #4787.

I tried working around the unrecognized target by just filtering the argument out and replacing it, and so far this version of a zig-c++ seems to work; my build is succeeding, at least:

#!/usr/bin/python3

import os
import sys

args = sys.argv[1:]

sanitized_args = [
        'zig',
        'c++',
        # Override target
        '--target=x86_64-linux-gnu.2.19',
]
# Drop target from vcpkg's arguments
for arg in sys.argv[1:]:
    if '--target=' in arg:
        continue
    sanitized_args.append(arg)

# print(sanitized_args)
os.execvp('zig', sanitized_args)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants