Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 936635

Summary: dev-lang/rust-1.79.0: failed to run custom build command for `compiler_builtins v0.1.109` if compiling with use "wasm"
Product: Gentoo Linux Reporter: Markus Probst <markustieger>
Component: Current packagesAssignee: Randy Barlow <randy>
Status: UNCONFIRMED ---    
Severity: normal CC: chall0+gentoo, kripton, markustieger, matoro_gentoo, navi, robert, rust, stijn+gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: the build.log compressed using xz
Output of `emerge --info =dev-lang/rust-1.79.0`
Output of `emerge -pqv =dev-lang/rust-1.79.0`
build log

Description Markus Probst 2024-07-25 15:58:49 UTC
If dev-lang/rust-1.79.0 is compiled with "wasm", it fails with the error:
failed to run custom build command for `compiler_builtins v0.1.109`

(The command itself is a bit long, so look for yourself in the attached build.log)
Comment 1 Mike Gilbert gentoo-dev 2024-07-25 20:37:55 UTC
You have failed to attach the build log. Please also provide emerge --info.
Comment 2 Markus Probst 2024-07-25 20:57:32 UTC
Created attachment 898313 [details]
the build.log compressed using xz
Comment 3 Markus Probst 2024-07-25 20:58:08 UTC
Created attachment 898314 [details]
Output of `emerge --info =dev-lang/rust-1.79.0`
Comment 4 Markus Probst 2024-07-25 20:58:33 UTC
Created attachment 898315 [details]
Output of `emerge -pqv =dev-lang/rust-1.79.0`
Comment 5 Markus Probst 2024-07-25 20:59:52 UTC
(In reply to Mike Gilbert from comment #1)
> You have failed to attach the build log. Please also provide emerge --info.

Yeah, sorry about that. I guess I am either stupid or it didn't upload because it was larger than the upload limit.
Comment 6 Robert Schultz 2024-08-07 19:53:42 UTC
Created attachment 899466 [details]
build log

Bug happens for me too:

[compiler_builtins 0.1.109] CFLAGS_wasm32_unknown_unknown = Some("-ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown -pipe -mno-pku -mn
o-sgx -mrtm --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=19712 -fdebug-prefix-map=/var/tmp/portage/dev-lang/rust-1.79.0/work/r
ustc-1.79.0-src=/rustc/129f3b9964af4d4a709d1383930ade12dfe7c081")
[compiler_builtins 0.1.109] cargo:warning=clang: error: unsupported option '-mno-pku' for target 'wasm32-unknown-unknown'
[compiler_builtins 0.1.109] cargo:warning=clang: error: unsupported option '-mno-sgx' for target 'wasm32-unknown-unknown'
[compiler_builtins 0.1.109] cargo:warning=clang: error: unsupported option '-mrtm' for target 'wasm32-unknown-unknown'
[compiler_builtins 0.1.109] cargo:warning=clang: warning: argument unused during compilation: '--param=l1-cache-line-size=64' [-Wunused-command-line-argument]
[compiler_builtins 0.1.109] cargo:warning=clang: warning: argument unused during compilation: '--param=l1-cache-size=32' [-Wunused-command-line-argument]
[compiler_builtins 0.1.109] cargo:warning=clang: warning: argument unused during compilation: '--param=l2-cache-size=19712' [-Wunused-command-line-argument]
[compiler_builtins 0.1.109] 
[compiler_builtins 0.1.109] 
[compiler_builtins 0.1.109] error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunctio
n-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-pipe" "-mno-pku" "-mno-sgx" "-mrtm" "--param=l1-cache-line-size=64" "--param=l1-cach
e-size=32" "--param=l2-cache-size=19712" "-fdebug-prefix-map=/var/tmp/portage/dev-lang/rust-1.79.0/work/rustc-1.79.0-src=/rustc/129f3b9964af4d4a709d1383930ade
12dfe7c081" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/var/tmp/portage/dev-lang/rust-1.79.0/work/rustc-1.79.0-src/buil
d/x86_64-unknown-linux-gnu/stage2-std/wasm32-unknown-unknown/release/build/compiler_builtins-ef2902352451a8ee/out/8926cfe43f081305-absvdi2.o" "-c" "/var/tmp/p
ortage/dev-lang/rust-1.79.0/work/rustc-1.79.0-src/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c" with args clang did not execute successfully (status co
de exit status: 1).
[compiler_builtins 0.1.109] 
[compiler_builtins 0.1.109] 
The following warnings were emitted during compilation:

warning: compiler_builtins@0.1.109: clang: error: unsupported option '-mno-pku' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.109: clang: error: unsupported option '-mno-sgx' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.109: clang: error: unsupported option '-mrtm' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.109: clang: warning: argument unused during compilation: '--param=l1-cache-line-size=64' [-Wunused-command-line-argument]
warning: compiler_builtins@0.1.109: clang: warning: argument unused during compilation: '--param=l1-cache-size=32' [-Wunused-command-line-argument]
warning: compiler_builtins@0.1.109: clang: warning: argument unused during compilation: '--param=l2-cache-size=19712' [-Wunused-command-line-argument]

error: failed to run custom build command for `compiler_builtins v0.1.109`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information g
eneration.
Comment 7 Stijn Tintel 2024-10-31 16:56:02 UTC
Seeing this also on 1.81.0.

This could be related: https://internals.rust-lang.org/t/build-error-when-trying-to-compile-wasm-target/21192/5
Comment 8 Robert Schultz 2024-10-31 19:20:00 UTC
(In reply to Stijn Tintel from comment #7)
> Seeing this also on 1.81.0.
> 
> This could be related:
> https://internals.rust-lang.org/t/build-error-when-trying-to-compile-wasm-
> target/21192/5

Happens with rust-1.82.0 as well.

Following that link, I tried:

Enabling 'system-llvm' doesn't help, probably due to: https://bugs.gentoo.org/735154

I modified the ebuild so the [llvm] section has clang = false and the wasm target has cc = "${CHOST}-clang" and cxx = "${CHOST}-clang++"
That also didn't work, same errors:

[compiler_builtins 0.1.123] error occurred: Command "x86_64-pc-linux-gnu-clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-pipe" "-mno-cldemote" "-mno-kl" "-mno-sgx" "-mno-widekl" "-mshstk" "--param=l1-cache-line-size=64" "--param=l1-cache-size=32" "--param=l2-cache-size=36864" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DCOMPILER_RT_HAS_FLOAT16" "-DVISIBILITY_HIDDEN" "-o" "/var/tmp/portage/dev-lang/rust-1.82.0/work/rustc-1.82.0-src/build/x86_64-unknown-linux-gnu/stage2-std/wasm32-unknown-unknown/release/build/compiler_builtins-8e0c09697ead9752/out/98bdc0515731792f-absvdi2.o" "-c" "/var/tmp/portage/dev-lang/rust-1.82.0/work/rustc-1.82.0-src/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c" with args x86_64-pc-linux-gnu-clang did not execute successfully (status code exit status: 1).
[compiler_builtins 0.1.123] 
[compiler_builtins 0.1.123] 
The following warnings were emitted during compilation:

warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: error: unsupported option '-mno-cldemote' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: error: unsupported option '-mno-kl' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: error: unsupported option '-mno-sgx' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: error: unsupported option '-mno-widekl' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: error: unsupported option '-mshstk' for target 'wasm32-unknown-unknown'
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: warning: argument unused during compilation: '--param=l1-cache-line-size=64' [-Wunused-command-line-argument]
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: warning: argument unused during compilation: '--param=l1-cache-size=32' [-Wunused-command-line-argument]
warning: compiler_builtins@0.1.123: x86_64-pc-linux-gnu-clang: warning: argument unused during compilation: '--param=l2-cache-size=36864' [-Wunused-command-line-argument]

error: failed to run custom build command for `compiler_builtins v0.1.123`



For the past few months I've just been masking anything >dev-lang/rust-1.77.9 on all my systems. At some point I'll probably need to update, not sure what I'll do then as I haven't a clue how to solve this.

For others with this same problem, you'll also need to mask these as they require later versions of rust:
>sys-apps/fd-9.9.9
>www-client/chromium-126.0.6478.126
>dev-util/cargo-c-0.10.0
Comment 9 Stijn Tintel 2024-11-01 08:14:50 UTC
(In reply to Stijn Tintel from comment #7)
> Seeing this also on 1.81.0.
> 
> This could be related:
> https://internals.rust-lang.org/t/build-error-when-trying-to-compile-wasm-
> target/21192/5

Setting `build.optimized-compiler-builtins = false` as suggest in that thread makes 1.81.0 compile again for me.

```
--- rust-1.81.0.ebuild  2024-10-25 15:11:22.000000000 +0300
+++ rust-1.81.0-r1.ebuild       2024-11-01 10:14:20.713794772 +0200
@@ -427,6 +427,7 @@
                sanitizers = false
                profiler = $(toml_usex profiler)
                cargo-native-static = false
+               optimized-compiler-builtins = false
                [install]
                prefix = "${EPREFIX}/usr/lib/${PN}/${PV}"
                sysconfdir = "etc"

```
Comment 10 Robert Schultz 2024-11-01 12:54:58 UTC
(In reply to Stijn Tintel from comment #9)
> (In reply to Stijn Tintel from comment #7)
> > Seeing this also on 1.81.0.
> > 
> > This could be related:
> > https://internals.rust-lang.org/t/build-error-when-trying-to-compile-wasm-
> > target/21192/5
> 
> Setting `build.optimized-compiler-builtins = false` as suggest in that
> thread makes 1.81.0 compile again for me.
> 
> ```
> --- rust-1.81.0.ebuild  2024-10-25 15:11:22.000000000 +0300
> +++ rust-1.81.0-r1.ebuild       2024-11-01 10:14:20.713794772 +0200
> @@ -427,6 +427,7 @@
>                 sanitizers = false
>                 profiler = $(toml_usex profiler)
>                 cargo-native-static = false
> +               optimized-compiler-builtins = false
>                 [install]
>                 prefix = "${EPREFIX}/usr/lib/${PN}/${PV}"
>                 sysconfdir = "etc"
> 
> ```

I can CONFIRM that this fix works for rust-1.82.0 as well! Thank you!!