Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust 1.77.1 fails to build natively on armv7-unknown-netbsd-eabihf #123549

Open
he32 opened this issue Apr 6, 2024 · 17 comments
Open

rust 1.77.1 fails to build natively on armv7-unknown-netbsd-eabihf #123549

he32 opened this issue Apr 6, 2024 · 17 comments
Labels
C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-netbsd Operating system: NetBSD P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@he32
Copy link
Contributor

he32 commented Apr 6, 2024

While working through the testing of rust 1.77.1 for the various NetBSD targets we try to keep rust running on, I am having trouble getting rust to build "natively" on an emulated armv7 system.

I expected to see this happen: The build of rust should complete.

Instead, this happened: Rust 1.77.1 fails to build, while the build of 1.76.0 succeeded.

The error I see is a SIGSEGV error in the rust build, using the stage2 rust compiler, which is built with the embedded LLVM in the rust distribution, either when building the libc crate, or sometimes (I tried restarting the build multiple times) when building the proc-macro2 or unicode-ident vendor crates.

I initially tried running the build with a parallelism of 3, but have dialed that down to 1 now to eliminate any issues with that and also to make the build log less confusing, and it now looks like it has consistent problems building the libc-v0.2.151 crate. This happens quite a bit into the build, initially after 40+ hours, and as mentioned, while using the stage2 compiler, so this is rustc 1.77.1 itself. I initially had problems getting any information out of this from gdb, but this now succeeded, hence this problem report. The end of the build log was in this latest rebuild attempt:

   Compiling libc v0.2.151
     Running `/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/bootstrap/debug/rustc /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/bootstrap/debug/rustc --crate-name build_script_build /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/vendor/libc/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -Zunstable-options --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=bfcae1bc36ffd5f3 -C extra-filename=-bfcae1bc36ffd5f3 --out-dir /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/build/libc-bfcae1bc36ffd5f3 -L dependency=/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/deps --cap-lints allow -Z binary-dep-depinfo`

rustc exited with signal: 11 (SIGSEGV) (core dumped)
Did not run successfully: signal: 11 (SIGSEGV) (core dumped)
LD_LIBRARY_PATH="/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib:/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/deps:/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib:/usr/pkgsrc/wip/rust177/work/rust-bootstrap/lib" "/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/bin/rustc" "--crate-name" "build_script_build" "/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/vendor/libc/build.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "bin" "--emit=dep-info,link" "-C" "embed-bitcode=no" "-C" "debug-assertions=off" "--cfg" "feature=\"default\"" "--cfg" "feature=\"extra_traits\"" "--cfg" "feature=\"std\"" "-Zunstable-options" "--check-cfg" "cfg(feature, values(\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"))" "-C" "metadata=bfcae1bc36ffd5f3" "-C" "extra-filename=-bfcae1bc36ffd5f3" "--out-dir" "/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/build/libc-bfcae1bc36ffd5f3" "-L" "dependency=/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/deps" "--cap-lints" "allow" "-Z" "binary-dep-depinfo" "-Zunstable-options" "--check-cfg=cfg(bootstrap)"
-------------
error: could not compile `libc` (build script)

Caused by:
  process didn't exit successfully: `/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/bootstrap/debug/rustc /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/bootstrap/debug/rustc --crate-name build_script_build /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/vendor/libc/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -Zunstable-options --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=bfcae1bc36ffd5f3 -C extra-filename=-bfcae1bc36ffd5f3 --out-dir /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/build/libc-bfcae1bc36ffd5f3 -L dependency=/usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2-tools/release/deps --cap-lints allow -Z binary-dep-depinfo` (exit status: 254)
...

and the corresponding gdb session looks like it actually managed to pick the appropriate information out of the system:

armv7: {35} gdb work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/bin/rustc work/rustc-1.77.1-src/vendor/libc/rustc.core
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7--netbsdelf-eabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/bin/rustc...
(No debugging symbols found in work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/bin/rustc)
[New process 2]
[New process 1]
Core was generated by `rustc'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x6f9dcae0 in _RNvXs3_NtNtCs3kU7s5G7Zdo_12rustc_middle2ty3adtNtB5_10AdtDefDataINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stable ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
[Current thread is 1 (process 2)]
(gdb) where
#0  0x6f9dcae0 in _RNvXs3_NtNtCs3kU7s5G7Zdo_12rustc_middle2ty3adtNtB5_10AdtDefDataINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stable ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#1  0x6fb1b290 in _RNvXs4_NtCsdSRlzs8Ddzv_13rustc_type_ir7ty_infoINtB5_18WithCachedTypeInfoINtNtB7_7ty_kind6TyKindNtNtNtCs3kU7s5G7Zdo_12rustc_middle2ty7context6TyCtxtEEINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stableB1B_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#2  0x6f2dacc0 in _RNvXNtNtCs3kU7s5G7Zdo_12rustc_middle2ty8impls_tyRINtNtB4_4list4ListNtNtB4_12generic_args10GenericArgEINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stableCs7KzrBXWNv6h_21rustc_symbol_mangling ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#3  0x6f2bf850 in _RNvNtCs7KzrBXWNv6h_21rustc_symbol_mangling6legacy6mangle ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#4  0x6f2ed5c0 in _RNvCs7KzrBXWNv6h_21rustc_symbol_mangling20symbol_name_provider ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#5  0x6ea0542c in _RINvNtCs7RprckPEVMF_16rustc_query_impl8plumbing28___rust_begin_short_backtraceNCNCNvNtNtB4_10query_impl11symbol_name13dynamic_querys0_00INtNtNtCs3kU7s5G7Zdo_12rustc_middle5query5erase6ErasedAhj8_EEB4_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#6  0x6ea6ba20 in _RNvYNCNvNtNtCs7RprckPEVMF_16rustc_query_impl10query_impl11symbol_name13dynamic_querys0_0INtNtNtCs5pfNobr3ZU9_4core3ops8function6FnOnceTNtNtNtCs3kU7s5G7Zdo_12rustc_middle2ty7context6TyCtxtNtNtB2d_8instance8InstanceEE9call_onceBa_.llvm.15086006372759575508 ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#7  0x6ec59258 in _RINvNtNtCsdoQWj0sYDTv_18rustc_query_system5query8plumbing17try_execute_queryINtCs7RprckPEVMF_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtNtCs3kU7s5G7Zdo_12rustc_middle2ty8instance8InstanceINtNtNtB2z_5query5erase6ErasedAhj8_EEKb0_KB3Y_KB3Y_ENtNtB1f_8plumbing9QueryCtxtKB3Y_EB1f_
    ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#8  0x6eb324cc in _RNvNtNtNtCs7RprckPEVMF_16rustc_query_impl10query_impl11symbol_name18get_query_non_incr26___rust_end_short_backtrace ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#9  0x6f9e171c in _RINvNtNtCs3kU7s5G7Zdo_12rustc_middle5query8plumbing12query_get_atINtNtNtCsdoQWj0sYDTv_18rustc_query_system5query6caches12DefaultCacheNtNtNtB6_2ty8instance8InstanceINtNtB4_5erase6ErasedAhj8_EEEB6_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#10 0x6f9d3bb4 in _RNvMNtNtCs3kU7s5G7Zdo_12rustc_middle3mir4monoNtB2_8MonoItem11symbol_name ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#11 0x6dd8c690 in _RNvXNtNtCs4Gc6o176Yf_5alloc3vec14spec_from_iterINtB4_3VecTRNtNtNtCs3kU7s5G7Zdo_12rustc_middle3mir4mono8MonoItemNtNtB11_2ty10SymbolNameEEINtB2_12SpecFromIterBT_INtNtNtNtCs5pfNobr3ZU9_4core4iter8adapters3map3MapINtNtNtNtCs7UFu2kmhlFP_3std11collections4hash3set4IterBV_ENCINvNtCs1TLur4eufjh_18rustc_monomorphize12partitioning27assert_symbols_are_distinctB3l_E0EE9from_iterB4o_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#12 0x6dd72954 in _RINvNtCs1TLur4eufjh_18rustc_monomorphize12partitioning27assert_symbols_are_distinctINtNtNtNtCs7UFu2kmhlFP_3std11collections4hash3set4IterNtNtNtCs3kU7s5G7Zdo_12rustc_middle3mir4mono8MonoItemEEB4_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#13 0x6dd82b88 in _RINvNtNtNtCskL78Bf8MWqU_21rustc_data_structures4sync8parallel8disabled4joinNCNCNvNtCs1TLur4eufjh_18rustc_monomorphize12partitioning32collect_and_partition_mono_items00NCB1d_s_0RSNtNtNtCs3kU7s5G7Zdo_12rustc_middle3mir4mono11CodegenUnituEB1j_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#14 0x6dd98690 in _RINvMNtCs2PjVAkr1vSw_13rustc_session5utilsNtNtB5_7session7Session4timeTRSNtNtNtCs3kU7s5G7Zdo_12rustc_middle3mir4mono11CodegenUnituENCNvNtCs1T--Type <RET> for more, q to quit, c to continue without paging-- 
Lur4eufjh_18rustc_monomorphize12partitioning32collect_and_partition_mono_items0EB2b_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#15 0x6dd72e64 in _RNvNtCs1TLur4eufjh_18rustc_monomorphize12partitioning32collect_and_partition_mono_items ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#16 0x6ea09a9c in _RINvNtCs7RprckPEVMF_16rustc_query_impl8plumbing28___rust_begin_short_backtraceNCNCNvNtNtB4_10query_impl32collect_and_partition_mono_items13dynamic_querys0_00INtNtNtCs3kU7s5G7Zdo_12rustc_middle5query5erase6ErasedAhjc_EEB4_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#17 0x6ea8d738 in _RNvYNCNvNtNtCs7RprckPEVMF_16rustc_query_impl10query_impl32collect_and_partition_mono_items13dynamic_querys0_0INtNtNtCs5pfNobr3ZU9_4core3ops8function6FnOnceTNtNtNtCs3kU7s5G7Zdo_12rustc_middle2ty7context6TyCtxtuEE9call_onceBa_.llvm.8358421460515107423 ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#18 0x6ec2042c in _RINvNtNtCsdoQWj0sYDTv_18rustc_query_system5query8plumbing17try_execute_queryINtCs7RprckPEVMF_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs3kU7s5G7Zdo_12rustc_middle5query5erase6ErasedAhjc_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtxtKB3s_EB1f_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#19 0x6eb49d04 in _RNvNtNtNtCs7RprckPEVMF_16rustc_query_impl10query_impl32collect_and_partition_mono_items18get_query_non_incr26___rust_end_short_backtrace ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#20 0x6b441e60 in _RINvNtCsaVq8gycyCBQ_17rustc_codegen_ssa4base13codegen_crateNtCs2lMMi7H5m3x_18rustc_codegen_llvm18LlvmCodegenBackendEBX_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#21 0x6b48bddc in _RNvXs5_Cs2lMMi7H5m3x_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCsaVq8gycyCBQ_17rustc_codegen_ssa6traits7backend14CodegenBackend13codegen_crate ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#22 0x6b2ffcb8 in _RINvMNtCs2PjVAkr1vSw_13rustc_session5utilsNtNtB5_7session7Session4timeINtNtCs4Gc6o176Yf_5alloc5boxed3BoxDNtNtCs5pfNobr3ZU9_4core3any3AnyEL_ENCNvNtCsflMcfF6XAXO_15rustc_interface6passes13start_codegen0EB2k_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#23 0x6b2e69e4 in _RNvNtCsflMcfF6XAXO_15rustc_interface6passes13start_codegen
    ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#24 0x6b33732c in _RINvMs7_NtNtCs3kU7s5G7Zdo_12rustc_middle2ty7contextNtB6_10GlobalCtxt5enterNCNvMs3_NtCsflMcfF6XAXO_15rustc_interface7queriesNtB1i_7Queries24codegen_and_build_linker0INtNtCs5pfNobr3ZU9_4core6result6ResultNtB1i_6LinkerNtCsP0Y3IzHQne_10rustc_span15ErrorGuaranteedEEB1k_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#25 0x6b318de4 in _RNvMs3_NtCsflMcfF6XAXO_15rustc_interface7queriesNtB5_7Queries24codegen_and_build_linker ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#26 0x6b123b3c in _RINvCsP0Y3IzHQne_10rustc_span14set_source_mapINtNtCs5pfNobr3ZU9_4core6result6ResultuNtB2_15ErrorGuaranteedENCNCINvNtCsflMcfF6XAXO_15rustc_interface9interface12run_compilerBH_NCNvCsiFCfUHeIUud_17rustc_driver_impl12run_compiler0E00EB2Q_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#27 0x6b14e088 in _RINvMs_CsdyPVYEdwfpq_10scoped_tlsINtB5_9ScopedKeyNtCsP0Y3IzHQne_10rustc_span14SessionGlobalsE3setNCINvNtCsflMcfF6XAXO_15rustc_interface9interface12run_compilerINtNtCs5pfNobr3ZU9_4core6result6ResultuNtBN_15ErrorGuaranteedENCNvCsiFCfUHeIUud_17rustc_driver_impl12run_compiler0E0B2x_EB3B_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#28 0x6b124208 in _RINvCsP0Y3IzHQne_10rustc_span27create_session_globals_thenINtNtCs5pfNobr3ZU9_4core6result6ResultuNtB2_15ErrorGuaranteedENCINvNtCsflMcfF6XAXO_15rustc_interface9interface12run_compilerBU_NCNvCsiFCfUHeIUud_17rustc_driver_impl12run_compiler0E0EB31_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
--Type <RET> for more, q to quit, c to continue without paging--
#29 0x6b13fad4 in _RINvNtNtCs7UFu2kmhlFP_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsflMcfF6XAXO_15rustc_interface4util26run_in_thread_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCs5pfNobr3ZU9_4core6result6ResultuNtCsP0Y3IzHQne_10rustc_span15ErrorGuaranteedENCNvCsiFCfUHeIUud_17rustc_driver_impl12run_compiler0E0B2Z_E00B2Z_EB4p_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#30 0x6b1635e8 in _RNSNvYNCINvMNtCs7UFu2kmhlFP_3std6threadNtBa_7Builder16spawn_unchecked_NCNCINvNtCsflMcfF6XAXO_15rustc_interface4util26run_in_thread_with_globalsNCINvNtB1f_9interface12run_compilerINtNtCs5pfNobr3ZU9_4core6result6ResultuNtCsP0Y3IzHQne_10rustc_span15ErrorGuaranteedENCNvCsiFCfUHeIUud_17rustc_driver_impl12run_compiler0E0B2Q_E00B2Q_Es_0INtNtNtB2V_3ops8function6FnOnceuE9call_once6vtableB4g_ ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/librustc_driver-92fca06d07ba3c06.so
#31 0x6a9a39cc in std::sys::pal::unix::thread::Thread::new::thread_start ()
   from /usr/pkgsrc/wip/rust177/work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/libstd-fc5163e045403682.so
#32 0x6a53c0a4 in ?? () from /usr/lib/libpthread.so.1
#33 0x6a8d8874 in __mknod50 () from /usr/lib/libc.so.12
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) i regi
r0             0x6a384010          1782071312
r1             0x0                 0
r2             0x80808080          2155905152
r3             0x0                 0
r4             0x33858274          864387700
r5             0x0                 0
r6             0x69ff0664          1778320996
r7             0x0                 0
r8             0x69ff03c0          1778320320
r9             0x0                 0
r10            0x69ff04b0          1778320560
r11            0x0                 0
r12            0xfefefeff          4278124287
sp             0x69ff0220          0x69ff0220
lr             0x19191919          421075225
pc             0x6f9dcae0          0x6f9dcae0 <_RNvXs3_NtNtCs3kU7s5G7Zdo_12rustc_middle2ty3adtNtB5_10AdtDefDataINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stable+240>
cpsr           0x60080010          1611137040
(gdb) x/i 0x6f9dcae0
=> 0x6f9dcae0 <_RNvXs3_NtNtCs3kU7s5G7Zdo_12rustc_middle2ty3adtNtB5_10AdtDefDataINtNtCskL78Bf8MWqU_21rustc_data_structures13stable_hasher10HashStableNtNtNtCsdoQWj0sYDTv_18rustc_query_system3ich3hcx20StableHashingContextE11hash_stable+240>:      ldr     r10, [r7, r3]
(gdb) 

So ... this looks at least on the surface of it like a "boring" NULL pointer de-reference.

However, I am also having issues building rust 1.71.1 natively on arm64 (not yet reported), and on that platform a stack overflow is flagged, so I wonder if this could be the same problem. The stack in the above backtrace is kind of long...

Meta

rustc --version --verbose:

armv7: {14} env LD_LIBRARY_PATH=work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/lib/ tcsh
armv7: {1} work/rustc-1.77.1-src/build/armv7-unknown-netbsd-eabihf/stage2/bin/rustc --version
rustc 1.77.1 (7cf61ebde 2024-03-27) (built from a source tarball)
armv7: {2} 
Backtrace

See above.

@he32 he32 added the C-bug Category: This is a bug. label Apr 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 6, 2024
@he32
Copy link
Contributor Author

he32 commented Apr 6, 2024

That aarch64 stack overflow I mentioned above is now reported in #123551.

@jieyouxu jieyouxu added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. labels Apr 6, 2024
@Noratrieb
Copy link
Member

So ... this looks at least on the surface of it like a "boring" NULL pointer de-reference.

Given that this is in Rust, it is not at all boring... it seems very unlikely to be a bug in the crashing part of the compiler, this is probably a miscompilation.

@Noratrieb Noratrieb added I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 6, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Apr 6, 2024
@he32
Copy link
Contributor Author

he32 commented Apr 6, 2024

So ... this looks at least on the surface of it like a "boring" NULL pointer de-reference.

Given that this is in Rust, it is not at all boring... it seems very unlikely to be a bug in the crashing part of the compiler, this is probably a miscompilation.

Maybe. But ... if this is a code generation bug, is anything similar observed on other armv7 platforms?

I on my side will re-try the build with an exteral LLVM, version 16.0.6, instead of the embedded 17.0.6 version, though that will require an LLVM rebuild, so will take a while to complete. Will return with status when that's done.

@Noratrieb
Copy link
Member

people generally don't compile rustc on armv7 platforms (it's a pretty weird thing to do imo, especially as it does take so long, cross compilation is a thing) so I wouldn't be too surprised if no one has hit this

@he32
Copy link
Contributor Author

he32 commented Apr 6, 2024

Hm, yes, I'm not surprised. However, self-building rust turns out to be an effective "stress test" of the compiler.

Wrt. the included LLVM: rust 1.76.0 contains the same version of LLVM (17.0.6) as rust 1.77.1, so ... this makes it slightly dubious whether replacing the embedded LLVM with an external one will fix this problem. :(

@Noratrieb
Copy link
Member

If you could bisect it down that would be great... and take quite a while though.. so not exactly ideal either. 🙃

@he32
Copy link
Contributor Author

he32 commented Apr 6, 2024

Bisecting will be troublesome at best, since my build setup is based on rust tarballs and not github checkouts. Though I'm receptive to hints on how to do that. No promises, though...

@lqd
Copy link
Member

lqd commented Apr 6, 2024

Just checking: the title of this issue, and OP, both mention "1.71.1", but I presume they are typos for "1.77.1"?

@saethlin saethlin changed the title rust 1.71.1 fails to build natively on armv7-unknown-netbsd-eabihf rust 1.77.1 fails to build natively on armv7-unknown-netbsd-eabihf Apr 7, 2024
@he32
Copy link
Contributor Author

he32 commented Apr 7, 2024

Just checking: the title of this issue, and OP, both mention "1.71.1", but I presume they are typos for "1.77.1"?

Yes. How sloppy of me. I see that's fixed.

@DemiMarie
Copy link
Contributor

Bisecting will be troublesome at best, since my build setup is based on rust tarballs and not github checkouts. Though I'm receptive to hints on how to do that. No promises, though...

What about using git archive to generate a tarball?

@he32
Copy link
Contributor Author

he32 commented Apr 7, 2024

Bisecting will be troublesome at best, since my build setup is based on rust tarballs and not github checkouts. Though I'm receptive to hints on how to do that. No promises, though...

What about using git archive to generate a tarball?

I don't think that will do the same -- won't that leave out all the vendored crates?

@apiraino
Copy link
Contributor

apiraino commented Apr 8, 2024

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 8, 2024
@apiraino apiraino added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Apr 8, 2024
@he32
Copy link
Contributor Author

he32 commented Apr 10, 2024

FWIW, I did a re-try where I configured rust to use an external LLVM (version 16.0.6), and perhaps unsurprisingly, this didn't fix the issue -- the stage-2 rust compiler still gets a SEGV compiling the same code (though I didn't do GDB this time). So this is an indication that this is probably a bug in the part of the compiler written in rust. "How fun."

@he32
Copy link
Contributor Author

he32 commented Apr 27, 2024

people generally don't compile rustc on armv7 platforms (it's a pretty weird thing to do imo, especially as it does take so long, cross compilation is a thing) so I wouldn't be too surprised if no one has hit this

Yes, I do realize that cross compilation is a thing. However, one must have some assurance that the cross-compilation produces correct results. So in the mean time I have tried using the cross-built rust compiler (built on NetBSD/amd64, targeting NetBSD/armv7) to natively build the dua-cli rust application, and that quickly falls on its face with cargo getting a SEGV crash and core dump fairly quickly, and a gdb session on the core file just produces:

armv7: {147} gdb /usr/pkg/bin/cargo ./work/dua-cli-2.20.1/cargo.core
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7--netbsdelf-eabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/pkg/bin/cargo...
(No debugging symbols found in /usr/pkg/bin/cargo)
[New process 1]
Core was generated by `cargo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0cc5c960 in std::panicking::try ()
(gdb) where
#0  0x0cc5c960 in std::panicking::try ()
#1  0x0cc3eae4 in std::rt::lang_start_internal ()
#2  0x0bccd020 in main ()
(gdb) i reg
r0             0x44a3a4            4498340
r1             0x1                 1
r2             0x1f8               504
r3             0x5c092000          1544101888
r4             0x7ff46fd8          2146725848
r5             0x7ff46ffc          2146725884
r6             0x5c092200          1544102400
r7             0xd0b3e24           218840612
r8             0x2401a8fe          604088574
r9             0xf798910e          4153970958
r10            0x0                 0
r11            0x7ff47024          2146725924
r12            0x2                 2
sp             0x7ff46fa8          0x7ff46fa8
lr             0xcc5c958           214288728
pc             0xcc5c960           0xcc5c960 <std::panicking::try+108>
cpsr           0x200b0010          537591824
(gdb) x/i $pc
=> 0xcc5c960 <_ZN3std9panicking3try17h66c30643ffe8f2f0E+108>:       
    ldr       r10, [r9]
(gdb) x/x 0xf798910e
0xf798910e:       Cannot access memory at address 0xf798910e
(gdb) q

So... This has me asking what the state is for testing the results of cross compilation from other systems targeting armv7? The above test should at least be fairly easy to carry out on other armv7 systems.

@he32
Copy link
Contributor Author

he32 commented May 8, 2024

I have re-tried this with rust 1.78.0 which brings along a new major version of the embedded LLVM, and the status is basically the same as reported above. I'm also building rust for among others amd64, riscv64, sparc64, 32-bit powerpc, all on NetBSD, and none of these behave this way. I'm therefore left wondering if there is something CPU-specific for armv7 which should be done on NetBSD, which is new in 1.77.*, and which currently isn't there.

Parts of my summarized test results is as follows, all on NetBSD, and "success" is gauged by the platform self-hosting the rust compiler and being able to build librsvg natively with the result, i.e. not just cross-building the compiler for use on the target. So "something" definitely happened between version 1.76.0 and 1.77.1 which made all of the arm targets fail (both 32-bit and 64-bit). Hints gratefully accepted...

            1.75.0  1.76.0  1.77.1  1.78.0

aarch64         x       x       f       f
amd64           x       x       x       x
armv6           x       x       f       f
armv7           x       x       f       f
i386            x       x       x       x
ppc             x       x       x       x
riscv64         x       x       x       o
sparc64         x       x       x       o

x = tests ok
f = failed one or more tests
o = ongoing / undecided

This indicates that what I'm seeing is not an "OS error", probably not an artifact of my build setup (since it successfully cross-compiles for other CPUs / targets, and earlier versions have produced working results for armv7), and is probably CPU-dependent, perhaps coupled with the particular OS I'm building for.

@workingjubilee
Copy link
Member

Hmm, I guess #122002 doesn't fix it either.

@workingjubilee workingjubilee added the O-netbsd Operating system: NetBSD label Jul 24, 2024
@workingjubilee
Copy link
Member

It is likely the fix is to disable the has_thread_local for the Arm NetBSD targets, see #123551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state O-netbsd Operating system: NetBSD P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants