phoboslab / wipeout-rewrite

2.64k stars 212 forks source link

wasm build failed #27

Closed GregLebreton closed 1 year ago

GregLebreton commented 1 year ago

Hi there, try to dockerise to building of the web version but it crashes because of the file race.o Here are the logs (simple make wasm form Linux Debian 11:

greg@lenovo:~/workspace/wipeout-rewrite:(master)$ make wasm                                        
mkdir -p build/wasm                                                                                      
emcc build/obj/wasm/src/wipeout/race.o build/obj/wasm/src/wipeout/camera.o build/obj/wasm/src/wipeout/object.o build/obj/wasm/src/wipeout/droid.o build/obj/wasm/src/wipeout/ui.o build/obj/wasm/src/wipeout/hud.o build/obj/wasm/src/wipeout/image.o build/obj/wasm/src/wipeout/game.o build/obj/wasm/src/wipeout/menu.o build/obj/wasm/src/wipeout/main_menu.o build/obj/wasm/src/wipeout/ingame_menus.o build/obj/wasm/src/wipeout/title.o build/obj/wasm/src/wipeout/intro.o build/obj/wasm/src/wipeout/scene.o build/obj/wasm/src/wipeout/ship.o build/obj/wasm/src/wipeout/ship_ai.o build/obj/wasm/src/wipeout/ship_player.o build/obj/wasm/src/wipeout/track.o build/obj/wasm/src/wipeout/weapon.o build/obj/wasm/src/wipeout/particle.o build/obj/wasm/src/wipeout/sfx.o build/obj/wasm/src/utils.o build/obj/wasm/src/types.o build/obj/wasm/src/system.o build/obj/wasm/src/mem.o build/obj/wasm/src/input.o build/obj/wasm/src/render_gl.o build/obj/wasm/src/platform_sokol.o -o build/wasm/wipeout.js -lGLEW -lGL \
        -s ALLOW_MEMORY_GROWTH=1 \
        -s ENVIRONMENT=web \
        --preload-file wipeout
cache:INFO: generating system library: wasm/libc.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libcompiler_rt.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libcompiler_rt.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libc++-noexcept.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libc++-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libc++abi-noexcept.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libc++abi-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libdlmalloc.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libdlmalloc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libc_rt_wasm.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libc_rt_wasm.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: wasm/libsockets.a... (this will be cached in "/home/greg/.emscripten_cache/wasm/libsockets.a" for subsequent builds)
cache:INFO:  - ok
wasm-ld: error: unknown file type: build/obj/wasm/src/wipeout/race.o
emcc: error: '/usr/bin/wasm-ld -o build/wasm/wipeout.wasm build/obj/wasm/src/wipeout/race.o -L/usr/share/emscripten/system/local/lib build/obj/wasm/src/wipeout/camera.o -L/usr/share/emscripten/system/lib build/obj/wasm/src/wipeout/object.o -L/home/greg/.emscripten_cache/wasm build/obj/wasm/src/wipeout/droid.o build/obj/wasm/src/wipeout/ui.o build/obj/wasm/src/wipeout/hud.o build/obj/wasm/src/wipeout/image.o build/obj/wasm/src/wipeout/game.o build/obj/wasm/src/wipeout/menu.o build/obj/wasm/src/wipeout/main_menu.o build/obj/wasm/src/wipeout/ingame_menus.o build/obj/wasm/src/wipeout/title.o build/obj/wasm/src/wipeout/intro.o build/obj/wasm/src/wipeout/scene.o build/obj/wasm/src/wipeout/ship.o build/obj/wasm/src/wipeout/ship_ai.o build/obj/wasm/src/wipeout/ship_player.o build/obj/wasm/src/wipeout/track.o build/obj/wasm/src/wipeout/weapon.o build/obj/wasm/src/wipeout/particle.o build/obj/wasm/src/wipeout/sfx.o build/obj/wasm/src/utils.o build/obj/wasm/src/types.o build/obj/wasm/src/system.o build/obj/wasm/src/mem.o build/obj/wasm/src/input.o build/obj/wasm/src/render_gl.o build/obj/wasm/src/platform_sokol.o /home/greg/.emscripten_cache/wasm/libc.a /home/greg/.emscripten_cache/wasm/libcompiler_rt.a /home/greg/.emscripten_cache/wasm/libc++-noexcept.a /home/greg/.emscripten_cache/wasm/libc++abi-noexcept.a /home/greg/.emscripten_cache/wasm/libdlmalloc.a /home/greg/.emscripten_cache/wasm/libc_rt_wasm.a /home/greg/.emscripten_cache/wasm/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export-table --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location --export malloc --export free -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=2147483648 --global-base=1024' failed (1)
make: *** [Makefile:148 : wasm_full] Erreur 1

Great project by the way! Is it possible to make the MEMORY_HUNK higher for upscaled textures loading for example ? ;)

phoboslab commented 1 year ago

What's your emscripten version? Can you try to update?

Is it possible to make the MEMORY_HUNK higher for upscaled textures loading for example ? ;)

Yes.

GregLebreton commented 1 year ago

emscripten version: 2.0.12 Build passes after updating the project (git pull), Thanks. About the MEMORY_HUNK extension, it would be to play the remake of the intro video (https://www.youtube.com/watch?v=dq1GbE4f5yw) I reencoded the video in MPEG but it crashes due to lack of MEMORY_HUNK. I loved Wipeout and I respect your job for keeping the code true to the base game, really! But I would like to play it full HD resolution with upscaled textures!

phoboslab commented 1 year ago

Cool video; haven't seen that before!

You can specify the size of the hunk here. It's currently set to 4 MB. Very little for a modern game, but enough for Wipeout.

plmpeg needs to allocate 3 pictures (in YUV) + the rgba framebuffer. Should be about 8 MB (+ what the rest of the game needs); I'd try 16 MB, but setting MEM_HUNK_BYTES to up to 4 GB shouldn't be a problem either.

Edit: as for textures: we currently don't have a mechanism to load anything else than the compressed TIM files (.cmp) from the original game. Also, we don't have upscaled textures :]

GregLebreton commented 1 year ago

I try 16 MB and 4096 MB, it compiles, but crashes when launching ./wipegame:

inserted atlas texture ( 32x 32) at ( 45, 14)
load: wipeout/common/rock.prm
load: wipeout/common/mine.prm
load: wipeout/common/miss.prm
load: wipeout/common/shld.prm
load: wipeout/common/shld.prm
load: wipeout/common/ebolt.prm
open music track 5
Abort at "src/mem.c" line 26: Failed to allocate 9400320 bytes in hunk mem

For the upscaled textures, I can make them, if the game can handle them...

GregLebreton commented 1 year ago

Wasm build ok