Skip to content

build: statically link libatomic for Linux Clang builds - #63270

Open
alexsch01 wants to merge 2 commits into
nodejs:mainfrom
alexsch01:main
Open

alexsch01 wants to merge 2 commits into
nodejs:mainfrom
alexsch01:main

Conversation

@alexsch01

Copy link
Copy Markdown
Contributor

Fixes #60790

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels May 12, 2026
@alexsch01
alexsch01 marked this pull request as ready for review May 13, 2026 17:30
@alexsch01

Copy link
Copy Markdown
Contributor Author

Just saw the tests passed, can I have feedback on if this is a good idea or not?

@aral

aral commented Sep 12, 2026 •

Copy link
Copy Markdown

Just saw the tests passed, can I have feedback on if this is a good idea or not?

It fixes a major regression that makes Node binaries break on major Linux distributions by default so I’d say it’s a good idea.

@alexsch01

Copy link
Copy Markdown
Contributor Author

This or an alternative solution should be merged before v26 goes LTS

@aral

aral commented Oct 20, 2026

Copy link
Copy Markdown

CC @mcollina

@flevi29

flevi29 commented Nov 1, 2026

Copy link
Copy Markdown

This or an alternative solution should be merged before v26 goes LTS

Oh well.

@pdeveltere

pdeveltere commented Nov 4, 2026 •

Copy link
Copy Markdown

@targos @legendecas @aduh95 @richardlau would one of you be able to take a look at these changes? this now affects v26 LTS users :(

Thanks!

Comment thread tools/v8_gypfiles/v8.gyp
# Statically link libatomic for Linux Clang builds
['OS=="linux" and clang==1', {
'link_settings': {
'libraries': ['<!@(clang++ -print-file-name=libatomic.a)', ],

@legendecas legendecas Nov 9, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not hardcode clang++ in the gyp file. The library should be resolved in configure.gyp with CXX compiler like:

if is_clang and flavor == 'linux':
  p = subprocess.check_output(shlex.split(CXX) + ['-print-file-name=libatomic.a']).decode().strip()
  if os.path.isabs(p):
    o['variables']['libatomic'] = p
  else:
    warn('libatomic.a not found; node will depend on libatomic.so.1 at runtime')
    o['variables']['libatomic'] = '-latomic'

And use it like:

'libraries': ['<(libatomic)'].

@legendecas

Copy link
Copy Markdown
Member

Also, I think this would require libatomic-static on RHEL at build time. /cc @nodejs/build

@oyvindsaether

This comment was marked as abuse.

@aral

aral commented Nov 11, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node should run on Debian/Ubuntu-based images without having to manually install libatomic first

7 participants