Cannot build ffmpeg with libx264
Hello All, Let me first say thank you in advance for the help on this. I have been trying to compile a static install of ffmpeg support libx264 for several months now on a RHEL cluster we have and I have tried just about EVERY help forum suggestion I come across but still no luck. The script I have been using to date is copied below. Mostly it just clears everything out and then re-extracts and attempts to build everything necessary to function. I don't know how I can be more explicit for where I am putting the x264 library and I can see from the config.out that it knows where libx264.a is at but it always dies and says: collect2: error: ld returned 1 exit status ERROR: libx264 not found Here is the script I have been using so far. See anything that stands out that I have wrong with this? #!/bin/bash export FFMPEGDIR=/place_where_it_is/ffmpeg_installation rm -rf $FFMPEGDIR/ffmpeg_sources/yasm rm -rf $FFMPEGDIR/ffmpeg_sources/nasm-2.13.01 rm -rf $FFMPEGDIR/ffmpeg_sources/x264 rm -rf $FFMPEGDIR/ffmpeg_sources/ffmpeg rm -rf $FFMPEGDIR/ffmpeg_build rm -rf $FFMPEGDIR/ffmpeg_related_bin cd $FFMPEGDIR/ffmpeg_sources tar -xvf nasm-2.13.01.tar.xz tar -xvf yasm.tar.gz tar -xvf x264.tar.gz tar -xvf ffmpeg.tar.gz cd $FFMPEGDIR/ffmpeg_sources/yasm autoreconf -fiv ./configure --prefix="$FFMPEGDIR/ffmpeg_build" --bindir="$FFMPEGDIR/ffmpeg_related_bin" make make install make distclean cd $FFMPEGDIR/ffmpeg_sources/nasm-2.13.01 make clean ./configure --prefix="$FFMPEGDIR/ffmpeg_build" --bindir="$FFMPEGDIR/ffmpeg_related_bin" make make install export PATH="$FFMPEGDIR/ffmpeg_related_bin:$PATH" cd $FFMPEGDIR/ffmpeg_sources/x264 make clean ./configure --prefix="$FFMPEGDIR/ffmpeg_build" --bindir="$FFMPEGDIR/ffmpeg_related_bin" --enable-static --disable-opencl make make install ldconfig cd $FFMPEGDIR/ffmpeg_sources/ffmpeg export PKG_CONFIG_PATH="$FFMPEGDIR/ffmpeg_build/lib/pkgconfig" export LD_LIBRARY_PATH="$FFMPEGDIR/ffmpeg_build/lib:$FFMPEGDIR/ffmpeg_build/include:$LD_LIBRARY_PATH" make clean ./configure --prefix="$FFMPEGDIR/ffmpeg_build" --pkg-config-flags="--static" --enable-static --extra-cflags="-I$FFMPEGDIR/ffmpeg_build/include" --extra-ldflags="-L$FFMPEGDIR/ffmpeg_build/lib" --extra-ldexeflags="-static" --bindir="$FFMPEGDIR/ffmpeg_related_bin" --enable-gpl --enable-libx264 make make install make distclean Thank you again for helping with this! David
2017-11-14 0:07 GMT+01:00 Peterson, David J <djpeter@sandia.gov>:
I can see from the config.out that it knows where libx264.a is at but it always dies and says:
collect2: error: ld returned 1 exit status ERROR: libx264 not found
I am quite sure the configure script gave you useful explanations what you should do - why do you ignore them? I at least would like to know what collect2 was unhappy about, or actually: I need it to be able to answer your question.
rm -rf $FFMPEGDIR/ffmpeg_sources/yasm rm -rf $FFMPEGDIR/ffmpeg_sources/nasm-2.13.01
Unrelated: You need either yasm or nasm, yasm does not support AVX-512 (which so far you don't want to use). You cannot use both. Carl Eugen
Hi Carl, Thanks for the reply. I would be happy to act on any explanations it gives but there was no explanation I saw. This is most likely due to my ignorance. Excerpts from the .log files from configure attached (these are the last 4 of 11 times it hit). Do this make any sense to you perhaps why it would be thus throwing the error? gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -lbz2 -pthread -pthread /usr/bin/ld: cannot find -lbz2 collect2: error: ld returned 1 exit status gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -llzma -pthread -pthread /usr/bin/ld: cannot find -llzma collect2: error: ld returned 1 exit status ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status ERROR: libx264 not found As for yasm and nasm. It was a while back but it griped unless I had both. The compilation guide instructs to install both as well for RHEL. Again, am very green to any compiling under unix based systems to please forgive my ignorance. Thank you very much for the help, David David Peterson -------------------------------------------- ~Dovie'andi Se Tovya Sagain~ Sandia National Laboratories Org. 1555 Computational Structural Mechanics & Applications P.O. Box 5800 MS 0840 Albuquerque, NM 87185 Office: 505-284-0235 Cell: 505-321-0286 -----Original Message----- From: ffmpeg-user [mailto:ffmpeg-user-bounces@ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: Monday, November 13, 2017 5:08 PM To: FFmpeg user questions <ffmpeg-user@ffmpeg.org> Subject: [EXTERNAL] Re: [FFmpeg-user] Cannot build ffmpeg with libx264 2017-11-14 0:07 GMT+01:00 Peterson, David J <djpeter@sandia.gov>:
I can see from the config.out that it knows where libx264.a is at but it always dies and says:
collect2: error: ld returned 1 exit status ERROR: libx264 not found
I am quite sure the configure script gave you useful explanations what you should do - why do you ignore them? I at least would like to know what collect2 was unhappy about, or actually: I need it to be able to answer your question.
rm -rf $FFMPEGDIR/ffmpeg_sources/yasm rm -rf $FFMPEGDIR/ffmpeg_sources/nasm-2.13.01
Unrelated: You need either yasm or nasm, yasm does not support AVX-512 (which so far you don't want to use). You cannot use both. Carl Eugen _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
2017-11-20 19:17 GMT+01:00 Peterson, David J <djpeter@sandia.gov>:
Excerpts
Excerpts are typically a superbly bad idea because I then have to guess what the issue is.
gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -lbz2 -pthread -pthread
/usr/bin/ld: cannot find -lbz2
I suggest you fix this.
collect2: error: ld returned 1 exit status
gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -llzma -pthread -pthread
/usr/bin/ld: cannot find -llzma
Same.
collect2: error: ld returned 1 exit status
ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status
You used icc to compile libx264 and gcc to compile FFmpeg. This does work in general but in combination with --extra-cflags=-static you have to take care of the necessary libraries. [...]
As for yasm and nasm. It was a while back but it griped unless I had both.
No. (It is of course possible that your installed nasm (or yasm) was too old and instead of updating nasm (or yasm) installing current yasm (or nasm) helped. But this is completely unrelated.)
The compilation guide instructs to install both as well for RHEL.
Then it is probably time to ignore this instructions if you cannot remove them. Please do not top-post here, Carl Eugen
On Mon, Nov 20, 2017 at 18:17:22 +0000, Peterson, David J wrote:
Thanks for the reply. I would be happy to act on any explanations it gives but there was no explanation I saw. This is most likely due to my ignorance. Excerpts from the .log files from configure attached (these are the last 4 of 11 times it hit). Do this make any sense to you perhaps why it would be thus throwing the error?
Yes, these messages make sense, that's why they're their and you should show them to us, if you can't make sense of them.
gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -lbz2 -pthread -pthread /usr/bin/ld: cannot find -lbz2
This doesn't matter. It's autodetect, and thereby disabled. The Matroska demuxer can make use of it. To support it, your system needs the package bzip2-devel. (Hint for Debian, Ubuntu users: it's called libbz2-dev there.) Or you need to compile bzip2 in a similar manner to your other stuff. (The wiki instructions are incorrect regarding this.[*])
gcc -L /ffmpeg_installation/ffmpeg_build/lib -Wl,--as-needed -Wl,-z,noexecstack -static -o /tmp/ffconf.xsWlVzny/test /tmp/ffconf.xsWlVzny/test.o -llzma -pthread -pthread /usr/bin/ld: cannot find -llzma
This doesn't matter. It's autodetect, and thereby disabled. The TIFF decoder can apparently make use of it. To support it, your system needs the package xz-devel. (Hint for Debian, Ubuntu users: it's called liblzma5 or liblzma5-dev there.) Or you need to compile xz in a similar manner to your other stuff. (The wiki instructions are incorrect or incomplete regarding this.[*])
ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status
ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status ERROR: libx264 not found
From my humble experience, this probably means your x264 was built with icc (the Intel Compiler Suite), but is missing some essential flag in x264.pc. Is that what you did? If so, and if you compile ffmpeg with ggc, I believe you need to set Intel's linker as the linker. Something like "--ld=ild"
Hope this helps, Moritz [*] The wiki says: $ yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel
2017-11-20 22:15 GMT+01:00 Moritz Barsnick <barsnick@gmx.net>:
On Mon, Nov 20, 2017 at 18:17:22 +0000, Peterson, David J wrote:
ffmpeg_installation/ffmpeg_build/lib/libx264.a(mc-c.o): In function `x264_plane_copy_avx':mc-c.c:(.text+0x11ac): undefined reference to `_intel_fast_memcpy' collect2: error: ld returned 1 exit status ERROR: libx264 not found
From my humble experience, this probably means your x264 was built with icc (the Intel Compiler Suite), but is missing some essential flag in x264.pc.
No, x264 (which is responsible for this file) cannot know that icc links against its own libraries for optimization. The user who wants to build static binaries with icc and gcc needs to supply the needed libraries.
Is that what you did?
If so, and if you compile ffmpeg with ggc, I believe you need to set Intel's linker as the linker. Something like "--ld=ild"
Something like: --extra-libs=/opt/intel/lib/intel64/libintlc.a Carl Eugen
participants (3)
-
Carl Eugen Hoyos -
Moritz Barsnick -
Peterson, David J