As of today the wasm-ld linker only supports undefined symbols if they are function symbols. As you can see from the error message the error all relate to data symbols (in this case vtable and typinfo data symbols). This is because, for function symbols, it is able to include a function import in place of the undefined symbol allowing it to be undefined at link time and yet defined at runtime. For data symbols there is no logical equivalent. The best the linker can do is write a zero (or some other constant) in the place of the undefined symbol's address.
I am curious what the native linker does when in order to handle a reference to an undefined data symbol. I'm assuming it writes zeros, but I would guess that would result in a program that would crash as soon as one of those symbols was accessed? I'll take a look to see if I can do the same thing in wasm-ld that the native linker would do. How does the program in question end up being linked into something that doesn't crash? cheers, sam On Sun, Apr 26, 2020 at 8:16 PM Александр Гурьянов <[email protected]> wrote: > *I can't compile it, even with -s ERROR_ON_UNDEFINED_SYMBOLS=0 > > пн, 27 апр. 2020 г. в 10:15, Александр Гурьянов <[email protected]>: > > > > Hi. I have old project that was compiled with fastcomp. Now I updated > > it to upstream, but I have error on link stage. > > ``` > > wasm-ld: error: CMakeFiles/bin-obj.dir/AppDelegate.cpp.o: undefined > > symbol: typeinfo for EditorScene > > wasm-ld: error: CMakeFiles/bin-obj.dir/IAP/IAPManager.cpp.o: undefined > > symbol: vtable for IAPPlatformDummy > > wasm-ld: error: CMakeFiles/bin-obj.dir/IAP/IAPManager.cpp.o: undefined > > symbol: typeinfo for OnlineLevelListScene > > wasm-ld: error: CMakeFiles/bin-obj.dir/IAP/IAPManager.cpp.o: undefined > > symbol: typeinfo for CommunityScene > > wasm-ld: error: CMakeFiles/bin-obj.dir/Scenes/SocialLayer.cpp.o: > > undefined symbol: typeinfo for OnlineLevelListLayer > > ... > > wasm-ld: error: too many errors emitted, stopping now (use > > -error-limit=0 to see all errors) > > shared:ERROR: '/home/caiiiycuk/sdk/emsdk/upstream/bin/wasm-ld > > @/tmp/emscripten_ricuunpu.rsp' failed (1) > > ``` > > > > This project have a lot of undefined symbols, and it's ok. For native > > I can successfully compile it with > > ``` > > set(CMAKE_EXE_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-all") > > ``` > > > > And it works fine. For web I used fastcomp with -s > > ERROR_ON_UNDEFINED_SYMBOLS=0 and it works fine. > > But now, I can compile it, event with -s ERROR_ON_UNDEFINED_SYMBOLS=0 > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVGPWSd7%2ByPVAhBMB3rh8Y1P3vGHRvAx7ey6aG6R_Nob0Q%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va29mzvH2e%2BfD2uuyDbgBOkcyxscKDMUsB%2BLAQZJ9-3KAag%40mail.gmail.com.
