libretro / libretro/RetroArch

[Emscripten] "Legalize cannot Expand SINT_TO_FP for i64 yet" failure with buildbot

Open
#13,263 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform: emscripten
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

In reference to https://github.com/libretro/FBNeo/issues/938, the current emscripten buildbot can't handle the FBNeo core.

It fails to build with the following error :

clang-10: /b/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2418: llvm::SDValue (anonymous namespace)::SelectionDAGLegalize::ExpandLegalINT_TO_FP(llvm::SDNode *, llvm::SDValue &): Assertion `!isSigned && "Legalize cannot Expand SINT_TO_FP for i64 yet"' failed.
Stack dump:
0.	Program arguments: /opt/emsdk/upstream/bin/clang-10 -cc1 -triple wasm32-unknown-emscripten -emit-obj -disable-free -main-file-name pokey.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=none -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -frounding-math -ffinite-math-only -masm-verbose -mconstructor-aliases -target-cpu generic -fvisibility hidden -dwarf-column-info -debugger-tuning=gdb -resource-dir /opt/emsdk/upstream/lib/clang/10.0.0 -D __EMSCRIPTEN_major__=1 -D __EMSCRIPTEN_minor__=39 -D __EMSCRIPTEN_tiny__=5 -D _LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -D GIT_VERSION=" 1c93f8a" -D NDEBUG -D EXTERNAL_ZLIB -D INCLUDE_7Z_SUPPORT -D _7ZIP_PPMD_SUPPPORT -D _7ZIP_ST -D __LIBRETRO__ -D NO_VIZ -D _LARGEFILE64_SOURCE=0 -D _FILE_OFFSET_BITS=32 -D LSB_FIRST -D USE_SPEEDHACKS -I ../../burner/win32 -I ../../burner/libretro/libretro-common/include -I ../../burner/libretro -I ../../burn -I ../../cpu -I ../../burn/snd -I ../../burn/devices -I ../../intf -I ../../intf/input -I ../../intf/cd -I ../../intf/audio -I ../../burner -I ../../cpu -I ../../cpu/f8 -I ../../cpu/i8039 -I ../../cpu/i8051 -I ../../cpu/i8x41 -I ../../cpu/m377 -I ../../cpu/m6805 -I ../../cpu/tlcs900 -I ../../cpu/tms32010 -I ../../cpu/upd7725 -I ../../cpu/upd7810 -I ../../cpu/v60 -I ../../cpu/z80 -I ../../cpu/z180 -I ../../dep/libs/zlib -I ../../dep/libs/lib7z -I ../../burn/drv/capcom -I ../../burn/drv/konami -I ../../burn/drv/dataeast -I ../../burn/drv/cave -I ../../burn/drv/neogeo -I ../../burn/drv/psikyo -I ../../burn/drv/sega -I ../../burn/drv/toaplan -I ../../burn/drv/taito -I ../../burn/drv/irem -I ../../burn/drv/pce -I ../../dep/generated -I ../../dep/libs -I ../../burner/libretro/deps/ugui -D EMSCRIPTEN -internal-isystem /include/wasm32-emscripten/c++/v1 -internal-isystem /include/c++/v1 -internal-isystem /opt/emsdk/upstream/lib/clang/10.0.0/include -internal-isystem /include/wasm32-emscripten -internal-isystem /include -O3 -Werror=implicit-function-declaration -Wall -W -Wshadow -Wno-long-long -Wno-write-strings -Wunknown-pragmas -Wundef -Wno-conversion -Wno-missing-braces -Wno-multichar -Wuninitialized -Wpointer-arith -Wno-inline -Wno-unused-value -Wno-sequence-point -Wno-extra -Wno-strict-aliasing -Wno-write-strings -Wno-address -Wno-unused-but-set-variable -Wno-narrowing -Wno-pedantic -pedantic -std=gnu++98 -fdeprecated-macro -fdebug-compilation-dir /builds/libretro/FBNeo/src/burner/libretro -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fno-common -fdiagnostics-show-option -vectorize-loops -vectorize-slp -nostdsysteminc -isystem/opt/emsdk/upstream/emscripten/system/include/libcxx -isystem/opt/emsdk/upstream/emscripten/system/lib/libcxxabi/include -isystem/opt/emsdk/upstream/emscripten/system/include/compat -isystem/opt/emsdk/upstream/emscripten/system/include -isystem/opt/emsdk/upstream/emscripten/system/include/libc -isystem/opt/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten -isystem/opt/emsdk/upstream/emscripten/system/local/include -isystem/builds/libretro/FBNeo/.cache/emscripten/wasm-obj/include -isystem/opt/emsdk/upstream/emscripten/system/include/SDL -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o ../../burn/snd/pokey.o -x c++ ../../burn/snd/pokey.cpp 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '../../burn/snd/pokey.cpp'.
4.	Running pass 'WebAssembly Instruction Selection' on function '@_Z16pokey_register_rii'

I saw some references to that "Legalize cannot Expand SINT_TO_FP for i64 yet" failed assertion on internet, it seems to be a common issue with clang-10 and some targets, and upgrading to clang-11 has apparently fixed this issue for those targets.

Switching to the latest emscripten sdk (clang-14 based ?) was tested this week, it fixed the build but broke the runtime for all of emscripten retroarch, so for now it was reverted to clang-10 and FBNeo was removed from that buildbot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Emscripten build failure while compiling burn/snd/pokey.cpp with the clang-10-based SDK described in the stack trace. Compare the latest Emscripten SDK as a possible direction, then verify both that the FBNeo build succeeds and that the change does not reproduce the reported runtime breakage across Emscripten RetroArch.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, wasm
Domain
build-system, ci-cd, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.