Error configuring ffmpeg; undefined references in lib265.a

Issue #501 resolved
Jim Worrall created an issue

I am unable to configure ffmpeg with x265 generated by multilib.sh; it complains that pkg-config can’t find x265 although it is in the pkg-config path. It seemed like it might be issue #472, but that seems to have been addressed and the problem remains.

ffmpeg config.log:

/usr/bin/clang -I/usr/local/ffmpeg/target/include -I/usr/local/include -L/usr/local/ffmpeg/target/lib -L/usr/local/lib -lstdc++ -L/usr/local/ffmpeg/target/lib -Wl,--as-needed -Wl,-z,noexecstack -I/usr/local/ffmpeg/target/include -o /tmp/ffconf.EtOtzVZH/test /tmp/ffconf.EtOtzVZH/test.o -lx265 -lc++ -lm -lgcc -lgcc_s -lgcc -lgcc_s -lrt -ldl
/usr/local/ffmpeg/target/lib/libx265.a(api.cpp.o): In function x265_api_get_176': api.cpp:(.text+0x2cfd): undefined reference tox265_10bit::x265_api_get_176(int)'
api.cpp:(.text+0x2db6): undefined reference to x265_12bit::x265_api_get_176(int)' /usr/local/ffmpeg/target/lib/libx265.a(api.cpp.o): In functionx265_api_query':
api.cpp:(.text+0x2e4d): undefined reference to x265_10bit::x265_api_query(int, int, int*)' api.cpp:(.text+0x2e74): undefined reference tox265_12bit::x265_api_query(int, int, int*)'
/usr/local/ffmpeg/target/lib/libx265.a(threading.cpp.o): In function x265::Thread::start()': threading.cpp:(.text+0x24): undefined reference topthread_create'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: x265 not found using pkg-config

It looks like pkg-config did find libx265.a, but something goes wrong in there?

The version:

[root@ffmpeg /usr/local/ffmpeg/build/x265]# x265 --version
x265 [info]: HEVC encoder version 3.1+2-b36c03e4e771
x265 [info]: build info [Unk-OS][clang 6.0.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2

Comments (3)

  1. Jim Worrall reporter

    I found that multilib.sh was defaulting to the Mac/BSD libtool, which doesn’t work that way on FreeBSD. I changed it to use the ar -M command, which worked.

    But there are still undefined references leading to failure, just different now, about threading:

    /usr/bin/clang -L/usr/local/ffmpeg/target/lib -L/usr/local/lib -L/usr/lib -L/usr/local/ffmpeg/target/lib -Wl,--as-needed -Wl,-z,noexecstack -I/usr/local/ffmpeg/target/include -L/usr/local/ffmpeg/target/lib -o /tmp/ffconf.Vco80tme/test /tmp/ffconf.Vco80tme/test.o -lx265 -lc++ -lm -lgcc -lgcc_s -lgcc -lgcc_s -lrt -ldl
    /usr/local/ffmpeg/target/lib/libx265.a(threading.cpp.o): In function x265::Thread::start()': threading.cpp:(.text+0x24): undefined reference topthread_create'
    /usr/local/ffmpeg/target/lib/libx265.a(threading.cpp.o): In function x265_10bit::Thread::start()': threading.cpp:(.text+0x24): undefined reference topthread_create'
    /usr/local/ffmpeg/target/lib/libx265.a(threading.cpp.o): In function x265_12bit::Thread::start()': threading.cpp:(.text+0x24): undefined reference topthread_create'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ERROR: x265 not found using pkg-config

    I can build ffmpeg when I allow x265 to build a shared library, but can’t seem to do it with static.

  2. Jim Worrall reporter

    I found this issue and tried adding --extra-libs=-lpthread to the ffmpeg configure. That seemed to fix it. Did not find this info in any guides, but maybe it is somewhere. And I hadn’t needed to add that in previous builds on the same machine. Anyway, as the other issue says, it’s a ‘feature’ not a bug.

  3. Log in to comment