Commit e8eaa01
authored
Fix linking SIDE_MODULE with ports (#26514)
With the removal of the RELOCATABLE flag
(cfb4642),
building side module with ports are not working correctly because of 1)
`-fPIC` flag missing when building ports, and 2) `pic` directory not
correctly passed when calculating the libdir.
Without this, building a side module that links to the port library
fails with the following error:
```c
// dummy.c
#include <emscripten/emscripten.h>
#include <jpeglib.h>
EMSCRIPTEN_KEEPALIVE
int dummy_libjpeg_smoke_test(void) {
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return 0;
}
```
```
$ emcc dummy.c -o dummy.wasm -s USE_LIBJPEG=1 -s SIDE_MODULE=1 -ljpeg
wasm-ld: error: /home/siha/dev/temp/emscripten-regression/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libjpeg.a(jdinput.c.o): relocation R_WASM_TABLE_INDEX_SLEB cannot be used against symbol `finish_input_pass`; recompile with -fPIC
wasm-ld: error: /home/siha/dev/temp/emscripten-regression/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libjpeg.a(jdinput.c.o): relocation R_WASM_TABLE_INDEX_SLEB cannot be used against symbol `start_input_pass`; recompile with -fPIC
wasm-ld: error: /home/siha/dev/temp/emscripten-regression/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libjpeg.a(jdinput.c.o): relocation R_WASM_TABLE_INDEX_SLEB cannot be used against symbol `reset_input_controller`; recompile with -fPIC
wasm-ld: error: /home/siha/dev/temp/emscripten-regression/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libjpeg.a(jdinput.c.o): relocation R_WASM_TABLE_INDEX_SLEB cannot be used against symbol `consume_markers`; recompile with -fPIC
```1 parent 1aa7fb5 commit e8eaa01
3 files changed
Lines changed: 38 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2559 | 2559 | | |
2560 | 2560 | | |
2561 | 2561 | | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
2562 | 2598 | | |
2563 | 2599 | | |
2564 | 2600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments