When I try to compile FFmpeg to WebAssebly I got wasm-ld-13: error: unknown file type: demux.o, I configure and install FFmpeg (ffmpeg-8.0) using:
emconfigure ./configure \
--prefix=$(pwd)/installed \
--enable-cross-compile \
--target-os=none \
--arch=x86 \
--cpu=generic \
--disable-x86asm \
--disable-inline-asm \
--disable-programs \
--disable-doc \
--disable-debug \
--disable-network \
--disable-autodetect
emmake make -j$(nproc)
emmake make install
And I compile my c++ code using:
em++ main.cpp -o output.html \
-I/home/example/ffmpeg-8.0/installed/include \
-L/home/example/ffmpeg-8.0/installed/lib \
-lavcodec -lavformat -lavutil
wasm-ld-13: error: unknown file type: demux.o
em++: error: '/usr/bin/wasm-ld-13 -o output.wasm /tmp/emscripten_temp_sx9gslhu/main_0.o -L/home/example/ffmpeg-8.0/installed/lib /home/example/ffmpeg-8.0/installed/lib/libavcodec.a /home/example/ffmpeg-8.0/installed/lib/libavformat.a /home/example/ffmpeg-8.0/installed/lib/libavutil.a -L/usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__stdio_exit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1)
I know that one of the best options is using Docker, but I want to do it without Docker on my Ubuntu machine.
The version of the installed em++ is:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.5 ()