Open allsey87 opened 2 weeks ago
Yes, this is an issue with -sMAIN_MODULE=1
.
While we should fix this issue, I would also strongly recommend against using -sMAIN_MODULE=1
since it includes all symbols from all libraries and doesn't do any dead code elimination. If you can switch to -sMAIN_MODULE=2
that would solve this issue, and give you much smaller payloads.
Indeed, however in this case I am compiling CPython and I think it is hard (impossible?) to know what functions will be needed by the imported modules.
Are you working on pyodide? Or is this a separate CPython effort?
A separate project that integrates CPython into a larger system
If possible I would strongly advise against using -sMAIN_MODULE=2
and instead trying to come up with some sore of reasonable subset of symbols that your side modules have access to. I assume that dynamically loading side modules is hard requirement for you?
Fixing this particular issue is kind of pain due to the way that -sMAIN_MODULE
wraps everything in -Wl,--whole-archive
. I'll see if we can some up with reasonable fix though.
So I don't need this issue fixed for my project, I am reporting it more because perhaps someone else can save themselves 5-10 minutes by just googling "emscripten __vfprintf_internal duplicate symbol" or something like that.
Version of emscripten/emsdk:
Failing command line in full:
emcc test.c -sPRINTF_LONG_DOUBLE=1 -sMAIN_MODULE
Contents of test.c:
Full link command and output with
-v
appended: