Bug 219423

Summary: rustc-llvm-version.sh - kernel fails to compile
Product: Other Reporter: Cameron MacPherson (cameron.macpherson)
Component: ConfigurationAssignee: other_configuration (other_configuration)
Status: NEW ---    
Severity: high CC: ojeda
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:
Attachments: .config

Description Cameron MacPherson 2024-10-24 22:26:47 UTC
Created attachment 307069 [details]
.config

$ make LLVM=-20 -j8
  SYNC    include/config/auto.conf.cmd
./scripts/rustc-llvm-version.sh: 13: arithmetic expression: expecting primary: "10000 * 10 + 100 * 0 + "
init/Kconfig:83: syntax error
init/Kconfig:83: invalid statement
make[3]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
make[2]: *** [Makefile:679: syncconfig] Error 2
make[1]: *** [/home/cam/linux/Makefile:780: include/config/auto.conf.cmd] Error 2
make: *** [Makefile:224: __sub-make] Error 2
Comment 1 Cameron MacPherson 2024-10-27 00:25:09 UTC
$ grep RUSTC .config
CONFIG_RUSTC_VERSION=0
CONFIG_RUSTC_LLVM_VERSION=0

if i add RUSTC=false it compiles, i.e.
$ make RUSTC=false LLVM=-20 -- that will succeed without error
Comment 2 Cameron MacPherson 2024-10-27 01:56:49 UTC
rustc-llvm-version.sh contains

# Convert the version string x.y.z to a canonical up-to-6-digits form.
get_canonical_version()
{
        IFS=.
        set -- $1
        echo $((10000 * $1 + 100 * $2 + $3))
}

but i have rustc version 10.0 nightly

$ rustc --version --verbose | grep LLVM
LLVM version: 10.0

$ rustc --version --verbose
rustc 1.47.0-nightly (6c8927b0c 2020-07-26)
binary: rustc
commit-hash: 6c8927b0cf80ceee19386026cf9d7fd4fd9d486f
commit-date: 2020-07-26
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0

so the script expects version x.y.z when the nightly version is x.y
Comment 3 Miguel Ojeda 2024-10-27 15:00:38 UTC
Thanks for the report (and Thorsten for mentioning it to us), confirmed!

Fix submitted at https://lore.kernel.org/rust-for-linux/20241027145636.416030-1-ojeda@kernel.org/

It would be great if you can confirm it fixes it for you -- thanks!
Comment 4 Cameron MacPherson 2024-10-27 15:44:52 UTC
(In reply to Miguel Ojeda from comment #3)
> Thanks for the report (and Thorsten for mentioning it to us), confirmed!
> 
> Fix submitted at
> https://lore.kernel.org/rust-for-linux/20241027145636.416030-1-ojeda@kernel.
> org/
> 
> It would be great if you can confirm it fixes it for you -- thanks!

i can confirm it's fixed! thanks.
Comment 5 Miguel Ojeda 2024-10-27 16:34:56 UTC
Thanks! I will add your Tested-by tag then.