Optimized release build in emsdk

798 views
Skip to first unread message

Derek Schuff

unread,
May 4, 2021, 8:27:12 PM5/4/21
to emscripten-discuss
Hi emscripten users,
Emscripten version 2.0.19 has just been released in emsdk. You can install it in the usual way (e.g.  ./emsdk install 2.0.19). 
But this time we are also testing a new release build using higher optimization levels. We intend to make it the default soon, but because the build process is slightly different, we're hoping some of you can try it out first. If you install the '2.0.19-lto' tag (instead of 2.0.19) you'll get the optimized build. Please try it out and let us know if you experience issues (or if you see meaningful compile or link performance gains).
Thanks!
-Derek

Floh

unread,
May 6, 2021, 11:04:38 AM5/6/21
to emscripten-discuss
I'm getting a warning both in em++ and emcc after the upgrade for each source file:

em++: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]

emcc: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]

This is used in the command line switch "-s ASSERTIONS=0", and the host system is macOS.

Looking into settings.js, the ASSERTIONS settings variable is still there, so I'm not sure what would cause the warning.

Isn't the ASSERTIONS options needed for compilation of regular object files, not just in the linker step?

This is a verbose command line as example:

[4/17] /Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/em++  -I/Users/floh/projects/chips -I/Users/floh/projects/fips-imgui/imgui -I/Users/floh/projects/sokol -I/Users/floh/projects/sokol/util -s DISABLE_EXCEPTION_CATCHING=1  -fno-exceptions -fno-rtti -std=c++11 -fstrict-aliasing -Wall -Wno-multichar -Wextra -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue -Wno-inconsistent-missing-override -Wno-warn-absolute-paths -Wno-expansion-to-defined  -flto -s ASSERTIONS=0 -O3 -DNDEBUG -Wno-type-limits -Wno-missing-field-initializers -std=gnu++11 -MD -MT fips-imgui_imgui/CMakeFiles/imgui.dir/imgui/imgui_tables.cpp.obj -MF fips-imgui_imgui/CMakeFiles/imgui.dir/imgui/imgui_tables.cpp.obj.d -o fips-imgui_imgui/CMakeFiles/imgui.dir/imgui/imgui_tables.cpp.obj -c /Users/floh/projects/fips-imgui/imgui/imgui_tables.cpp
em++: warning: linker setting ignored during compilation: 'ASSERTIONS' [-Wunused-command-line-argument]

Otherwise no obvious problems. The wasm file got a bit bigger, from 623KB to 641KB, but in this case the previous WASM is from mid-January, so this might also be attributes to LLVM updates.

Is the LTO about the build tools being compiled with LTO enabled, or about Emscripten release build enabling LTO by default? (I always had LTO enabled, so I wouldn't expect much difference in runtime performance), in either case build times and runtime performance seems to be about the same for me.

I'll check previous SDK versions now to see when this ASSERTIONS warning first appeared.

Cheers,
-Floh.

Floh

unread,
May 6, 2021, 11:19:25 AM5/6/21
to emscripten-discuss
Ok, that ASSERTION warning is new in 2.0.19, 2.0.18 is still fine.

The slight size increase must have happened in an earlier version, from 2.0.18 to 2.0.19 it's expected "noise":

2.0.18: 640 KB

2.0.19: 641 KB

Sam Clegg

unread,
May 6, 2021, 11:37:30 AM5/6/21
to emscripte...@googlegroups.com
I landed a change as part of 2.0.19 that started reporting warning for link-time-only settings used during compilation.  There some oversights (false positives) that I'm trying to correct today and release 2.0.20:  https://github.com/emscripten-core/emscripten/pull/14104

Part of the reason for doing this is to clear up some of the confusion around which settings are for the compiler and which are for the linker, not just in the user community but also within the emscripten codebase itself.

Case in point, the ASSERTIONS setting is indeed a link-only setting, so passing it during compilation has no effect.   If you look at settings.js you can see its already marked with `// [link]` to signal this.  

Hopefully this isn't too annoying to folks and those who want to continue to pass all their link flags during compilation can add `-Wno-unused-command-line-argument` (just like they would need to with clang to avoid such warnings).   

cheers,
sam

--
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 emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/05c8f044-eb12-47c7-aafe-5b103c39cebdn%40googlegroups.com.

Floh

unread,
May 6, 2021, 11:56:09 AM5/6/21
to emscripten-discuss
> Case in point, the ASSERTIONS setting is indeed a link-only setting, so passing it during compilation has no effect.   If you look at settings.js you can see its already marked with `// [link]` to signal this.  

Oops, interesting, well in that case the warning did exactly what it's supposed to do, good work :) I'll fix my build scripts.

Floh

unread,
May 6, 2021, 12:01:19 PM5/6/21
to emscripten-discuss
PS:

> those who want to continue to pass all their link flags during compilation...

At first I thought cmake might be the reason, because compiler options (CMAKE_C_FLAGS and CMAKE_CXX_FLAGS) are also passed to the linker, and then linker-only options (CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS) are just appended.

So linker-only options work fine with cmake, but "compile-only" options would be a problem (if those even exist).

Sam Clegg

unread,
May 6, 2021, 1:37:56 PM5/6/21
to emscripte...@googlegroups.com
Yeah we currently only report when linker-only flags are used during compilation.  We don't currently track compiler-only flags used during linking.

Anyway this seems to have caused enough disturbance that we are going to revert this new warning and release 2.0.20 today if we can.. then try to re-land it later.

cheers,
sam

Reply all
Reply to author
Forward
0 new messages