Comments (13)
In that case I would recommend using -sMAIN_MODULE=2
rather then -sRELOCTABLE
from emscripten.
Can I ask why are you trying to build with -sRELOCATABLE
? Obviously we should fix this, but using that flag directly not common/recommended.
from emscripten.
The reason that _emscripten_thread_exit_joinable
is not available is that that symbol is only defined when -sMAIN_MODULE
is used:
emscripten/src/library_pthread.js
Lines 1155 to 1156 in 7594002
Unfortunetly at the callsite we protect that call with -DEMSCRIPTEN_DYNAMIC_LINKING
which I believe is set whenever -sRELOCTABLE
is used.. so there is a mismatch there:
emscripten/system/lib/pthread/pthread_create.c
Lines 343 to 346 in 7594002
from emscripten.
Can I ask why are you trying to build with
-sRELOCATABLE
? Obviously we should fix this, but using that flag directly not common/recommended.
I am probably a bit confused here, but I am trying to compile a set of static libraries that will be linked into either the main module or the side module. Now these libraries are built via Autoconf and Automake so the build process also includes compiling small test programs to see what features emcc has.
Initially I was just using -fPIC
since I thought that neither -sMAIN_MODULE
or -sSIDE_MODULE
made sense here, but just using -fPIC
alone is not enough to get PIC variants of system libraries from the cache. In order to get the PIC variants, -sRELOCATABLE
has to be set (or set indirectly via -sMAIN_MODULE
or -sSIDE_MODULE
in emcc) to get the correct cache path.
Since I am compiling static libraries, I guess the version of the cache in use doesn't really matter since the static library will never actually be linked against anything in there, but I thought for the configure script compiler tests it would be more correct for those tests to use the system libraries coming from the correct cache path.
from emscripten.
If you are building static libraries that you don't need -fPIC
or MAIN_MODULE
. For autoconf and automake and would recommend disabling dynamic linking completely using --disable-shared
.
from emscripten.
Huh, I thought the code would still need to be compiled with -fPIC
if it is going to be linked into a relocatable module at some point...
from emscripten.
Sure, yes, if you the final output is a MAIN_MODULE or a SIDE_MODULE than yes you would want to build with -fPIC
. Is your final output of those?
from emscripten.
In any case #22110 should fix this particular bug. In the long run I'm still hoping we can remove -sRELOCATBLE
as a link flag since we don't test that mode fully, and I'm not sure what its usefulness is these days.
from emscripten.
Sure, yes, if you the final output is a MAIN_MODULE or a SIDE_MODULE than yes you would want to build with
-fPIC
. Is your final output of those?
Yes, the final output will be either a MAIN_MODULE or SIDE_MODULE, the reason for adding -sRELOCATBLE
is because I want the configure tests to link against the -fPIC
variants of the system libraries since those are the only ones available when using emscripten_cache(flags = ["--pic"])
.
from emscripten.
Sure, yes, if you the final output is a MAIN_MODULE or a SIDE_MODULE than yes you would want to build with
-fPIC
. Is your final output of those?Yes, the final output will be either a MAIN_MODULE or SIDE_MODULE, the reason for adding
-sRELOCATBLE
is because I want the configure tests to link against the-fPIC
variants of the system libraries since those are the only ones available when usingemscripten_cache(flags = ["--pic"])
.
Can't you setup the cache to contains both types of libraries? What if you have a statically linked binary and a dynamically linked binary in the same project?
from emscripten.
Yeah, I was thinking that. Once I get some initial feedback on the direction of that PR, I will investigate calling embuilder multiple times with the different configurations.
from emscripten.
In that case I would recommend using
-sMAIN_MODULE=2
rather then-sRELOCTABLE
This is a decent workaround, but it seems incorrect that by default, if I compile code with -fPIC
, it will link against non--fPIC
system libraries. Perhaps the cache should be checking these flags directly instead of relying on the higher level Emscripten arguments like -sRELOCATABLE
?
from emscripten.
I'm proposing that we drop -sRELOCATABLE
completely... unless you can think of a good use case for it.
from emscripten.
Related Issues (20)
- Problem when compiling code that has symbol collision with WASI API HOT 3
- Question: Using WebGPU without enabled ASYNCIFY flag HOT 11
- ALLOW_MEMORY_GROWTH with PURE_WASI doesn't seems to work
- Outdated OpenJPEG Sources in Emscripten Tests May Lack CVE Fixes HOT 1
- Python `TypeError` when trying to add a `sourceMappingURL` section to a WASM file
- emscripten_receive_on_main_thread_js cannot read properties of undefined(reading apply) HOT 1
- Chromium CI tests are failing flakily, probably due to a race between installing and using port headers
- emsdk/upstream/emscripten/cache/sysroot/include/compat/emmintrin.h is not lib/clang/19/include/**/emmintrin.h HOT 7
- ReferenceError: _setThrew is not defined when linking as C++ HOT 18
- Bug in page: Emscripten Documentation | Small Typo HOT 1
- [Question] How to write unit tests for multithreaded WASM? HOT 3
- undefined symbol: emscripten_compute_dom_pk_code HOT 2
- Cannot compile after switching to 3.1.63 HOT 3
- [BUG]: Incorrect Parameter Order in Promise Constructor Causes Program Errors
- wasm-opt: unknown option '--no-stack-ir' HOT 13
- Unexpected error in system/lib/libcxx/include/__format/format_arg_store.h HOT 2
- Is `--fatal-warnings` too strict for `STRICT` mode? HOT 4
- Met `function signature mismatch` warning and got `RuntimeError: unreachable` in execution HOT 1
- doWritev has a race condition HOT 5
- Unexpected error in system/lib/libcxx/include/__utility/no_destroy.h HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emscripten.