Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 948429 - dev-lang/mrustc: requires CC=gcc to build Rust code
Summary: dev-lang/mrustc: requires CC=gcc to build Rust code
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Matt Jolly
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-20 06:37 UTC by Matt Jolly
Modified: 2025-01-20 06:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mrustc-0.11.2-compiler_is_gcc.patch (file_948429.txt,3.34 KB, patch)
2025-01-20 06:37 UTC, Matt Jolly
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.