1

I have checked out the latest source of ffmpeg from the official website. I now want to compile and build ffmpeg as a position independent executable.

Here is what my configure command looks like

./configure --prefix=/usr/local --enable-gpl --enable-pic --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

I have added the option --enable-pic to make it a PIE. However when the build process completes successfully and when I do a hardening check as follows then I get below output

hardening-check ffmpeg

ffmpeg:
Position Independent Executable: no, normal executable!
Stack protected: yes
Fortify Source functions: yes (some protected functions found)
Read-only relocations: yes
Immediate binding: no, not found!

This tells me that ffmpeg is still not a PIE. Can anyone tell me what am I missing here? Is there any other changes that need to be done for adding PIE support.

2 Answers 2

2

You need to add -fPIE and -pie options to CFLAGS and LDFLAGS to the configure script like the following :

./configure <other options> \
 --extra-cflags="-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie" \
 --extra-ldflags="-L../x264 -fPIE -pie"

The latest scripts have these changes already.

1
  • 1
    -fPIE is only for cflags, and -pie is only for ldflags
    – tmm1
    May 13, 2017 at 0:32
0

don't confuse PIE and PIC, sepecially in your params and pass -pie to your linker options - PIC is for shared libraries and NOT executeables

https://fedoraproject.org/wiki/Changes/Harden_All_Packages

1
  • i understand the difference now thanks.. but how do I add support the PIE support to my ffmpeg Mar 30, 2016 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.