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
Comments
Without having tried a full reproduction, on my slightly newer Zig version The usage texts in your second paste contain As a workaround, I imagine instead specifying a script without whitespace in its name should work. |
Thanks for the quick reply. :)
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:
The build then proceeds
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 #!/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) |
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 ofversion
. I've extracted a small sample that reproduces the problem I'm seeing:vcpkg.json:
CMakeLists.txt:
Clone vcpkg somewhere:
Try to build with zig:
The build fails. Inspecting
vcpkg/buildtrees/boost-system/install-x64-linux-dbg-out.log
:Expected Behavior
zig c++
should act as a drop-in replacement for clang's C++ compiler.The text was updated successfully, but these errors were encountered: