build error: unable to find library -latomic (llvm/compiler-rt)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.3k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 283
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với tools/v8_gypfiles/v8.gyp, tại phần điều kiện của thư viện atomic được tham chiếu, sau đó tái hiện bằng ./configure và make trên thiết lập Linux aarch64 musl được báo cáo. So sánh cách xử lý -latomic hiện có với cách tiếp cận Mesa được liên kết và xác minh rằng build node_js2c thành công mà không cần một thư viện không khả dụng, đồng thời vẫn liên kết thư viện đó khi cần.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, linux
- Lĩnh vực
- build-system
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 58/100