libvorbis 및 libmp3lame의 정적 빌드 중 오류가 발생했습니다.

libvorbis 및 libmp3lame의 정적 빌드 중 오류가 발생했습니다.

ffmpeg의 정적 바이너리를 빌드하는 데 문제가 있습니다. libvorbis 및 libmp3lame이라는 두 라이브러리를 제외하고 거의 전체 빌드가 작동합니다.

이 두 라이브러리는 ./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에 연결됩니다.

혹시라도 두 라이브러리를 모두 빌드하는 데 사용한 플래그는 다음과 같습니다.

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상관없이 어느 쪽이든 구축할 수 있습니다.

관련 정보