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

use cargo-zigbuild 0.17.3 instead of 0.17.2 #1349

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Conversation

thomas725
Copy link
Contributor

to solve this problem: rust-cross/cargo-zigbuild#151

@thomas725 thomas725 requested a review from a team as a code owner October 17, 2023 11:55
@Emilgardis
Copy link
Member

bors try --target zig

Can you add a changelog entry? See https://github.com/cross-rs/cross/blob/main/.changes/README.md

bors bot added a commit that referenced this pull request Oct 18, 2023
@bors
Copy link
Contributor

bors bot commented Oct 18, 2023

try

Build failed:

@Emilgardis
Copy link
Member

  > [9/9] RUN /zig.sh linux/amd64:
5.302 + local version=0.17.3
5.302 + local dst=/opt/zig
5.302 + local filename=zig-linux-x86_64-0.17.3.tar.xz
5.302 + local td
5.303 ++ mktemp -d
5.304 + td=/tmp/tmp.hg3QrDA9EJ
5.304 + pushd /tmp/tmp.hg3QrDA9EJ
5.304 /tmp/tmp.hg3QrDA9EJ /
5.304 + curl --retry 3 -sSfL https://ziglang.org/download/0.17.3/zig-linux-x86_64-0.17.3.tar.xz -O
he requested URL returned error: 403 

sorry! I was a bit hasty in my response in matrix, it's line 121 that needs to be updated. We probably also should update zig itself

@thomas725
Copy link
Contributor Author

hey there! I just checked https://ziglang.org/download/ and it looks like 0.11.0 is still the latest stable version, the only newer one is 0.12.0.dev, and this "dev" suffix and the block header "master" seem's to suggest this is an unstable version.

I'll research how to modify my pull request to undo the wrong change and do the correct one you suggested.

@thomas725
Copy link
Contributor Author

thomas725 commented Oct 20, 2023

okey, and now about the changelog, if I understand the README correctly we'd need to first create an issue for this in the "cross" project, we probably can't just reference the one that exists for the "cargo-zigbuild" project, right?

@thomas725
Copy link
Contributor Author

Okey, looking at the previous changelog entries I see the issue property is optional, so I created one without.

@Emilgardis
Copy link
Member

perfect!

bors try --target zig

@Emilgardis
Copy link
Member

also, I totally forgot about #1330

so I think the problem is solved already on main since rust-cross/cargo-zigbuild@79e53f4 exists in 0.17.2 :3

@thomas725
Copy link
Contributor Author

Ah, you're right!
rust-cross/cargo-zigbuild#151
has been solved by
rust-cross/cargo-zigbuild@79e53f4
from 2023-07-29_0604, the first release containing that commit was
https://github.com/rust-cross/cargo-zigbuild/releases/tag/v0.17.0
from 2023-07-29_0656.

And since before this pull request we're already using 0.17.2 upgrading is not required to solve this issue.

My open question then is: Why did I ran into this issue and how can I use a version of cross-rs new enough to not have this issue?

@thomas725 thomas725 changed the title use cargo-zigbuild 0.17.3 instead of 0.11.0 use cargo-zigbuild 0.17.3 instead of 0.17.0 Oct 21, 2023
@thomas725 thomas725 changed the title use cargo-zigbuild 0.17.3 instead of 0.17.0 use cargo-zigbuild 0.17.3 instead of 0.17.2 Oct 21, 2023
@Emilgardis
Copy link
Member

You'd want to use a newer image, a versioned cross installed like cargo install cross or cargo install cross --version a.b.c will use images with the tag :a.b.c. To use another image you'd either set the image manually to be image = "ghcr.io/cross-rs/zig:main", install cross from our main branch cargo install cross --git https://github.com/cross-rs/cross or install cross with a locally checked out clone.

We should probably update zigbuild to 0.17.3 anyway, can you change the changelog-file to be named 1330-1349.json and then squash the changes, see https://rustc-dev-guide.rust-lang.org/git.html#squash-your-commits if you're not familiar how to do it

@thomas725
Copy link
Contributor Author

thomas725 commented Oct 23, 2023

changelog entry renamed & squash done

about my environment, I installed using cargo install cross a few weeks ago and got:

$ cross --version
cross 0.2.5 (3c21f9e 2023-10-11)
[cross] note: Falling back to `cargo` on the host.
cargo 1.73.0 (9c4383fb5 2023-08-26)

this reads like it should already contain / use zigbuild 0.17.2 - but it still shows the described problem.

after adding this block to my Cross.toml:

[target.powerpc-unknown-linux-gnu]
zig = "1.2"

I get this:

cross build  --release --target powerpc-unknown-linux-gnu                                                                        ✔ 
   Compiling my-project v0.1.0 (/home/user/Development/git/my-project)
error: linking with `/target/.zig-cache/cargo-zigbuild/0.14.1/zigcc-powerpc-unknown-linux-gnu.1.2.sh` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/zig:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "/target/.zig-cache/cargo-zigbuild/0.14.1/zigcc-powerpc-unknown-linux-gnu.1.2.sh" "-m32" "/tmp/rustc1VnBRd/symbols.o" "/target/powerpc-unknown-linux-gnu/release/deps/rust_p2p_chat-30ee95bc05c6ef92.rust_p2p_chat.d55998c031241692-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/target/powerpc-unknown-linux-gnu/release/deps" "-L" "/target/release/deps" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/powerpc-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/powerpc-unknown-linux-gnu/lib/libcompiler_builtins-5c68d6108c0313cf.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/powerpc-unknown-linux-gnu/lib" "-o" "/target/powerpc-unknown-linux-gnu/release/deps/rust_p2p_chat-30ee95bc05c6ef92" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-all" "-nodefaultlibs"
  = note: error: unable to find or provide libc for target 'powerpc-linux.3.16...5.10.81-gnu.1.2'
          info: zig can provide libc for related target powerpc-linux-gnueabi
          info: zig can provide libc for related target powerpc-linux-gnueabihf
          info: zig can provide libc for related target powerpc-linux-musl
          

error: could not compile `my-project` (bin "my-project") due to previous error

which read's exactly like the problem described here: rust-cross/cargo-zigbuild#151 but whose fix should already be contained in what I'm using. I'm confused.

@Emilgardis
Copy link
Member

Emilgardis commented Oct 23, 2023

there is no glibc 1.2 so that's the reason you're getting an error :)

edit: you can find a list of versions here

@Emilgardis Emilgardis added the no-ci-targets PRs that do not affect any cross-compilation targets. label Oct 23, 2023
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! Even though it doesn't solve your specific issue I'll merge this

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 23, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 44011c8 into cross-rs:main Oct 23, 2023
23 checks passed
@thomas725
Copy link
Contributor Author

thomas725 commented Oct 23, 2023

there is no glibc 1.2 so that's the reason you're getting an error :)

edit: you can find a list of versions here

ah, thanks for the link to the existing glibc versions. my PowerPC OpenWRT device says it has:

$ opkg info libc
Package: libc
Version: 1.2.3-4

But I guess that's not glibc?

Also, changing my Cross.toml section to read zig = true instead gives nearly the same error:

error: unable to find or provide libc for target 'powerpc-linux.3.16...5.10.81-gnu.2.19'

So the default seems to be glib 2.19 and there's no powerpc target for that either, correct? How can I view what's available for powerpc?

I've also tried 2.18, 2.15, 2.1, 1.0, 1.9, ... all gave the same schema of error, saying that 'powerpc-linux.3.16...5.10.81-gnu.* was not available.

Versions like 1.09.5 & 1.9.5 instead give this error:

Error: Malformed zig target abi suffix.

@Emilgardis
Copy link
Member

Emilgardis commented Oct 23, 2023

yes @thomas725 , as I explained vaguely, 1.2 is musl libc, the libc package on openwrt is a metapackage that is either musl or glibc

I'm not sure about the zig error, maybe it's the linux version (5.10) it's having issues with :/

@thomas725
Copy link
Contributor Author

I don't know where the linux kernel version 5.10 is coming from, my physical machine is running on 6.1.55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-ci-targets PRs that do not affect any cross-compilation targets.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants