compiling obs: libswscale.a recompile with -fPIC

Hey guys,

I'm trying to compile obs-studio on Ubuntu 14.04 LTS and I'm getting this error when running make -j4:

Code:
/usr/bin/ld: /usr/local/sbin/../lib/libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

I have manually compiled ffmpeg following this guide (https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) and I compiled all those libraries using --enabled-shared as suggested on this post: Help compiling OBS-Redux.

ffmpeg compiles without any issues using -fPIC --enable-shared and --enable-pic. This is the configure command that I use for ffmpeg:

Code:
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/cpp/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="/usr/local" \
  --pkg-config-flags="--static" \
  --extra-cflags="-fPIC -m64 -I$HOME/cpp/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/cpp/ffmpeg_build/lib" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree \
  --enable-pic \
  --enable-shared \
  --extra-ldexeflags="-pie"

Following the ffmpeg docs I added these flags:
Code:
--extra-cflags="-fPIC -m64 -I$HOME/cpp/ffmpeg_build/include" \
--extra-ldexeflags="-pie"
--enable-shared
--enable-pic

But everytime I try to compile the obs-studio I get:

Code:
/usr/bin/ld: /usr/local/sbin/../lib/libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libobs/libobs.so.0] Error 1
make[1]: *** [libobs/CMakeFiles/libobs.dir/all] Error 2
make: *** [all] Error 2

I have attached a full log with the output I get when running make -j4.
 

Attachments

  • log.txt
    83.2 KB · Views: 17

vcorreia

New Member
Anybody knows how to solve this problem? Using lubuntu/ubuntu and also compiled ffmpeg with --enable-shared and --enable-pic but still having the error:
libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC

Or at least can someone publish a guide to compile for linux that worked for them (the one on the wiki doesnt work for me)?

Thank you in advance.
 
Top