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
Building cmake pybind11 project fails with libatomic link error #257
I tried to build a project which uses CMake and Pybind11 for pyodide-0.29 on Python 3.13 but get a linker error:
wasm-opt: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory
em++: error: error running binaryen executable (wasm-opt). Please check your binaryen installation
I also tested this with the Pybind11/cmake example project where I updated the pybind11 submodule to v3.0.0 and changed the CMakeList.txt file to:
cmake_minimum_required(VERSION 3.4...3.18)
project(cmake_example)
cmake_policy(SET CMP0148 OLD) # New policy gives error finding Python
if (EMSCRIPTEN)
set(PYBIND11_USE_CROSSCOMPILING TRUE)
endif()
add_subdirectory(pybind11)
pybind11_add_module(cmake_example src/main.cpp)
# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a
# define (VERSION_INFO) here.
target_compile_definitions(cmake_example
PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
I'm using a conda environment created with mamba create -n ems313 python=3.13 pyodide-build
I noticed that one of the recipes project uses a restriction to pybind < 3 but even if I use pybind-2.9.2 I still get the libatomic error (also the macro PYBIND11_USE_CROSSCOMPILING was only introduced in pybind-3 so you have to replace that line with unset(CMAKE_SIZEOF_VOID_P) otherwise you get a Python config failure: Python is 64-bit, chosen compiler is 32-bit error.
Thanks for the report. Yeah, I also think the CPython issue you linked is related. The emscripten does not provide libatomic, but it seems like Python 3.13 thinks libatomic is needed. Which patch version of Python do you use, by the way?
Looking at this comment there was a change between Python 3.13.0 and 3.13.1, so one of them may work if the problem is that change.
cc: @henryiii for just in case if you have any idea.
Activity
ryanking13 commentedon Nov 17, 2025
Thanks for the report. Yeah, I also think the CPython issue you linked is related. The emscripten does not provide libatomic, but it seems like Python 3.13 thinks libatomic is needed. Which patch version of Python do you use, by the way?
Looking at this comment there was a change between Python 3.13.0 and 3.13.1, so one of them may work if the problem is that change.
cc: @henryiii for just in case if you have any idea.