Question / Help Cannot compile OBS on Debian 8.2

toothpick

New Member
Hello,

I'm currently having an issue compiling OBS-Studio. I've managed to compile OBS a month ago, but I had to reinstall my system recently. Now (for the life of me) cannot get past this "swscale" error:
Code:
/usr/bin/ld: /usr/local/lib/../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
libobs/CMakeFiles/libobs.dir/build.make:1642: recipe for target 'libobs/libobs.so.0' failed
make[2]: *** [libobs/libobs.so.0] Error 1
CMakeFiles/Makefile2:333: recipe for target 'libobs/CMakeFiles/libobs.dir/all' failed
make[1]: *** [libobs/CMakeFiles/libobs.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2


Google was not much help (and unfriendly), and I played around with the configure options. The "-fPIC" option that gets mentioned would go with GCC, but I'm not sure where to add it within this maze of cmake files. Using the suggested configuration will display this:
Code:
$ cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
-- OBS_VERSION: 0.11.4-63-ga60189d
-- Found FFmpeg: /usr/local/lib/../lib/libavcodec.a (found version "57.1.100") found components:  avcodec avfilter avdevice avutil swscale avformat swresample
-- Using system Jansson library
-- XCB[XCB]: Found component XCB
-- Found XCB: /usr/lib/x86_64-linux-gnu/libxcb.so
-- Found FFmpeg: /usr/local/lib/../lib/libavformat.a (found version "57.0.100") found components:  avformat avutil swscale swresample avcodec
-- Using libavcodec for image loading in libobs
-- XCB[XCB]: Found component XCB
-- XCB[RANDR]: Found component RANDR
-- XCB[XINERAMA]: Found component XINERAMA
-- Found XCB: /usr/lib/x86_64-linux-gnu/libxcb.so;/usr/lib/x86_64-linux-gnu/libxcb-randr.so;/usr/lib/x86_64-linux-gnu/libxcb-xinerama.so
-- XCB[XCB]: Found component XCB
-- XCB[SHM]: Found component SHM
-- XCB[XFIXES]: Found component XFIXES
-- XCB[XINERAMA]: Found component XINERAMA
-- Found XCB: /usr/lib/x86_64-linux-gnu/libxcb.so;/usr/lib/x86_64-linux-gnu/libxcb-shm.so;/usr/lib/x86_64-linux-gnu/libxcb-xfixes.so;/usr/lib/x86_64-linux-gnu/libxcb-xinerama.so
-- Found jack: /usr/lib/x86_64-linux-gnu/libjack.so
-- Found FFmpeg: /usr/local/lib/../lib/libavcodec.a (found version "57.1.100") found components:  avcodec avfilter avdevice avutil swscale avformat swresample
-- Found FFmpeg: /usr/local/lib/../lib/libavcodec.a (found version "57.1.100") found components:  avcodec avutil avformat
-- Configuring done
-- Generating done
-- Build files have been written to: /*REMOVED*/obs-studio/obs-studio-v150912/build

I also did compile FFMPEG from GIT the 12th of this month. Any suggestions getting this to compile would be welcomed. Regardless, this is a wonderful project for Linux users, who don't have any good method of streaming video.

Finally, some system info:
Code:
INFO: Debian 8.2 64-bit, NVidia GTX 970
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 970/PCIe/SSE2
OpenGL core profile version string: 4.4.0 NVIDIA 355.00.05
OpenGL core profile shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.0 NVIDIA 355.00.05
OpenGL shading language version string: 4.50 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 355.00.05
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

Thank you.
 

admalledd

Member
Your ffmpeg looks like you compiled it yourself. It was compiled into its default static-build. you need to recompile ffmpeg with "--enable-shared"

Here is the ffmpeg config I used until I found a PPA (since I am on a ubuntu derivative)
Code:
./configure --prefix="$INSTALLROOT" --extra-cflags="-I$INSTALLROOT/include" \
  --extra-ldflags="-L$INSTALLROOT/lib" --extra-libs="-ldl" --enable-gpl \
  --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus \
  --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab \
  --enable-shared
 

toothpick

New Member
Your ffmpeg looks like you compiled it yourself. It was compiled into its default static-build. you need to recompile ffmpeg with "--enable-shared"

Here is the ffmpeg config I used until I found a PPA (since I am on a ubuntu derivative)...

Indeed one or more of those options are what was needed. I'm sure I compiled FFMPEG with "--enable-shared" and something else (assuming my memory is serving me correctly), but regardless it worked, thank you. For some reason, the second recompile/reinstall attempt of the above configuration is what OBS liked. Odd fluke, but none the less it worked in the end.

Again, thank you for your help. I'm sure this thread will also help others using Debian.
 
Top