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

Linker errors on test-linux action #290

Open
targos opened this issue Sep 11, 2024 · 8 comments
Open

Linker errors on test-linux action #290

targos opened this issue Sep 11, 2024 · 8 comments

Comments

@targos
Copy link
Member

targos commented Sep 11, 2024

I thought it was due to missing includes so I added some in 3d0e2ae, but the errors remain:

https://github.com/nodejs/node-v8/actions/runs/10788009205/job/29917856466

2024-09-10T09:32:08.5123584Z /usr/bin/ld: /home/runner/work/node-v8/node-v8/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/execution/isolate.o: in function `v8::internal::Isolate::~Isolate()':
2024-09-10T09:32:08.5125580Z isolate.cc:(.text._ZN2v88internal7IsolateD2Ev+0x3ff): undefined reference to `__atomic_compare_exchange'
2024-09-10T09:32:08.5126892Z /usr/bin/ld: isolate.cc:(.text._ZN2v88internal7IsolateD2Ev+0x4df): undefined reference to `__atomic_compare_exchange'
2024-09-10T09:32:08.5129081Z /usr/bin/ld: isolate.cc:(.text._ZN2v88internal7IsolateD2Ev+0x5bf): undefined reference to `__atomic_compare_exchange'
2024-09-10T09:32:08.5131627Z /usr/bin/ld: /home/runner/work/node-v8/node-v8/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/execution/isolate.o: in function `v8::internal::wasm::WasmCodePointerTable::AllocateUninitializedEntry()':
2024-09-10T09:32:08.5134385Z isolate.cc:(.text._ZN2v88internal4wasm20WasmCodePointerTable26AllocateUninitializedEntryEv[_ZN2v88internal4wasm20WasmCodePointerTable26AllocateUninitializedEntryEv]+0x4b): undefined reference to `__atomic_compare_exchange'
2024-09-10T09:32:08.5137023Z /usr/bin/ld: isolate.cc:(.text._ZN2v88internal4wasm20WasmCodePointerTable26AllocateUninitializedEntryEv[_ZN2v88internal4wasm20WasmCodePointerTable26AllocateUninitializedEntryEv]+0x12e): undefined reference to `__atomic_compare_exchange'
2024-09-10T09:32:08.6131002Z /usr/bin/ld: /home/runner/work/node-v8/node-v8/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/wasm/wasm-code-manager.o:wasm-code-manager.cc:(.text._ZN2v88internal4wasm8WasmCodeD2Ev+0xab): more undefined references to `__atomic_compare_exchange' follow
2024-09-10T09:32:09.2511911Z clang++: error: linker command failed with exit code 1 (use -v to see invocation)
2024-09-10T09:32:09.2553728Z make[2]: *** [tools/v8_gypfiles/mksnapshot.target.mk:220: /home/runner/work/node-v8/node-v8/out/Release/mksnapshot] Error 1
@richardlau
Copy link
Member

richardlau commented Sep 11, 2024

undefined reference to `__atomic_compare_exchange'

Perhaps the version of clang being used in Actions requires to be linked against libatomic?

@lemire
Copy link
Member

lemire commented Sep 11, 2024

The following reference seems relevant:

https://clang.llvm.org/docs/Toolchain.html#libatomic-gnu

I think @richardlau is correct, here is what LLVM docs say:

You may need to manually add -latomic

@richardlau
Copy link
Member

richardlau commented Sep 11, 2024

tools/v8_gypfiles/v8.gyp links to atomic on some architectures (but not x64):

        # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
        # to implement atomic memory access
        ['v8_current_cpu in ["mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', {
          'link_settings': {
            'libraries': ['-latomic', ],
          },
        }],

node.gyp sets for target_defaults:

      ['OS=="linux" and clang==1', {
        'libraries': ['-latomic'],
      }],

(I wonder if libraries here needs to be inside a link_settings?)

@targos
Copy link
Member Author

targos commented Sep 11, 2024

My main concern is: why is it suddenly a problem?
If it's related to host updates on GitHub Actions, why do we only have this with canary?

@richardlau
Copy link
Member

I can only assume something has changed in V8 13.0 compared to 12.9. The stack from the linker in the description is suggesting that it's coming from v8::internal::Isolate::~Isolate() calling into WasmCodePointerTable, which looks to be v8/v8@2166490#diff-76761d277cce95bd9f0a3f0d836f94f36bfbd32b1026c247faf32acbcd67a625

WasmCodePointerTable looks to be new, introduced in v8/v8@0b1d09b.

@targos
Copy link
Member Author

targos commented Sep 11, 2024

This code is new, but not the fact that V8 depends on atomics?

targos added a commit to targos/node that referenced this issue Sep 19, 2024
@targos
Copy link
Member Author

targos commented Sep 19, 2024

After reading https://clang.llvm.org/docs/Toolchain.html#libatomic-gnu, I understand that Clang apparently does not always require -latomic.
I'm trying to fix this in nodejs/node#55014 (nodejs/node@d48a069)

@targos
Copy link
Member Author

targos commented Sep 19, 2024

Build looks good. I'm adding the commit to canary-base

targos added a commit to nodejs/node that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants