libvorbisとlibmp3lameの静的ビルド中にエラーが発生しました。

libvorbisとlibmp3lameの静的ビルド中にエラーが発生しました。

ffmpegの静的バイナリを構築する際に問題があります。 libvorbisとlibmp3lameという2つのライブラリを除いて、ほぼ完全なビルドが機能します。

これらの2つのライブラリは、./configure中に特に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'

正常に構築する方法がわかりません。私が理解したのは、その-lmオプションを渡すだけで十分ですが、明らかにそうではありません。存在するかlibm.a、場所があるかを確認し、/usr/lib/x86_64-linux-gnu/libm.aフラグにこのディレクトリを渡そうとしましたが-L違いはありませんでした。フラグを削除すると、ライブラリは正常に構築されますが、-static結果のバイナリ(duh)はlibm.soにリンクされます。

2つのライブラリを構築するために使用したフラグは次のとおりです。

libvorbis:
./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared --disable-oggtest

libmp3lame:
./configure --prefix=${CMAKE_BINARY_DIR} --disable-shared

この問題をさらに解決またはデバッグする方法に関するアドバイスをいただきありがとうございます。

編集:少し遊んだらlibm接続が入ってくるようです。フラグを削除すると、未定義-lmの参照がより多くなります。などsin。​もう一度入れると、などの壊れた記号だけが残り、ほとんどが消えました。cos__pow_finite_ZGVbN4vv___powf_finite_ZGVbN2v_cos

ベストアンサー1

さて、問題を解決しました。たとえば、壊れた記号を検索して_ZGVbN2v_cos見つけました。今回のパッチベクトル数学に言及し、動的ldd接続について言及された出力と組み合わせて、libmvec私はそれも接続する必要があるかもしれないことに気づきました。

libmp3lameの場合は、libmの前に接続する必要があります。

gcc -L/vol/build/lib -static -o /tmp/ffconf.dC4w1f5B/test /tmp/ffconf.dC4w1f5B/test.o -lmp3lame -lmvec -lm

-lmlibvorbisの場合、順序に-lmvec関係なくどちらを構築できます。

おすすめ記事