You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
After "emsdk activate tot" , "emcc hello.c" gives "clang: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory" #928
Hm, yeah it looks like libatomic is a dependency of libc++ rather than directly of LLVM. I am actually quite surprised that there are any Linux distros that ship without it by default. On one hand it's not the only non-system "third party" dependency that we have (e.g. we depend on zlib), but clearly there are systems where this is a problem, so maybe we should see if there's a reasonable way to work around it. maybe libc++ can be built without that dependence, or we can link it statically, or just build it ourselves or something.
Or maybe just leave it out entirely. Poking through the libcxx repo, it looks like Apple does not ship libatomic at all, and there are a few tests disabled in the libcxx test suite because of it. But since LLVM and Binaryen already work just fine on mac (since they don't atomic ops on large non-lock-free types), we can probably just get away with disabling it.
@dschuff do you know of any way to remove this dependency of to link it statically? I don't see any static version of libatomic my debian system (unless I'm missing something).
I can confirm that this is happening. Based on the logs it looks like the dependency might be coming from mimalloc. We last did a mimalloc update in June; what was the last version you were using that was good?
I think libatomic itself comes from gcc (https://github.com/gcc-mirror/gcc/tree/master/libatomic).
I have it on my system as /usr/lib/x86_64-linux-gnu/libatomic.so.1, as well as some version-specific .a files like /usr/lib/gcc/x86_64-linux-gnu/14/libatomic.a (and .so). Package-wise it looks like it's part of libgcc
I didn't really want to mess with mimalloc's CMake files, but I found a way to keep mimalloc from using libatomic at all if it wasn't actually needed: WebAssembly/binaryen#8211
Activity
shlomif commentedon Nov 11, 2021
I have an update: emcc gives the same error also after
emsdk activate latest.shlomif commentedon Nov 11, 2021
another update: seems like both versions started working after I ran
sudo dnf -y install libatomic.sbc100 commentedon Nov 11, 2021
Hmm.. this seems to be a core dependency of clang/llvm... although it looks like it wasn't always the case.
From 2.0.20:
From 3.0.30:
From 2.0.33:
@dschuff do you know whats going on here? Looks like it changed when we started depending on our own libc++?
Should we also bundle libatomic? Or can/should we assume it to be present?
dschuff commentedon Nov 11, 2021
Hm, yeah it looks like libatomic is a dependency of libc++ rather than directly of LLVM. I am actually quite surprised that there are any Linux distros that ship without it by default. On one hand it's not the only non-system "third party" dependency that we have (e.g. we depend on zlib), but clearly there are systems where this is a problem, so maybe we should see if there's a reasonable way to work around it. maybe libc++ can be built without that dependence, or we can link it statically, or just build it ourselves or something.
sbc100 commentedon Nov 11, 2021
@shlomif what linux distro are you using?
dschuff commentedon Nov 11, 2021
OP says
bits: 64 Desktop: Xfce 4.16.0 Distro: Fedora release 34 (Thirty Four). So not exactly a tiny niche distro.sbc100 commentedon Nov 11, 2021
Yup, sounds like we want to link it statically if possible then.
dschuff commentedon Nov 11, 2021
Or maybe just leave it out entirely. Poking through the libcxx repo, it looks like Apple does not ship libatomic at all, and there are a few tests disabled in the libcxx test suite because of it. But since LLVM and Binaryen already work just fine on mac (since they don't atomic ops on large non-lock-free types), we can probably just get away with disabling it.
Update dependencies from https://github.com/dotnet/arcade build 20240…
phlax commentedon Jan 10, 2026
it looks like the current build has the leaked shared libatomic.so.1
specifically we are hitting this with the wasm-opt bin - surely it should be compiled in
this breaks hermetic builds
bazel/sysroot: Add libatomic to workaround broken emscripten
bazel/sysroot: Add libatomic to workaround broken emscripten (#3415)
docker/debian: Add libatomic to workaround broken emscripten
docker/debian: Add libatomic to workaround broken emscripten (#513)
sbc100 commentedon Jan 10, 2026
@dschuff do you know of any way to remove this dependency of to link it statically? I don't see any static version of libatomic my debian system (unless I'm missing something).
dschuff commentedon Jan 15, 2026
I can confirm that this is happening. Based on the logs it looks like the dependency might be coming from mimalloc. We last did a mimalloc update in June; what was the last version you were using that was good?
dschuff commentedon Jan 15, 2026
@sbc100 It looks like the sysroot we build in has libatomic.a though
sbc100 commentedon Jan 15, 2026
Strange.. do you know what package it comes from? Are you able to find that file on your system? (From what package?)
dschuff commentedon Jan 15, 2026
I think libatomic itself comes from gcc (https://github.com/gcc-mirror/gcc/tree/master/libatomic).
I have it on my system as /usr/lib/x86_64-linux-gnu/libatomic.so.1, as well as some version-specific .a files like /usr/lib/gcc/x86_64-linux-gnu/14/libatomic.a (and .so). Package-wise it looks like it's part of libgcc
sbc100 commentedon Jan 15, 2026
Ah, ok, then there maybe some way to statically link libatomic.a then. Good news.
dschuff commentedon Jan 15, 2026
I didn't really want to mess with mimalloc's CMake files, but I found a way to keep mimalloc from using libatomic at all if it wasn't actually needed: WebAssembly/binaryen#8211
phlax commentedon Jan 16, 2026
thanks or addressing this, really appreciated
Link mimalloc with --as-needed on Linux (WebAssembly#8211)