mrustc: MacOS + GCC11: `LIBS` build error (Undefined symbol `___atomic_compare_exchange_16`)
Getting closer but the following error appears with GCC 11 / Mac OS X 10.6:
(2/26) BUILDING cmake v0.1.38
> bin/mrustc rustc-1.39.0-src/vendor/cmake/src/lib.rs -o output-1.39.0/libcmake-0_1_38.rlib --crate-name cmake --crate-type rlib -C emit-depfile=output-1.39.0/libcmake-0_1_38.rlib.d --crate-tag 0_1_38 -g --cfg debug_assertions -O -L output-1.39.0 --extern cc=output-1.39.0/libcc-1_0_35.rlib
> bin/mrustc rustc-1.39.0-src/vendor/libc/build.rs --crate-name build --crate-type bin -o output-1.39.0/build_libc-0_2_62_Hd_run -L output-1.39.0 -g --cfg feature=rustc-dep-of-std --cfg feature=align --cfg feature=rustc-std-workspace-core
Undefined symbols for architecture x86_64:
"___atomic_compare_exchange_16", referenced from:
_ZRG4cE9core0_0_09core_arch6x86_6410cmpxchg16b_D0g in libcore.rlib.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Maybe mrustc needs to add another GCC flag or libatomic linkage?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 25 (25 by maintainers)
Commits related to this issue
- Enforce `-mtune=core2` and `-mtune=yonah` on macOS I've used the same cpu which is used by Rust: `core2` for x86_64[1] and `yonah` for i686[2]. I also used `mtine` instead of `mcpu` because it was de... — committed to catap/mrustc by catap 2 years ago
- Enforce `-march=core2` and `-march=yonah` on macOS I've used the same cpu which is used by Rust: `core2` for x86_64[1] and `yonah` for i686[2]. I also used `mtine` instead of `mcpu` because it was de... — committed to catap/mrustc by catap 2 years ago
- Enforce `-march=core2` and `-march=yonah` on macOS I've used the same cpu which is used by Rust: `core2` for x86_64[1] and `yonah` for i686[2]. I also used `mtine` instead of `mcpu` because it was de... — committed to thepowersgang/mrustc by catap 2 years ago
- Introducing `MRUSTC_LIB` env variable (ref #214) The idea is simple: we need some way to put `-latomic` to `gcc` call. Let add a dedicated variable which allows to add any library which may be needed... — committed to catap/mrustc by catap 2 years ago
- Introducing `MRUSTC_LIB` env variable The idea is simple: we need some way to put `-latomic` to `gcc` call. Let add a dedicated variable which allows to add any library which may be needed. It may f... — committed to catap/mrustc by catap 2 years ago
Just for records. An easy hack to make gcc works very well is adding
cargo:rustc-link-lib=atomictoscript-overrides/stable-1.54.0-macos/build_libc.txtThe very first Intel Macs were 32-bit “Core Solo” and “Core Duo”. Poking around EveryMac, it appears that the first 64-bit Macs were in fact
core2. So I think it’s safe to add to thex86_64target.-mcpu=core2 works on a small test program.