Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.24k stars 329 forks source link

FIX: build for emcc 2.0.9 #149

Open erisco opened 3 years ago

erisco commented 3 years ago

FIX: build for emcc 2.0.9, -r linking flag is required and a non-executable file extension to produce object files instead of javascript files

fujinxiang commented 3 years ago

I use erisco:master branch , but still get error

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
sbc100 commented 3 years ago

Do you know who is running nm there? If normal GNU nm tool doesn't works with emscripten since we use wasm object files which GNU tools can't parse.. You would need to use llvm-nm.

fujinxiang commented 3 years ago

I don't konw, I just run make mp4 command in WSL (Ubuntu), this is error info image. error

zbryikt commented 2 years ago

it seems that the error nm: /tmp/ffconf.bMB3JO1u/test.o: file format not recognized didn't affect the final output since I've successfully built while with the error shown.

It should be the error ERROR: libx264 not found that caused the build failure. however x264 should be built by this target: https://github.com/Kagami/ffmpeg.js/blob/d908a4ea3e690fcdc475ed368d42e33a98962206/Makefile#L113

perhaps you didn't fetch the submodules or there's something wrong with that part of Makefile?

1inus commented 2 years ago

I don't konw, I just run make mp4 command in WSL (Ubuntu), this is error info image. error

install pkgconf apt install pkgconf

sbc100 commented 2 years ago

Somewhere in your build system nm is being run directly. emcmake is setting $NM to point to llvm-nm, but if your build system doesn't honor this environment variable and just runs nm directly you will need to fix it.

Aloento commented 2 years ago

I have new problem with em3(latest), could you help me to check it? @sbc100


wasm-ld: error: duplicate symbol: cos
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __cos
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __rem_pio2
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __rem_pio2_large
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __sin
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: floor
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so
sbc100 commented 2 years ago

Can share the full command line used to build both build/opus/dist/lib/libopus.so and build/lame/dist/lib/libmp3lame.so? Those math symbols should not end in these "shared libraries" (they are really just combined object files I this case I assume since are you most like building them with -shared and not with -sSIDE_MODULE, right?)

Aloento commented 2 years ago

Can share the full command line used to build both build/opus/dist/lib/libopus.so and build/lame/dist/lib/libmp3lame.so? Those math symbols should not end in these "shared libraries" (they are really just combined object files I this case I assume since are you most like building them with -shared and not with -sSIDE_MODULE, right?)

Thanks for your reply! Please see here https://github.com/Aloento/ffmpeg.js

The build command for libopus and libmp3lame are same as the Kagami's version and works fine in very old em. The diff is that I added libwebp and removed h264. Now I'm trying to use em2.0.11 to build...

Aloento commented 2 years ago

After trying 2.0.11, I got:

wasm-ld: error: duplicate symbol: cos
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: log
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: exp
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __rem_pio2
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __rem_pio2_large
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __sin
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: __cos
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

wasm-ld: error: duplicate symbol: floor
>>> defined in build/opus/dist/lib/libopus.so
>>> defined in build/lame/dist/lib/libmp3lame.so

Then I tried em2.0.1 and I got ERROR: libwebp >= 0.2.0 not found using pkg-config

Now I'm so confused...

sbc100 commented 2 years ago

Emscripten is in 3.0.1 these days. Can you try with this latest version?

Aloento commented 2 years ago

@sbc100 this is from latest version

When I use the Kagami's em version then I got wasm-ld: error: unknown argument: -rpath

After removed libwebp, still get same errors. And I tried with SIDE_MODULE=1 emcc: error: WASM2JS is not compatible with relocatable output