emscripten-core / emscripten-core/emscripten
Bug: when compiling executable, emcc "forgets" provided needed library
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Reproducing:
```
// src/foo.c
#include
#include
void bar();
void foo() {
printf("Foo \n");
bar();
}
```
```
// src/bar.c
#include
#include
void bar() {
printf("Bar \n");
}
```
```
// src/main.c
void foo();
int main()
{
foo();
return 0;
}
```
Compilation:
```
emcc -o src/bar.o -c -fPIC -DPIC src/bar.c
emcc -o bar.so -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS=_bar src/bar.o
emcc -o src/foo.o -fPIC -DPIC -c src/foo.c
emcc -o foo.so src/foo.o -sEXPORTED_FUNCTIONS=_foo -sSIDE_MODULE=2 bar.so
emcc -o src/main.o -c -fPIC -DPIC src/main.c
emcc -o main src/main.o -sMAIN_MODULE -sFETCH foo.so bar.so
```
This will throw the error:
```
emcc: error: foo.so: shared library dependency not found: `bar.so`
```
Expected: The file should compile without any errors. Since bar.so is
provided.
Contributor guide
Assessment
This issue has not been assessed yet.