rustc fails to compile on x86_64-pc-windows-gnu
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Summary
rustc fails to compile on x86_64-pc-windows-gnu
Command used
./x build
Expected behaviour
rustc successfully compiles
Actual behaviour
rustc_driver (stage 0 -> stage 1) fails to compile. The call to x86_64-w64-mingw32-gcc fails in the final link step with an undefined reference to `__emults_v._ZSt11__once_call'
Looking this issue up online, it seems to be primarily caused by using cmake when gcc is expected, but this is a gcc build. Moreover, gcc is passed the -lstdc++ option, which should ensure these symbols are available. One oddity is that the compiler is using the mingw32 version of gcc, when I would expect it to use the primary mingw64 version.
Bootstrap configuration (bootstrap.toml)
profile = "compiler"
change-id = 154587
[build]
profiler = true
[rust]
debug = true
debuginfo-level = 2
Operating system
HEAD
037b621e831cba9ebd4148f9de33eff361df23d3
Additional context
Build Log
Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.12s
Building stage1 compiler artifacts (stage0 -> stage1, x86_64-pc-windows-gnu)
Compiling rustc_driver v0.0.0 (C:\Users\Forrest\Desktop\rust\compiler\rustc_driver)
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-Wl,C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustcpTiT5C\\list.def" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustcpTiT5C\\symbols.o" "<1 object files omitted>" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustcpTiT5C\\rmeta.o" "-Wl,-Bstatic" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps/{librustc_driver_impl-f6bc4592bb54fc17,libctrlc-c0e7bced6c80ffef,librustc_log-fa09b4bb0779bb2b,libtracing_tree-014c82c04ad38ae9,libtracing_log-2d87a7a5488c9165,libtracing_subscriber-8bf910fa46bb0bf1,libtracing_serde-b6ee6ebd8ea8df9b,libsharded_slab-eb9e8b322e7d544a,liblazy_static-8b1730537ec0084d,libmatchers-9cc941b3bde99f1d,libnu_ansi_term-51fe6587f4144917,libthread_local-c502db16214e3a65,libjiff-18ea82bba6a209d2,libshlex-740f9c7b0a3e9dd9,librustc_public-658ec5cb8c40151e,librustc_public_bridge-62b253b5759fcb48,librustc_interface-20972e126ee24f7d,librustc_codegen_llvm-adc43bd135c9c867,liblibloading-8397ab30abdcb8a0,librustc_llvm-ed0e624c392fced9}.rlib" "-lpthread" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps/{librustc_sanitizers-0d7132a60a45415c,librustc_hir_typeck-4f9653705df51aca,librustc_hir_analysis-f03da1ec9e7ea12a,librustc_monomorphize-3534f0086f436acc,librustc_mir_transform-8b98f5bb620bb0b3,librustc_mir_build-9188fc8493fbdb97,librustc_pattern_analysis-8296e6c97dacecb3,librustc_borrowck-6d6dcee857c97843,librustc_traits-db186c0654a5b8c2,librustc_const_eval-dbe5d86cf613409f,librustc_mir_dataflow-e21e75dae258913d,librustc_builtin_macros-0309d3766147c61a,librustc_resolve-b1ba0775ffd111bb,libpulldown_cmark-40942b37a81629a8,libunicase-f378f5625e9bc4da,libpulldown_cmark_escape-2f1baba293926845,librustc_passes-01588d4dabab27d5,librustc_ast_lowering-7608644d121c0c18,librustc_privacy-81df541aee54fb83,librustc_ty_utils-3837565caa396733,librustc_query_impl-a7d6ceac72474adf,librustc_lint-606561cf9c10619b,libunicode_security-b13a15cac0d20c85,libunicode_script-f1a0d457b64c776c,librustc_codegen_ssa-18e1f16842cffd80,libwasm_encoder-0f50ff4375504abc,libleb128-6c78ae7f43a0de71,libthorin-cfc4db2c2246e5b8,libhashbrown-c1626ed128c4234c,libfoldhash-0a30e0df68896290,liballocator_api2-39604dbaf2736696,libgimli-49cefe17d605b88c,libfallible_iterator-d8e0cf26f77b5ca8,libobject-9733ffe4201b3a2a,libruzstd-eae1028aac2d8ead,libtwox_hash-522dac25a8799424,librand-3ae94d14ed6197df,librand_chacha-f184aaf5e84954c0,librand_core-e00e174d702af9e0,libgetrandom-05946fb871f7bef5,libstatic_assertions-641c39871367b5e4,libflate2-ace7e91ceb0a4a2c,libminiz_oxide-2e31e640ab92d93c,libsimd_adler32-8a1ddc30198e29f6,libbstr-564e8b3de5ec26ff,librustc_trait_selection-c3dac364ac5ae3ac,librustc_next_trait_solver-95314132544aa112,librustc_transmute-40973f362d99fa9e,librustc_infer-d4ed41066c7399b5,librustc_symbol_mangling-9bdbd0801508dd87,librustc_demangle-d3da55696ad4a29f,libpunycode-1b97f87a3f1e4be2,libpathdiff-01a5d17d50ab5ee9,libregex-4f8fa9a95ae021a8,libfind_msvc_tools-1050ced1a749e01d,libar_archive_writer-8beb49221c5b5ccc,librustc_metadata-0b3a7f4ac3d09e97,liblibloading-4e505e25a65a0eec,librustc_incremental-e799a02fc0fd24f7,librustc_expand-6c5874b6d9e8dbfa,librustc_ast_passes-e82e450086fe0a70,librustc_proc_macro-0dc24a327761a96a,librustc_attr_parsing-e0f8b044a1f3dfa1,librustc_parse_format-7ef3f112841f6ce4,librustc_parse-c6c9f2fa6dca1c96,libunicode_normalization-d90199f4103248f5,libtinyvec-41a05d285d8ccd74,libtinyvec_macros-92cef3fbcaed5576,librustc_middle-ad8aa9c83fd4f819,librustc_apfloat-342ab4731980b11f,libgsgdt-16e5296ee62be675,libpolonius_engine-673d7067c9db0b94,libdatafrog-57c1725db51cf491,librustc_type_ir-de5142374ec4607f,librustc_hir_pretty-56beefc53b00a8ed,librustc_session-a966d01ebcb447a8,librustc_feature-aae040e7214de5d3,libgetopts-4d04e9b3b42efbf4,librustc_hir-d71d37c7c0addb1d,libodht-92889f30dcd73fe6,librustc_ast_pretty-15b4c0d79d521051,librustc_lexer-a8088f2064b37cd0,libunicode_properties-8187b22c17c872f5,libunicode_ident-c76f953982fc3172,libitertools-2ebc65b07031837d,librustc_target-ca60047a41214753,libserde_path_to_error-82dca3cb20ba19ab,libschemars-0a5e358216069bc5,libdyn_clone-ac83240a883350a8,libref_cast-578dc0f21c0a2ada,libobject-291dc3fbb10860b2,libcrc32fast-a05a8a0d262b2b07,libwasmparser-aa20ec5279002fa2,librustc_fs_util-67fa98dba6a89082,librustc_abi-568c364030fa8de5,librand_xoshiro-77cebd8e6f27b85c,librand-017bbb12f651c3fb,librand_chacha-b43d4645da31035b,libppv_lite86-075f7d610d6fae90,libzerocopy-fb95632f741a5ce5,librand_core-2e315f5b806676f3,librustc_errors-949c94d8e279dcba,libserde_json-a8145f08eb494714,libryu-02bcaf93fa7c1830,libtermize-af2478a6d90316db,librustc_error_codes-a5b3a37c890f17a2,libannotate_snippets-4a8077073ad70461,librustc_lint_defs-171e4df2da5c97de,libserde-a23ba8f8e593c31b,libserde_core-b0a6286c5c086a65,librustc_hir_id-c6ac0c55ef1f1f3a,libanstream-e95a2fd04b2d9264,libanstyle_query-941c05da5a2bef81,libis_terminal_polyfill-e2a851218f5b7528,libanstyle_wincon-885e93c68b2e2b0f,libonce_cell_polyfill-99f5e62e491494f1,libanstyle-ec812b959ba3ce97,libcolorchoice-0e70c20635e5e3e1,libanstyle_parse-2b239c9af23c98ae,libutf8parse-ce2f26af5d04aa12,librustc_error_messages-a5979775cd46d832,librustc_baked_icu_data-2307659bf280c12d,libicu_list-2848785d7b03d47c,libregex_automata-a23bc0ed555d2e5d,libaho_corasick-50934c61a206cde7,libregex_syntax-b2ce0e86bc4fc9fc,libicu_locale-b0f8bab66f0d29ba,libicu_locale_data-71f7c437cda29682,libicu_collections-8a08e0c8c787d500,libutf8_iter-220a841be5a4b983,libpotential_utf-477908fe2747ea93,libicu_provider-81f4cd3a4eb8c948,libzerotrie-2763b13dce6554ea,libicu_locale_core-cb583269136b21d4,libwriteable-8b45ef563462e162,liblitemap-e749d4dd41c78fc3,libfluent_bundle-dc159c9bf6bb803f,libfluent_langneg-e64db94a1a14bef6,libintl_pluralrules-3b20c7d35a41fff4,libself_cell-c423d9ce4565a4f2,libintl_memoizer-b63abfc89a2bb687,libtype_map-450daaa685083899,libunic_langid-c93c3bf00727dae9,libunic_langid_macros-560887e9f7aa1a3e,libunic_langid_impl-749131fcaac35965,libtinystr-10cb15f9f235a686,libzerovec-0e64d2f9fd11a0eb,libyoke-5b37333c1ffb019f,libzerofrom-28190cd5dd1993bb,libfluent_syntax-51f188ff1d0f1bce,libthiserror-63cafe7c6bf9c959,librustc_ast-aa596cc33b83aa2c,libmemchr-412b2e2beb879dc3,librustc_ast_ir-022fbd29f23c60fd,librustc_literal_escaper-57d8969021130bff,librustc_span-91506e92e3b9a95f,libblake3-5e5ba7af06585888,libconstant_time_eq-64dd9bce95936beb,libarrayref-c7a5cd95d32d942c,libitoa-0f1a62a75af20331,libscoped_tls-6ec3775e0a4bc40c,libsha2-af588dfa9adb06ac,libsha1-fd42e20afb68dda8,libcpufeatures-7d584c67a1abc727,libmd5-69b7d8fcf7ebd985,libdigest-1c49f0d7a6c3d969,libblock_buffer-e34ba87f3b5c780e,libcrypto_common-6eced4b64508ad70,libgeneric_array-f4a76aae89c02397,libtypenum-74f0fe4b6bcde98a,libunicode_width-cfdfacfbe480ddbc,librustc_data_structures-d227a13529d26367,libelsa-8265ff9776aa8ac1,libstable_deref_trait-573bf7185f1d51ec,librustc_thread_pool-c9ddcedef19831b8,libcrossbeam_deque-167400791be12035,libcrossbeam_epoch-cc8b3af61dc91558,libcrossbeam_utils-d391fbe18abf2088,libstacker-bbdeab82bf3f2c82,libpsm-fff9a58177fa1578,libwindows_sys-69d8d1f4a5a20d75,libwindows_targets-70ed017715454bb2,liblibc-ed66495adf00394d,libmemmap2-f1dd0674d8f26ce7,librustc_arena-41582c7b15401a6b,libwindows-c76266a38f48cc95,libwindows_core-f7a6c43cd0c53cb7,libwindows_strings-f7ec959a1f2b728a,libwindows_result-b07134b301f621a5,libwindows_link-e29c09b8d5e2a218,libbitflags-0ef3c5596c35dde5,libtempfile-ad38f459bedd08a3,libfastrand-51a8103e0aa5ec4e,libwindows_sys-bd853a9ddffb1154,libarrayvec-a840a6486ec482c1,libmeasureme-91ec93d1743bc885,librustc_hash-384f4a47e6ccf930,librustc_graphviz-06132055567941b8,libparking_lot-faaf18e2f960d05e,libparking_lot_core-65528c01d74414f4,libwindows_link-552dddefaebbf21c,liblock_api-530026b9f595b729,libscopeguard-986359f8c8f9cbf7,libjobserver-ecab55474d9cc68b,libgetrandom-d5dc612c9513e2af,libcfg_if-4363d63255f4f0af,libtracing-77cb730c5b130008,libpin_project_lite-4a8062b4bef20349,libtracing_core-7f9a6bdbe23ac78a,libonce_cell-27261a8a456585c9,librustc_hash-22e25cc87943eb86,libeither-86291dbb18f0f7dd,librustc_index-9172bd5aabf4cab9,librustc_serialize-60a4e971c776cbc7,libindexmap-ad751194e017ff46,libequivalent-0801512bd616499d,libthin_vec-fc1ebff75615afe8,librustc_hashes-c3929eedaf4a66e1,librustc_stable_hash-858783c301be6507,libsmallvec-04bb51587010384e,libhashbrown-1b839624ddc569a0,libena-83e2b8ff5f10c6b1,liblog-3ffa4f5d03bbf32e}.rlib" "-Wl,-Bdynamic" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\std-60b0cb5c68baf7b6.dll" "-Wl,-Bstatic" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib/libcompiler_builtins-*.rlib" "-Wl,-Bdynamic" "-lpsapi" "-lshell32" "-lole32" "-luuid" "-ladvapi32" "-lws2_32" "-lntdll" "-lstdc++" "-lbcrypt" "-ladvapi32" "-lkernel32" "-ladvapi32" "-lole32" "-loleaut32" "-lkernel32" "-lkernel32" "-lkernel32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-ldbghelp" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustcpTiT5C\\api-ms-win-core-synch-l1-2-0.dll_imports_indirect.lib" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustcpTiT5C\\bcryptprimitives.dll_imports_indirect.lib" "-lgcc_s" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmingwex" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\build\\stacker-f0fd05532ea87990\\out" "-L" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\build\\psm-f60581db5eedd09c\\out" "-L" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\build\\blake3-ce20c453e4ede4eb\\out" "-L" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\build\\rustc_llvm-f8797545e7c6479e\\out" "-L" "C:/Users/Forrest/Desktop/rust/build/x86_64-pc-windows-gnu/ci-llvm/lib" "-o" "C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\rustc_driver-ffffefea267b41c6.dll" "-shared" "-Wl,--out-implib=C:\\Users\\Forrest\\Desktop\\rust\\build\\x86_64-pc-windows-gnu\\stage1-rustc\\x86_64-pc-windows-gnu\\release\\deps\\librustc_driver-ffffefea267b41c6.dll.a" "-Wl,-O1" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Forrest\Desktop\rust\build\x86_64-pc-windows-gnu\stage1-rustc\x86_64-pc-windows-gnu\release\deps\librustc_llvm-ed0e624c392fced9.rlib(LTO.cpp.obj):LTO.cpp:(.rdata$.refptr.__emutls_v._ZSt11__once_call[.refptr.__emutls_v._ZSt11__once_call]+0x0): undefined reference to `__emutls_v._ZSt11__once_call'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\Forrest\Desktop\rust\build\x86_64-pc-windows-gnu\stage1-rustc\x86_64-pc-windows-gnu\release\deps\librustc_llvm-ed0e624c392fced9.rlib(LTO.cpp.obj):LTO.cpp:(.rdata$.refptr.__emutls_v._ZSt15__once_callable[.refptr.__emutls_v._ZSt15__once_callable]+0x0): undefined reference to `__emutls_v._ZSt15__once_callable'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/16.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: final link failed: bad value
collect2.exe: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
error: could not compile `rustc_driver` (lib) due to 1 previous error
Build completed unsuccessfully in 0:00:33
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing ./x build for x86_64-pc-windows-gnu with the reported bootstrap.toml settings, then inspect the stage 0 → stage 1 linker command in the build log. Trace the selected x86_64-w64-mingw32-gcc and -lstdc++ paths, and consider the issue done when the stage 1 rustc_driver link completes successfully on this target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100