emscripten-core / emscripten-core/emscripten

Emscripten Atomics API misdepends on malloc and free

Open
#12,786 4 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

```c++
#include

int main()
{
int a;
emscripten_atomic_store_u32((void*)&a, 0);
}
```
```
>em++ test.cpp -o a.html -s MALLOC=none -s USE_PTHREADS=1
error: undefined symbol: emscripten_builtin_free (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _emscripten_builtin_free may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: emscripten_builtin_memalign (referenced by top-level compiled C/C++ code)
warning: _emscripten_builtin_memalign may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: 'E:/code/emsdk/node/12.18.1_64bit/bin/node.exe E:\code\emsdk\emscripten\master\src\compiler.js C:\Users\jukkaj\AppData\Local\Temp\tmp7cep0abl.txt' failed (1)
```

Commenting out `emscripten_atomic_store_u32((void*)&a, 0);` drops the build error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.