x265 not found using pkg-config

Issue #125 resolved
aryan singh
created an issue

getting "x265 not found using pkg-config" error when enable libx265 with ffmpeg.

i have successfully compile libx265 in ffmpeg , but getting this error .

kindly help me please

Comments (37)

  1. aryan singh reporter

    can you suggest me what should i do now ? where to check pkg-config ? ffmpeg is fully updated and othere compile are working fine, but i am unable to enable this

  2. Werner Robitza

    The issue is that in order for x265 to work with ffmpeg, it needs to be statically compiled, similar to the other libraries mentioned in the compilation guide: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

    It's definitely not a "bug" with x265—certainly it can be compiled any way you want—but a lack of documentation on FFmpeg's side on how to integrate it. Or a lack of documentation on x265 side.

    It's not entirely clear what specific steps need to be done to compile x265 so that it can be statically linked to ffmpeg.

  3. Werner Robitza

    You may want to change this issue and

    • set its priority to "normal"; it's certainly not critical
    • ask how to statically compile x265 to link it with ffmpeg

    This is as far as I got:

    cd ~/ffmpeg_sources
    hg clone https://bitbucket.org/multicoreware/x265
    cd x265
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/ffmpeg_build source
    make install

    But it does not create a static build.

  4. aryan singh reporter

    @werner Robitza : thank you for suggestion , but its not normal issue , i am trying to solve this from sunday but no luck yet so this is begin critical for me , and is there any guide about "how to statically compile x265" with ffmpeg ?

  5. Cigaes

    Learn how to administrate a Unix system and try again in two years. Sorry if this is harsh, but you have to understand that building software from source is inherently a complex task, you can not expect to get it working in a few minutes. Sometimes, you are lucky and someone already did exactly what you need, with step-by-step explanations. When you are not, you have to make efforts of your own. Or... I am sure you can find plenty of people that will make the effort for you... for a fee.

  6. aryan singh reporter

    hahaha ,, you are blogging on a free codec forum and asking for a fee ? lol grow up man better open another blog where you ask to user for a fee to help them ,, SORRY IF THIS WAS HARSH FOR YOU yes that was :D

  7. Cigaes

    I am not asking for a fee. I do not volonteer to do the work for you, be it for free or not. I am writing on this issue tracker to tell the x265 guys what kind of “issue” it is and that they can close it without remorse. Then I was sidetracked by trolling, but I will stop now. But you, you need to learn how Free Software works. It does not involve Free Software developers being at the beck and call of any user that does not want to make any effort learning. Free Software is an exchange: the developers provide the software at no financial cost in the hope that users will contribute useful patches, or at least smart bug reports. Users that do not want to play that game can hire a consultant.

  8. djcj

    My ffmpeg builds on Launchpad are all linked against the libx265 shared library. And I didn't patch the x265 or ffmpeg sources. You can try to override the PKG_CONFIG_PATH environment variable (see man pkg-config for details) or you can try to hack ffmpeg's configure script.

  9. msg7086
    1. Reported by someone else != it's a bug. It could mean that there's another guy who has no idea how to compile this correctly.
    2. After you compile x265 and install it (cmake -DCMAKE_INSTALL_PREFIX=somewhere_to_install ../../source and make and make install), make sure there's a libx265.a file inside the directory, and a libx265.so file not be there. This forces ffmpeg to link to the static version.

    You can have a try and report back whether it works or not. We can then sort out what's going wrong.

  10. Steve Borho

    you would probably get more useful help at #ffmpeg on IRC, from people accustomed to building ffmpeg from source.

    So far I've seen zero indication x265 is doing anything wrong. On Linux, the libx265 static library is always compiled and installed. This problem is between you, pkg-config, and ffmpeg. pkg-config most likely needs x265 installed in the standard install locations in order to find it.

  11. aryan singh reporter

    @Steve Hu Borho : i followed these steps :

    #hg clone https://bitbucket.org/multicoreware/x265
    #cd x265/build/linux
    i set --prefix="/root/ffmpeg_build and shared OFF
    #make install

    all above task done by super user on server in /root/ffmpeg_sources/ffmpeg directory

    there after i run this command to enable this : PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

    and error : x265 not found using pkg-config

    may you tell am i wrong ?

  12. Werner Robitza

    If you can show a file listing and the output of the ffmpeg configure.log, then please ask that on the FFmpeg mailing list.

    As others have stated, this is not a bug with x265.

  13. Werner Robitza

    Try this:

    cd ~/ffmpeg_sources
    hg clone https://bitbucket.org/multicoreware/x265
    cd ~/ffmpeg_sources/x265/build/linux
    PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
    make install

    Then, for ffmpeg itself (assuming you have all the other libs installed according to the guide):

    cd ~/ffmpeg_sources/ffmpeg
    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
      --prefix="$HOME/ffmpeg_build" \
      --extra-cflags="-I$HOME/ffmpeg_build/include" \
      --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
      --bindir="$HOME/bin" \
      --pkg-config-flags="--static" \
      --enable-gpl \
      --enable-libass \
      --enable-libfdk-aac \
      --enable-libfreetype \
      --enable-libmp3lame \
      --enable-libopus \
      --enable-libtheora \
      --enable-libvorbis \
      --enable-libvpx \
      --enable-libx264 \
      --enable-libx265 \


    PATH="$HOME/bin:$PATH" make
    make install

    Worked for me on Linux Mint 17. Say thank you to Lou from FFmpeg for figuring this out.

    The -DENABLE_SHARED:bool=off part in particular is something that may be useful to mention on the x265 wiki.

  14. Werner Robitza

    Can you please elaborate?

    All other libs are built statically in the ffmpeg guide; I don't see why x265 would necessarily have to be a shared library, or why that'd be more helpful in the long run. (In fact, having a static build makes it much more portable… at least for my use cases.)

  15. aryan singh reporter

    @werner Robitza : thank You mate !! its work like a charm , thank you for your effort also thank to Lou from FFmpeg you are the real guy who change the world

    @Cigaes : don't make this complicated keep this simple ,all are not smart as you LOL

  16. Thomas Ahn

    I got a same issue to configure ffmpeg on Ubuntu 14.04 w/gcc4.9, but my case was not resolved with any suggested solution. After one day's try-and-error, I found a hint from config.log said: /home/thomas/ffmpeg_build/include/x265.h:103:5: error: unknown type name 'bool' bool bScenecut; So the culprit is 'bool', hahaha... To resolve above error, I just add following heder file at x265_config.h:

    include <stdbool.h>

    And configure again, it works!! hope this help anybody facing the same problem.

  17. Cigaes

    Thomas Ahn: No, it is not the same issue.

    The problem with bool is a new one, introduced less than a week ago in x265.h by using the bool type without the corresponding error. It has nothing to do with the initial reported problem except it ends up with the same error message from FFmpeg's configure.

  18. Andreas Langberg

    Reporting same issue for me in Mint 17.2. Including <stdbool.h> in the header solved the problem.

    Love the incredibly rudeness of some member btw. Experience doesn't matter when asking for help. If you never get going with Linux because people refuse to help due to "lol inexperienced noob", then you'll just end up with fewer people using it enough to get good at it to begin with.

  19. Jordan Graham

    In my case, ffmpeg's 'configure' script was looking for x265.pc in a different directory from the one in which x265 put it.

    You could:

    • cd /

    • find . -name "x265.pc"

    • cp [path]/x265.pc [PKG_CONFIG_PATH that you're using in your ffmpeg 'configure' command]

  20. Log in to comment