build error: unable to find library -latomic (llvm/compiler-rt)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
b949c28b7957f913bfbf042e6b07a22af59f1f3f
Platform
Linux aarch64-unknown-linux-musl 7.2.3-gentoo-dist-hardened #1 SMP PREEMPT_DYNAMIC Sat Sep 5 05:15:30 CEST 2026 aarch64 GNU/Linux
llvm stack (clang, libcxx, compiler-rt, libunwind)
Subsystem
No response
What steps will reproduce the bug?
$ ./configure
$ make
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
build succeeds
What do you see instead?
ld.lld: error: unable to find library -latomic
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [node_js2c.target.mk:144: /home/pepper/dev/ghrepos/node/out/Release/node_js2c] Error 1
make: *** [Makefile:145: node] Error 2
Additional information
This comment in tools/v8_gypfiles/v8.gyp suggests, that -latomic was added to facilitate the use of atomic operations as described in the linked clang docs:
# Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
# to implement atomic memory access.
# Clang needs it for some atomic operations (https://clang.llvm.org/docs/Toolchain.html#atomics-library).
['(OS=="linux" and clang==1) or (v8_current_cpu in ["mips64", "mips64el", "arm", "riscv64", "loong64"])', {
But the docs also state that compiler-rt (LLVM) or libatomic (GNU) may be used. -latomic requests libatomic while atomics from compiler-rt can be used without linker settings.
Current behaviour
The builds adds -latomic which unconditionally requests to link libatomic even in cases when it is not needed or desired.
Desired behaviour
Check if -latomic is needed e.g. like mesa meson.build, which checks if atomics compile successfully without link settings (which is the case with compiler-rt). Then append them conditionally only when needed.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit tools/v8_gypfiles/v8.gyp rund um die erwähnte Bedingung für die Atomic-Bibliothek und reproduziere das Problem anschließend mit ./configure und make auf dem gemeldeten Linux-aarch64-musl-Setup. Vergleiche die bestehende Handhabung von -latomic mit dem verlinkten Mesa-Ansatz und überprüfe, dass der node_js2c-Build ohne eine nicht verfügbare Bibliothek erfolgreich ist, während sie weiterhin gelinkt wird, wenn sie benötigt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, linux
- Bereich
- build-system
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 58/100