Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erisco opened this issue Nov 22, 2020 · 5 comments
Closed

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

erisco opened this issue Nov 22, 2020 · 5 comments

Comments

@erisco
Copy link

erisco commented Nov 22, 2020

$ 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:

  • Moving the argument earlier and later in the list
  • Different optimisation levels
  • Removing -s WASM_ASYNC_COMPILATION=0
@erisco
Copy link
Author

erisco commented Nov 22, 2020

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.

#149

@erisco erisco closed this as completed Nov 22, 2020
@fujinxiang
Copy link

fujinxiang commented Nov 27, 2020

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
Copy link

aisnote commented Aug 23, 2022

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
Copy link

jimbojw commented Dec 8, 2022

Same question. Anyone know what to do here?

@Adonis-Song
Copy link

#149 this patch fix this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants