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

Rustc broken on musl #179242

Closed
wyndon opened this issue Jun 26, 2022 · 8 comments
Closed

Rustc broken on musl #179242

wyndon opened this issue Jun 26, 2022 · 8 comments
Labels
0.kind: bug 6.topic: musl Running or building packages with musl libc 6.topic: rust

Comments

@wyndon
Copy link
Contributor

wyndon commented Jun 26, 2022

Describe the bug

Rustc doesn't build on musl

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix build nixpkgs#pkgsMusl.rustc

Additional context

error: builder for '/nix/store/m2yscndj8c3z3c4ni12glqkl4x8s7xv4-rustc-1.61.0.drv' failed with exit code 2;
       last 10 log lines:
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_DeleteException: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_RaiseException: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_GetIP: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_Backtrace: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_GetCFA: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_GetLanguageSpecificData: symbol not found
       > Error relocating /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/.cargo-wrapped: _Unwind_SetIP: symbol not found
       > failed to run: /nix/store/yr7ad24lix8ffnm1h9w6pfc7h704m4cr-cargo-bootstrap-1.60.0/bin/cargo build --manifest-path /build/rustc-1.61.0-src/src/bootstrap/Cargo.toml --frozen
       > Build completed unsuccessfully in 0:00:00
       > make: *** [Makefile:12: all] Error 1
       For full logs, run 'nix log /nix/store/m2yscndj8c3z3c4ni12glqkl4x8s7xv4-rustc-1.61.0.drv'.

Notify maintainers

@madjar @cstrahan @globin @Havvy

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.18.1-xanmod1, NixOS, 22.11 (Raccoon), 22.11.20220625.66e8dce`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.9.1`
 - channels(root): `"nixos"`
 - channels(wyndon): `""`
 - nixpkgs: `/nix/store/4ax73lz8i9v7jl6llsaqb1lnwal3w1qr-source`
@wyndon wyndon added 0.kind: bug 6.topic: rust 6.topic: musl Running or building packages with musl libc labels Jun 26, 2022
@yu-re-ka
Copy link
Contributor

From what I remember about this issue, rust considers musl == static, putting their own libc build into the binary, in their upstream targets. pkgsStatic.rustc works, and also uses musl.
The problems start with musl + dynamic linking, because that's not really a target supported by upstream rust. Alpine and Void have their patches to support it.

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Jun 27, 2022

@alyssais
Copy link
Member

I've opened #179554 to mark rustc broken in this case, until we can get a fix.

@wyndon
Copy link
Contributor Author

wyndon commented Jun 30, 2022

I've opened #179554 to mark rustc broken in this case, until we can get a fix.

Can't we use patches from Alpine/Void ?

@alyssais
Copy link
Member

alyssais commented Jul 1, 2022

Not easily AIUI — it's been tried before. Actually, that never integrated the patches. But still it would be a big task, and doesn't mean we shouldn't mark it broken in the mean time to make it easier to debug build failures.

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Jul 1, 2022

Not easily AIUI — it's been tried before. Actually, that never integrated the patches. But still it would be a big task, and doesn't mean we shouldn't mark it broken in the mean time to make it easier to debug build failures.

The commit linked in the final comment integrates the patches:
https://github.com/yu-re-ka/nixpkgs/commit/c3ff9944c85d4e6fb88acda60cf1500ae3be4ba5
But it's messy.

@yu-re-ka
Copy link
Contributor

yu-re-ka commented Jul 1, 2022

For good measure I confirmed that patches would still be required with the latest rust release:

Cherry-picked https://github.com/yu-re-ka/nixpkgs/commit/8f19732b39549a243d53dc2e596ccfd9e05b2f6b and https://github.com/yu-re-ka/nixpkgs/commit/70a191471cc247cb15bc05c563b8a8787acc5fb3

error: builder for '/nix/store/006c24x6vz14y14rhqd1gv4iywvgbizg-cargo-1.61.0.drv' failed with exit code 101;
       last 10 log lines:
       >    Compiling toml_edit v0.13.4
       >    Compiling rustc-workspace-hack v1.0.0 (/build/rustc-1.61.0-src/src/tools/rustc-workspace-hack)
       >    Compiling crates-io v0.34.0 (/build/rustc-1.61.0-src/src/tools/cargo/crates/crates-io)
       >    Compiling rustfix v0.6.0
       > error: failed to run custom build command for `cargo v0.62.0 (/build/rustc-1.61.0-src/src/tools/cargo)`
       >
       > Caused by:
       >   process didn't exit successfully: `/build/rustc-1.61.0-src/target/release/build/cargo-a49088ef4874356c/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
       > warning: build failed, waiting for other jobs to finish...
       > error: build failed

alyssais added a commit to alyssais/nixpkgs that referenced this issue Jul 1, 2022
As far as I can tell, none of the colord applications are graphical.
This change is important for Musl, where librsvg is not supported
because rustc does not support dynamically-linked Musl[1].

[1]: NixOS#179242
alyssais added a commit to alyssais/nixpkgs that referenced this issue Jul 1, 2022
We can't build the daemon in pkgsMusl, because rustc does not support
dynamic Musl targets[1].  But it still makes sense to support the rest
of colord, because an application should still be able to link against
it to talk to a colord daemon built in some other way (e.g. provided
by a different distro).

[1]: NixOS#179242
@wolfgangwalther
Copy link
Contributor

pkgsMusl.rustc works for me by now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: musl Running or building packages with musl libc 6.topic: rust
Projects
None yet
Development

No branches or pull requests

4 participants