I'm having trouble trying to build a static binary of ffmpeg - I've got almost the whole build working, with the exception of two libs - libvorbis and libmp3lame.
These two libs are failing during ./configure, specifically on undefined functions from the math.h / libm:
libvorbis:
gcc -L/vol/build/lib -static -static-libstdc++ -static-libgcc -Wl,--as-needed -Wl,-z,noexecstack -I/vol/build/include -L/vol/build/lib -o /tmp/ffconf.UKKLGhCv/test /tmp/ffconf.UKKLGhCv/test.o -lvorbis -lm -logg -lstdc++ -lpthread -lexpat -ldl -lm --enable-libopencore-amrnb
/vol/build/lib/libvorbis.a(envelope.o): In function `_ve_envelope_init':
envelope.c:(.text+0x983): undefined reference to `_ZGVbN2v_sin'
envelope.c:(.text+0x9a9): undefined reference to `_ZGVbN2v_sin'
/vol/build/lib/libvorbis.a(lsp.o): In function `vorbis_lsp_to_curve':
lsp.c:(.text+0x650): undefined reference to `_ZGVbN2v_cos'
lsp.c:(.text+0x669): undefined reference to `_ZGVbN2v_cos'
libmp3lame:
gcc -L/vol/build/lib -static -static-libstdc++ -static-libgcc -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.dC4w1f5B/test /tmp/ffconf.dC4w1f5B/test.o -lmp3lame -lm -lstdc++ -lpthread -lexpat -ldl -lm --enable-libopencore-amrnb
/vol/build/lib/libmp3lame.a(psymodel.o): In function `init_s3_values':
psymodel.c:(.text+0x14d3): undefined reference to `_ZGVbN2v___exp_finite'
psymodel.c:(.text+0x14fa): undefined reference to `_ZGVbN2v___exp_finite'
/vol/build/lib/libmp3lame.a(psymodel.o): In function `psymodel_init':
psymodel.c:(.text+0xb62d): undefined reference to `_ZGVbN4vv___powf_finite'
psymodel.c:(.text+0xb677): undefined reference to `_ZGVbN4vv___powf_finite'
psymodel.c:(.text+0xb6c4): undefined reference to `_ZGVbN4vv___powf_finite'
psymodel.c:(.text+0xb711): undefined reference to `_ZGVbN4vv___powf_finite'
psymodel.c:(.text+0xb75b): undefined reference to `_ZGVbN4vv___powf_finite'
/vol/build/lib/libmp3lame.a(psymodel.o):psymodel.c:(.text+0xb7a2): more undefined references to `_ZGVbN4vv___powf_finite' follow
/vol/build/lib/libmp3lame.a(util.o): In function `fill_buffer':
util.c:(.text+0x28a6): undefined reference to `_ZGVbN2v_cos'
util.c:(.text+0x28cc): undefined reference to `_ZGVbN2v_cos'
util.c:(.text+0x28fb): undefined reference to `_ZGVbN2v_cos'
util.c:(.text+0x2921): undefined reference to `_ZGVbN2v_cos'
util.c:(.text+0x29cc): undefined reference to `_ZGVbN2v_sin'
util.c:(.text+0x29e8): undefined reference to `_ZGVbN2v_sin'
I can't figure out how to get these to sucessfully build. From what I understand, passing the -lm option should be enough, but apparently isn't. I checked for the presence of libm.a, which is located at /usr/lib/x86_64-linux-gnu/libm.a, I also tried to pass this directory in the -L flags, but no difference. The libs build fine when removing the -static flag, but the resulting binary is (duh) linked against libm.so.
Just in case, these are the flags I'm using to build the two libraries:
libvorbis:
./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --disable-oggtest
libmp3lame:
./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared
I'd appreciate any pointers on how to fix or debug this any further.
Edit: after playing around with it some more, it seems like the libm is getting linked in - when I remove the -lm flag, I'm getting a ton more undefined references - sin, cos, __pow_finite, etc. When I put it back in, most of these go away and only those mangled symbols, such as _ZGVbN4vv___powf_finite and _ZGVbN2v_cos remain.