-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add a zig cc
-based image.
#880
Conversation
I still need to figure out the best way to add it to CI (it's currently not built as part of the matrix), since it can target numerous other architectures. It might be good to just change the exported triple from |
e22afde
to
b6a5611
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I've changed the format entirely.
[target.x86_64-unknown-linux-gnu.zig]
enable = true # enable use of the zig image
version = "2.17" # glibc version to use
image = "ghcr.io/cross-rs/zig:local" # custom image to use If provided as a bool, it will use the default glibc version: [target.x86_64-unknown-linux-gnu]
# equivalent to { enable = true }
zig = true If provided as a string, [target.x86_64-unknown-linux-gnu]
# equivalent to { enable = true, version = "2.17" }
zig = "2.17" A custom zig image is so users can provide their own, general-purpose zig image if needed. These values can also be provided via environment variables, such as |
This comment was marked as outdated.
This comment was marked as outdated.
Actually we should provide an ARCH here. I'll mark this as a draft since we need to download |
bors try --target zig Ok I've changed the build in |
This comment was marked as outdated.
This comment was marked as outdated.
Oh this is why it's failing: $ /usr/bin/docker run --userns host -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/xargo' -e 'CARGO_HOME=/cargo' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e CARGO_HTTP_CHECK_REVOKE -e RUSTFLAGS -e CARGO_NET_RETRY -e CARGO_INCREMENTAL -e 'USER=runner' --rm --user 1001:121 -v /home/runner/.xargo:/xargo:Z -v /home/runner/.cargo:/cargo:Z -v /cargo/bin -v /tmp/tmp.xdLqWsDyv2:/project:Z -v /home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:Z,ro -v /tmp/tmp.xdLqWsDyv2/target:/target:Z -w /project ghcr.io/cross-rs/zig:trying sh -c 'PATH=$PATH:/rust/bin cargo-zigbuild build --target aarch64-unknown-linux-gnu --verbose' Specifically |
Ok this has been fixed by not creating a user, but by setting |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This won't work but the log will be helpful. |
This comment was marked as outdated.
This comment was marked as outdated.
bors try --target zig |
tryBuild succeeded: |
Uses cargo-zigbuild as a backend, and adds configuration options for zig under `[build.zig]` and `[target.(...).zig]`. If enabled, and an image override is not provided, `cross` will always use the `zig` image. The feature can be enabled by providing `zig` as a table, bool, or string. It supports custom glibc versions by passing the `zig.version` key, and `zig` can be separately enabled or disabled by providing `zig.enable`. ``` [target.x86_64-unknown-linux-gnu.zig] enable = true # enable use of the zig image version = "2.17" # glibc version to use image = "ghcr.io/cross-rs/zig:local" # custom image to use ``` If provided as a bool, it will use the default glibc version: ``` [target.x86_64-unknown-linux-gnu] \# equivalent to { enable = true } zig = true ``` If provided as a string, `zig` will be automatically enabled: ``` [target.x86_64-unknown-linux-gnu] \# equivalent to { enable = true, version = "2.17" } zig = "2.17" ``` The image does not provide runners, `bindgen` Clang args, or `pkg-config` paths, since `zig cc` does not provide the dynamic library loader (`ld-linux*.so`) required, meaning none of the binaries can be run. For `bindgen`, `zig cc` has an unusual directory structure, so there is no traditional sysroot with `usr`, `lib`, and `include` subdirectories. Finally, since we don't have system packages we can work with, exporting a `pkg-config` path makes little sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
bors r=Emilgardis |
Build succeeded: |
Uses cargo-zigbuild as a backend, and adds configuration options for zig under
[build.zig]
and[target.(...).zig]
. If enabled, and an image override is not provided,cross
will always use thezig
image.It supports custom
glibc
versions by parsing the libc portion of the target, and extracting a the libc version if present. The target, if built-in, is then the triple/libc pair, otherwise, it's just the triple.The image does not provide runners,
bindgen
Clang args, orpkg-config
paths, sincezig cc
does not provide the dynamic library loader (ld-linux*.so
) required, meaning none of the binaries can be run. Forbindgen
,zig cc
has an unusual directory structure, so there is no traditional sysroot withusr
,lib
, andinclude
subdirectories. Finally, since we don't have system packages we can work with, exporting apkg-config
path makes little sense.Closes #860.