3
I am trying to compile FFMPEG and Libaom from source apparently because the gcc and g++ compilers in Ubuntu 18.04 by default has enabled the following option by default: --enable-default-pie
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-16ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --with-as=/usr/bin/x86_64-linux-gnu-as --with-ld=/usr/bin/x86_64-linux-gnu-ld --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)
I have tried to pass an --extra-ldexeflags="-no-pie -fno-pic -fno-pie"
but it didn't help. I have the same problem when trying to compile libaom. I have tried to install an older version of gcc but even 5.X has this --enable-default-pie
option enabled by default, so it is not good. Apparently this option has been forced on Ubuntu 18.04 and there is no way around it.
That's my error while trying to install libaom:
64%] Linking CXX executable examples/decode_with_drops
/usr/bin/x86_64-linux-gnu-ld: libaom.a(fwd_txfm_ssse3_x86_64.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: libaom.a(quantize_ssse3_x86_64.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: libaom.a(subpel_variance_sse2.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: libaom.a(highbd_subpel_variance_impl_sse2.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
CMakeFiles/decode_with_drops.dir/build.make:155: recipe for target 'examples/decode_with_drops' failed
make[2]: *** [examples/decode_with_drops] Error 1
CMakeFiles/Makefile2:936: recipe for target 'CMakeFiles/decode_with_drops.dir/all' failed
make[1]: *** [CMakeFiles/decode_with_drops.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
[EDIT]: Adding my ffmpeg compilation command.
I was following the Ubuntu compilation guide posted at My command was a bit different though. I have disabled the ffplay, since I am installing ffmpeg on a server and enabled libsrt (Haivision Secure Reliable Transport Protocol) and libaom (AV1). I have also changed the download link to download the stable 4.0 version instead of the latest nightly build. This is my ffmpeg compilation command:
cd ~/ffmpeg_sources && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-4.0.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg-4.0 && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-shared \
--enable-gpl \
--enable-nonfree \
--enable-ladspa \
--enable-libsrt \
--enable-libsoxr \
--enable-libspeex \
--enable-avfilter \
--enable-avresample \
--enable-postproc \
--enable-pthreads \
--enable-libfdk-aac \
--enable-libopus \
--enable-libass \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libfreetype \
--enable-libkvazaar \
--disable-ffplay \
--enable-libopenjpeg \
--enable-libwebp \
--enable-libxvid \
--enable-libvidstab \
--enable-libopenh264 \
--enable-zlib \
--enable-openssl && \
PATH="$HOME/bin:$PATH" make -j8 && \
sudo make install && \
hash -r
I'd say this belongs to StackOverflow. Compiling ffmpeg is requires arcane knowledge anyway. – None – 2018-05-07T11:35:45.150
any idea, how I can move it from here to there? When I tried to create a new thread on Stackoverflow, it said that I can post only post once every 90 minutes. – Georgе Stoyanov – 2018-05-07T11:42:47.460
I flagged it for transfer. So, just wait. – None – 2018-05-07T11:46:25.073
2
If you're asking in order to compile the program as a user and not a developer, this doesn't need to be migrated. That said, it might be useful if you (a) change the title of the question to e.g. "how do I compile FFMPEG without PIE?", and (b) explain why you need PIE disabled. Perhaps there is an alternative solution.
– Bob – 2018-05-07T14:00:36.987PIE is default in gcc v.5.5, not in 5.4 . ... You can use the new "no-pie"
– Knud Larsen – 2018-05-07T15:25:26.030gcc54-c++_5.4.0-ubuntu16_amd64.deb
for 18.04 (and 16.04) https://drive.google.com/file/d/1ptHLaZXImpeMzq4xuuGGn5VjrvxNSop3/view?usp=sharing ... Provides/usr/bin/{gcc54, g++54, gfortran54}
. Install :sudo gdebi Downloads/gcc54-c++_5.4.0-ubuntu16_amd64.deb
Works for me in 18.04. Show your
cmake
command or whatever info is needed to duplicate the issue. – llogan – 2018-05-07T22:26:46.800Thanks to @KnudLarsen I was able to compile successfully ffmpeg and libaom. I have also changed the title as "alternative solution" suggested. – Georgе Stoyanov – 2018-05-08T12:47:51.183
I did not have to use the PIE-less
gcc
to compile: I should clarify that's what I meant when I said it "works for me". I wanted to resolve your specific issue first before providing compile instructions (it's why I asked for the commands you used so I could replicate your issue). If you found a solution you can also add it as an answer. – llogan – 2018-05-08T16:35:33.767