xiph / theora

Reference implementation of the Theora video compression format.
https://theora.org/
Other
98 stars 66 forks source link

Building with emscripten leads to "OC_FZIG_ZAG: symbol multiply defined" error #8

Closed jfizz closed 5 years ago

jfizz commented 5 years ago

I am trying to build ffmpeg (with theora encoding support) using emscripten but am running into the following error (from ffmpeg config.log file):

require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
check_lib libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
check_func_headers theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
test_ld cc -ltheoraenc -ltheoradec -logg
test_cc
BEGIN /tmp/ffconf.P64tf3xZ/test.c
    1   #include <theora/theoraenc.h>
    2   #include <stdint.h>
    3   long check_th_info_init(void) { return (long) th_info_init; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_th_info_init) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.P64tf3xZ/test.c
emcc -I/root/ffmpeg-wasm/lib/ogg/dist/include -I/root/ffmpeg-wasm/lib/vorbis/dist/include -I/root/ffmpeg-wasm/lib/theora/dist/include -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -std=c11 -fomit-frame-pointer -c -o /tmp/ffconf.P64tf3xZ/test.o /tmp/ffconf.P64tf3xZ/test.c
emcc -L/root/ffmpeg-wasm/lib/ogg/dist/lib -L/root/ffmpeg-wasm/lib/vorbis/dist/lib -L/root/ffmpeg-wasm/lib/theora/dist/lib -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.P64tf3xZ/test /tmp/ffconf.P64tf3xZ/test.o -ltheoraenc -ltheoradec -logg
error: Linking globals named 'OC_FZIG_ZAG': symbol multiply defined!
shared:ERROR: Failed to run llvm optimizations:
ERROR: libtheora not found

which appears to be related to libtheoraenc.so and libtheoradec.so both containing OC_FZIG_ZAG:

> llvm-nm libtheoraenc.so | grep "OC_FZIG_ZAG"
-------- D OC_FZIG_ZAG
> llvm-nm libtheoradec.so | grep "OC_FZIG_ZAG"
-------- D OC_FZIG_ZAG

Building theora with --disable-encode fixes the issue but then ffmpeg is unable to encode using theora. Any pointers would be appreciated. I have successfully built ffmpeg using emscripten in the past with different libs, but I can't seem to figure out theora.

jfizz commented 5 years ago

As a workaround, I used --disable-shared and just used the static lib.