Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.29k stars 335 forks source link

wasm-ld: error: unknown file type: build/ffmpeg-webm/ffmpeg.bc #148

Closed erisco closed 3 years ago

erisco commented 3 years ago
$ make ffmpeg-webm.js
emcc build/ffmpeg-webm/ffmpeg.bc build/opus/dist/lib/libopus.so build/libvpx/dist/lib/libvpx.so \
        --post-js build/post-sync.js \
        -O3 --closure 1 --memory-init-file 0 -s WASM=0 -s WASM_ASYNC_COMPILATION=0 -s ASSERTIONS=0 -s EXIT_RUNTIME=1 -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 -s TOTAL_MEMORY=67108864 -lnodefs.js -lworkerfs.js --pre-js build/pre.js -o ffmpeg-webm.js
wasm-ld: error: unknown file type: build/ffmpeg-webm/ffmpeg.bc
emcc: error: '/mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/bin/wasm-ld -o ffmpeg-webm.wasm build/ffmpeg-webm/ffmpeg.bc build/opus/dist/lib/libopus.so build/libvpx/dist/lib/libvpx.so -L/mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libc.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libcompiler_rt.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libc++-noexcept.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libc++abi-noexcept.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libdlmalloc.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libpthread_stub.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libc_rt_wasm.a /mnt/c/Users/erisco/Documents/cpp/emsdk/upstream/emscripten/cache/wasm/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --import-memory --strip-debug --export-table --export main --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location --export malloc --export free --export setThrew --export realloc --export testSetjmp --export saveSetjmp -z stack-size=5242880 --initial-memory=67108864 --no-entry --max-memory=67108864 --global-base=1024' failed (1)
Makefile:233: recipe for target 'ffmpeg-webm.js' failed
make: *** [ffmpeg-webm.js] Error 1
$ emcc --version
emcc (Emscripten gcc/clang-like replacement) 2.0.9 (59aedd441c317b7064146d4d888eab272e92dd03)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It seems to me like emcc is trying to build ffmpeg.bc as WASM even though -s WASM=0 is set. I have tried:

erisco commented 3 years ago

Turns out, wasm-ld is expected to be called even with WASM=0, but ffmpeg.bc was not expected to be a JavaScript file.

There was some change to emcc. To produce an object file, the -r linking flag is required and the output file must have a non-executable extension.

Thanks to sbc on the WebAssembly channel on Discord for the help on this.

https://github.com/Kagami/ffmpeg.js/pull/149

fujinxiang commented 3 years ago

still get error like this:

nm: /tmp/ffconf.bMB3JO1u/test.o: file format not recognized ERROR: libx264 not found

If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem. make: *** [Makefile:203: build/ffmpeg-mp4/ffmpeg.bc] Error 1

@erisco do you know why?

aisnote commented 2 years ago

so, what's the final solution? anyone help? I meet the same issue.

wasm-ld: error: unknown file type: build/ffmpeg-webm/ffmpeg.bc

build/ffmpeg-mp4/ffmpeg.bc: $(MP4_SHARED_DEPS)
    cd build/ffmpeg-mp4 && \
    EM_PKG_CONFIG_PATH=$(FFMPEG_MP4_PC_PATH) emconfigure ./configure \
        $(FFMPEG_COMMON_ARGS) \
        $(addprefix --enable-encoder=,$(MP4_ENCODERS)) \
        $(addprefix --enable-muxer=,$(MP4_MUXERS)) \
        --enable-gpl \
        --enable-libmp3lame \
        --enable-libx264 \
        --extra-cflags="-s USE_ZLIB=1 -I../lame/dist/include" \
        --extra-ldflags="-L../lame/dist/lib" \
        && \
    emmake make -j EXESUF=.bc && \
    cp ffmpeg ffmpeg.bc

I already put the exesuf=.bc there

jimbojw commented 1 year ago

Same question. Anyone know what to do here?

Adonis-Song commented 1 year ago

https://github.com/Kagami/ffmpeg.js/pull/149 this patch fix this issue