Build proc_macro2 fails with RISC-V toolchain

Please help

rust/proc-macro2$ cargo build
    Updating `ustc` index
  Downloaded unicode-ident v1.0.5 (registry `ustc`)
  Downloaded 1 crate (35.5 KB) in 0.70s
   Compiling proc-macro2 v1.0.46 (/home/k510/app/rust/proc-macro2)
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc3d810)[0x2000c5c810]
linux-vdso.so.1(__vdso_rt_sigreturn+0x0)[0x200001b800]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0x3cea1aa)[0x2003d091aa]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(_RNvCsZJaBwVYvUP_16rustc_query_impl15query_callbacks+0x916c)[0x2003f0fbaa]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0x94700a)[0x200096600a]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xd57d14)[0x2000d76d14]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xcce018)[0x2000ced018]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xcccb48)[0x2000cebb48]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(_RNvMs0_NtCs2PGdSkTarcu_15rustc_interface7queriesNtB5_7Queries11global_ctxt+0x300)[0x2000d65794]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xbecada)[0x2000c0bada]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc387a6)[0x2000c577a6]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xbed8d4)[0x2000c0c8d4]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc0a996)[0x2000c29996]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc04666)[0x2000c23666]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc06da4)[0x2000c25da4]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-ac972a4e10c98556.so(+0xc0b6da)[0x2000c2a6da]
/home/k510/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-f41102d4d21d2c30.so(rust_metadata_std_ac92b06979af539e+0xa0542)[0x200778e542]
/lib/riscv64-linux-gnu/libpthread.so.0(+0x6c48)[0x200797ac48]
error: could not compile `proc-macro2`

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build --edition=2018 build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=1a06d06e066db3a7 -C extra-filename=-1a06d06e066db3a7 --out-dir /home/k510/app/rust/proc-macro2/target/debug/build/proc-macro2-1a06d06e066db3a7 -C incremental=/home/k510/app/rust/proc-macro2/target/debug/incremental -L dependency=/home/k510/app/rust/proc-macro2/target/debug/deps` (signal: 11, SIGSEGV: invalid memory reference)

Could you try ulimit -c unlimited, build again and then try loading the coredump in gdb or lldb and finally use bt to get the full backtrace? Or alternatively build with cargo build -vv and then run the rustc command it shows in a debugger. The backtrace rustc posted is created using frame pointers, but because rustc is compiled with omitted frame pointers, the backtrace is not very accurate and misses frames.

I received a report with a similar backtrace in autocfg#51, which they moved to a rust issue:

Edit: now I see that was resolved as a dupe of:

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.