You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not 100% sure what the problem is but emcc 6.0.0 works fine for me if I revert #25930. The problem is that -Bstatic is passed when I'm trying to link a static library.
I think the problem is that the condition here is wrong:
ifsettings.FAKE_DYLIBSor (notsettings.MAIN_MODULEandnotsettings.SIDE_MODULE):
cmd.append('-Bstatic')
else:
# wasm-ld still defaults to static linking by default. If that ever changes, we can remove this line.cmd.append('-Bdynamic')
Do you know why passing -Bstatic would be a problem when linking a static library? Are you passing either -Bstatic or -Bdynamic yourself, or are we just talking about the internal injection of these flags?
It's trying to link a shared library into a static library and failing. Either they should both be dynamic or both be static and I'm not sure which. Perhaps it involves some strange combination of flags which work on more standard linkers.
Do you want what the intent of the build is? Maybe you should share the full build command that is being used to build this library (either the emcc or the host version).
I'm a little confused what you mean by "trying to link a shared library into a static library and failing" since static libraries are not linked at all using emcc right? They use emar
Reverting that one change makes it work as before:
- if settings.LINKABLE and (settings.FAKE_DYLIBS or not settings.SIDE_MODULE):+ if settings.LINKABLE:
args.insert(0, '--whole-archive')
args.append('--no-whole-archive')
Activity
hoodmane commentedon Jul 22, 2026
Maybe it should be:
hoodmane commentedon Jul 22, 2026
Well this patch:
fixes the build but it still breaks at runtime.
sbc100 commentedon Jul 22, 2026
Do you know why passing
-Bstaticwould be a problem when linking a static library? Are you passing either-Bstaticor-Bdynamicyourself, or are we just talking about the internal injection of these flags?hoodmane commentedon Jul 24, 2026
It's trying to link a shared library into a static library and failing. Either they should both be dynamic or both be static and I'm not sure which. Perhaps it involves some strange combination of flags which work on more standard linkers.
sbc100 commentedon Jul 24, 2026
Do you want what the intent of the build is? Maybe you should share the full build command that is being used to build this library (either the emcc or the host version).
I'm a little confused what you mean by "trying to link a shared library into a static library and failing" since static libraries are not linked at all using emcc right? They use emar
hoodmane commentedon Jul 28, 2026
Apparently I misunderstood the issue, binary searching the diff shows that the problem is that it was passing
--whole-archivebefore and now it's not. It's this one line that causes the problem:https://github.com/emscripten-core/emscripten/pull/25930/changes#diff-e6615de4338b98e08471c53f2d6fc250dc6ca22cd8c303ac33ab259c18ae68d2R288
Reverting that one change makes it work as before:
hoodmane commentedon Jul 28, 2026
I think it maybe should read:
because I think
SIDE_MODULE=1is supposed to imply--whole-archivebut it seems like it doesn't anymore?hoodmane commentedon Jul 28, 2026
Okay opened a PR with that.
[dylink] Restore `--whole-archive` when linking with `-sSIDE_MODULE=1`
[dylink] Restore `--whole-archive` when linking with `-sSIDE_MODULE=1`
[dylink] Restore `--whole-archive` when linking with `-sSIDE_MODULE=1`
[dylink] Restore `--whole-archive` when linking with `-sSIDE_MODULE=1`