emscripten-core / emscripten-core/emscripten
Linking IDBFS in CMake project requires -lidbfs.js in compilation flags, but warns anyways
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
CMakeLists.txt:
```cmake
project(test)
set(CMAKE_EXECUTABLE_SUFFIX .html)
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} --use-preload-plugins -Weverything")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -lidbfs.js --use-preload-plugins")
add_executable(test test.c)
```
test.c:
```c
#include
#include
int main()
{
EM_ASM({
FS.mkdir("/tempdata");
FS.mount(IDBFS, {}, "/tempdata");
});
return 0;
}
```
Compiling this project will give a failing runnable, with a message telling me I need to add `-lidbfs.js` in the CLI arguments, although I have already done that for the linker.
If I add the same argument in the compiler flags, the project will compile and run just fine; however, it will warn at compilation time telling me the argument was ignored.
Is it normal I need to include `-lidbfs.js` in the compilation flags? Currently, the project fails to run if I don't, but the compiler warns if I do.
Contributor guide
Assessment
This issue has not been assessed yet.