Open Honya2000 opened 1 year ago
Rolled back to 3.1.45 - throws the same error: attempt to add bitcode file after LTO.
P.S. Once again have to use 3.1.41
Thanks for the report @Honya2000. The issue looks like another occurrence of a similar issue but not identical to #19781 so I'm glad you opened a separate one.
We need to figure out why symbol is causing proxying_legacy.o
to be pulled in after LTO takes place. Normally its a compile-time generated symbol.
In the mean time does the workaround of not linking -flto
work for you? You can just use -flto
at compile time to get most of the benefits of LTO.
Hopefully once this change makes it into a release you should see a more informative error message: https://github.com/llvm/llvm-project/pull/66688
Any updates regarding the issue?
Tried again 3.1.46 and it still reports the same error: wasm-ld: error: C:\Projects\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libc-mt.a(proxying_legacy.o): attempt to add bitcode file after LTO.
3.1.41 is linking fine, all next versions are failing with different errors...
My commands for cmake look like this: set(CMAKE_CXX_FLAGS "-flto -frtti -O3 -DNDEBUG -s USE_SDL=2 --bind") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --bind -s WASM=1 -O3 -s EXPORT_NAME=Module -s INITIAL_MEMORY=1073741824 -s ALLOW_MEMORY_GROWTH=1 -frtti -s USE_SDL=2 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s USE_WEBGL2=1")
if (EM_MULTITHREADED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_BLOCKING_ON_MAIN_THREAD=1 -pthread -s USE_PTHREADS=1") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_BLOCKING_ON_MAIN_THREAD=1 -s ENVIRONMENT=web,worker -pthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4") else() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ENVIRONMENT=web") endif()
So i'm not using lto in the linker command line explicitly.
But build.ninja file has it in the linker for some reason.
But anyway can we please make it working even with linker lto???
Want to remind that proxying_legacy.c - is not existing in 3.1.41. It appeared recently in the runtime libs.
Btw build.ninja has this linker command:
#############################################
build Release/bin/tmrwRooms.js: CXX_EXECUTABLE_LINKER__tmrwRooms_Release TmrwApplications/src/roomsExplorer/CMakeFiles/tmrwRooms.dir/Platform/Wasm/wasmApp.cpp.o ... ... FLAGS = -flto -frtti -O3 -DNDEBUG -s USE_SDL=2 --bind -s ALLOW_BLOCKING_ON_MAIN_THREAD=1 -pthread -s USE_PTHREADS=1 -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fvisibility=hidden -fcolor-diagnostics -O3 -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections LINK_FLAGS = --bind -s WASM=1 -O3 -s EXPORT_NAME=Module -s INITIAL_MEMORY=1073741824 -s ALLOW_MEMORY_GROWTH=1 -frtti -s USE_SDL=2 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s USE_WEBGL2=1 -s ALLOW_BLOCKING_ON_MAIN_THREAD=1 -s ENVIRONMENT=web,worker -pthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -s EXPORTED_RUNTIME_METHODS=['ccall','cwrap','onLoadURL','AsciiToString'] --preload-file C:/Projects/TMRW/RoomGit/tmrwNative/assets/wasm/assets@assets --js-library C:/Projects/TMRW/RoomGit/tmrwNative/assets/wasm/nativeBridge.js -s USE_WEBGL2=1
So there are FLAGS and LINK_FLAGS there. Not sure why FLAGS are part of linker build command! But as you can see LINK_FLAGS doesn't have -flto command.
P.S. If i remove -flto from FLAGS manually - the linking works fine.
@Honya2000, could you try again after install the current tot emsdk build (./emsdk install tot
) . I'm hoping that will make the error message a little more informative (due to https://github.com/llvm/llvm-project/pull/66688). Please re-post the updated error message.
i updated emsk with ./emsdk install tot.
It reports the same error, but in another file now...
wasm-ld: error: C:\Projects\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libhtml5.a(callback.o): attempt to add bitcode file after LTO (_emscripten_run_callback_on_thread)
I think this is likely same issue as #16836
Any updates regarding the issue? For me still last working version remain 3.1.41. All further emsdk versions failing with different errors.
Latest emsdk 3.1.47 throws error: wasm-ld: error: C:\Projects\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libhtml5.a(callback.o): attempt to add bitcode file after LTO (_emscripten_run_callback_on_thread)
Just got 3.1.51 emsdk, The issue is still there. The same linking error for the builds with lto + pthreads.
Just got 3.1.51 emsdk, The issue is still there. The same linking error for the builds with lto + pthreads.
Got the same issue with 3.1.51 emsdk.
\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libhtml5.a(callback.o): attempt to add bitcode file after LTO (_emscripten_run_callback_on_thread)
\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libc-mt-debug.a(htonl.o): attempt to add bitcode file after LTO (htonl)
I think I have fix for this on the llvm side: https://github.com/llvm/llvm-project/pull/101894
Hello,
Recently i posted the bug, that i cannot use any emsdk versions after 3.1.41. https://github.com/emscripten-core/emscripten/issues/19781
The issue was closed apparently. So today i tried to install new emsdk 3.1.46. And unfortunatelly it still fails... But with another error:
wasm-ld: error: C:\Projects\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libc-mt-debug.a(proxying_legacy.o): attempt to add bitcode file after LTO (single-threaded project - compiled, multi-threaded - fails).
Before 3.1.41 i updated emsdk for about 3 years and it was almost never fail for me compiling the project. But now I cannot upgrade to new emsdk since over 2 month.
Any thoughts how to fix the issue?