x265 not found using pkg-config
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/root/ffmpeg_build/include -I../nv_sdk -I/usr/local/cuda/include/ -std=c11 -fomit-frame-pointer -pthread -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/fribidi -I/usr/include/freetype2 -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -I/root/ffmpeg_build/include -L/root/ffmpeg_build/lib -c -o /tmp/ffconf.y8KnGKyL/test.o /tmp/ffconf.y8KnGKyL/test.c
gcc -L/root/ffmpeg_build/lib -L../nv_sdk -L/usr/local/cuda/lib64/ -Wl,--as-needed -Wl,-z,noexecstack -I/root/ffmpeg_build/include -L/root/ffmpeg_build/lib -o /tmp/ffconf.y8KnGKyL/test /tmp/ffconf.y8KnGKyL/test.o -lx265 -lstdc++ -lm -lrt -ldl -lnuma
/root/ffmpeg_build/lib/libx265.a(threading.cpp.o): In function x265::Thread::start()':
threading.cpp:(.text+0x35): undefined reference to
pthread_create'
/root/ffmpeg_build/lib/libx265.a(threading.cpp.o): In function x265::Thread::stop()':
threading.cpp:(.text+0x63): undefined reference to
pthread_join'
collect2: error: ld returned 1 exit status
ERROR: x265 not found using pkg-config
why this error?
Comments (12)
-
-
Please add to ffmpeg configure one option:
--extra-libs=-lpthread
-
Seems to work, thanks! I'll update the guide.
-
It is x265 bug. With option --pkg-config-flags="--static" it should work without any extra libs, but in cmake script it is -lpthread removed -- see https://bitbucket.org/multicoreware/x265/src/0e168bdeb48b3d57d896d3823e2efb2bf69d4b26/source/CMakeLists.txt?at=default&fileviewer=file-view-default#CMakeLists.txt-632
-
Account Deactivated The reason why we remove pthread library from the static linking is so that the including application may link against library that implements pthreads; we don't want to force linking against pthread only.
It is not a bug, but more a feature :-)
-
Shouldn't it still be a bug until it handles this gracefully? Not forcing pthreads is nice, but it should be able to fail-back to pthreads, no?
-
Account Deactivated When libx265 is compiled, there is no way to know what threading library will be available in the platform where the target application is being built. Therefore, adding pthreads to list of library to link against in the target application platform isn't an option as it may happen in a separate work flow.
Do you suggest some other way to handle this?
-
I guess I'm confused as to why it shouldn't attempt to look for any commonly used default in the absence of explicit instructions to use something else. Obviously if the target platform doesn't have pthreads, then it's going to fail. But in the case without an explicit flag to use something else it was going to fail anyway.
Sorry if this is naive thinking. I'm just not understanding the logic of not attempting to succeed in a case where it seems (to me) it would at least sometimes be possible to do so.
-
I'm following the guide and having the same error
config.log:
require_pkg_config libx265 x265 x265.h x265_api_get use_pkg_config libx265 x265 x265.h x265_api_get check_pkg_config libx265 x265 x265.h x265_api_get pkg-config --exists --print-errors x265 check_func_headers x265.h x265_api_get -I/home/ray/ffmpeg_build/include -L/home/ray/ffmpeg_build/lib -lx265 -lstdc++ -lm -lrt -ldl check_ld cc -I/home/ray/ffmpeg_build/include -L/home/ray/ffmpeg_build/lib -lx265 -lstdc++ -lm -lrt -ldl check_cc -I/home/ray/ffmpeg_build/include -L/home/ray/ffmpeg_build/lib BEGIN /tmp/ffconf.W7V5z4Jp/test.c 1 #include <x265.h> 2 #include <stdint.h> 3 long check_x265_api_get(void) { return (long) x265_api_get; } 4 int main(void) { int ret = 0; 5 ret |= ((intptr_t)check_x265_api_get) & 0xFFFF; 6 return ret; } END /tmp/ffconf.W7V5z4Jp/test.c gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I/home/ray/ffmpeg_build/include -std=c11 -fomit-frame-pointer -pthread -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/include/opus -I/usr/include/opus -I/home/ray/ffmpeg_build/include -I/home/ray/ffmpeg_build/include -L/home/ray/ffmpeg_build/lib -c -o /tmp/ffconf.W7V5z4Jp/test.o /tmp/ffconf.W7V5z4Jp/test.c In file included from /tmp/ffconf.W7V5z4Jp/test.c:1:0: /home/ray/ffmpeg_build/include/x265.h:1753:40: error: expected ';', ',' or ')' before '&' token FILE* x265_csvlog_open(const x265_param& param); ^ /home/ray/ffmpeg_build/include/x265.h:1757:40: error: expected ';', ',' or ')' before '&' token void x265_csvlog_frame(const x265_param& param, const x265_picture& pic); ^ /home/ray/ffmpeg_build/include/x265.h:1762:64: error: expected ';', ',' or ')' before '&' token void x265_csvlog_encode(x265_encoder *encoder, const x265_stats& stats, int argc, char** argv); ^ /home/ray/ffmpeg_build/include/x265.h:1766:36: error: expected ';', ',' or ')' before '&' token void x265_dither_image(x265_picture& pic, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth); ^ /home/ray/ffmpeg_build/include/x265.h:1815:50: error: expected ';', ',' or ')' before '&' token FILE* (*csvlog_open)(const x265_param&); ^ /home/ray/ffmpeg_build/include/x265.h:1816:51: error: expected ';', ',' or ')' before '&' token void (*csvlog_frame)(const x265_param&, const x265_picture&); ^ /home/ray/ffmpeg_build/include/x265.h:1817:67: error: expected ';', ',' or ')' before '&' token void (*csvlog_encode)(x265_encoder*, const x265_stats&, int, char**); ^ /home/ray/ffmpeg_build/include/x265.h:1818:47: error: expected ';', ',' or ')' before '&' token void (*dither_image)(x265_picture&, int, int, int16_t*, int); ^ /home/ray/ffmpeg_build/include/x265.h:1820:1: warning: no semicolon at end of struct or union } x265_api; ^ ERROR: x265 not found using pkg-config
-
@RayZX That error has nothing to do with the one reported in this bug. It's just that ffmpeg prints the same final message when one of its library dependencies fails to be included.
-
The new problem it is issue
#377(serious x265 bug). The patch proposition is https://patches.videolan.org/patch/18630/ -
Anyway, I had the same problem and I had to add two switches:
--extra-libs="-lpthread" --pkg-config-flags="--static"
- Log in to comment
More specifically, to reproduce this:
x265 built with:
Then:
The
config.log
finishes with: