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

Bug 948429

Summary: dev-lang/mrustc: requires CC=gcc to build Rust code
Product: Gentoo Linux Reporter: Matt Jolly <kangie>
Component: Current packagesAssignee: Matt Jolly <kangie>
Status: CONFIRMED ---    
Severity: normal CC: kangie, rust
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: mrustc-0.11.2-compiler_is_gcc.patch

Description Matt Jolly gentoo-dev 2025-01-20 06:37:32 UTC
Created attachment 917117 [details, diff]
mrustc-0.11.2-compiler_is_gcc.patch

dev-lang/mrustc requires CC=gcc when building Rust code.

A quick and dirty patch (attached) prevents mrustc from passing GCC-specific arguments to Clang, however Clang fails to compile the transpiled `compiler_builtins` rust sources when building the mrustc stdlib:

```
output-1.74.0/libcompiler_builtins-0_1_101_H10c.rlib.c:14350:84: error: invalid input
      constraint '0' in asm
 14350 |         __asm__ __volatile__("div %2;\n " : "+r" (asm_rax), "+r" (asm_rdx) : "r" (var48), "0" (asm_rax), "1" (...
       |                                                                                           ^
output-1.74.0/libcompiler_builtins-0_1_101_H10c.rlib.c:14400:83: error: invalid input
      constraint '0' in asm
 14400 |         __asm__ __volatile__("div %2;\n " : "+r" (asm_rax), "+r" (asm_rdx) : "r" (var3), "0" (asm_rax), "1" (a...
       |                                                                                          
. . .
```

This is not really unexpected - GCC is the supported upstream compiler.

Still, we can see if there's an easy win here, or someone that knows compilers better than I can have a go at making CC=clang work.