FFMS / ffms2

An FFmpeg based source library and Avisynth/VapourSynth plugin for easy frame accurate access
Other
574 stars 104 forks source link

FFMS2 can't be build because of relocation error #410

Closed Josch600 closed 1 year ago

Josch600 commented 1 year ago

Hi, on Ubuntu 22.04 I build ffmpeg using the following commands without error:

git clone https://git.videolan.org/git/ffmpeg.git
cd ffmpeg
./configure --prefix=$HOME/ffmpeg_build --enable-gpl --enable-version3 \
    --disable-doc --disable-debug --enable-pic --enable-avisynth && \
    make -j$(nproc) && \
    make install

Afterwards I tried to build ffms2 using these commands:

git clone https://github.com/ffms/ffms2 && \
cd ffms2
PKG_CONFIG_PATH=$HOME/ffmpeg_build/lib/pkgconfig \
    CPPFLAGS="-I/usr/local/include/avisynth" \
    ./autogen.sh --enable-shared --enable-avisynth && \
make -j$(nproc) && \
    sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-git" \
    --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes \
    --addso=yes --fstrans=no --default

This resulted in the following errors:

/usr/bin/ld: /home/joerg/ffmpeg_build/lib/libswscale.a(swscale.o): warning: relocation against `ff_M24B' in read-only section `.text'
/usr/bin/ld: /home/joerg/ffmpeg_build/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' 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: *** [Makefile:652: src/core/libffms2.la] Fehler 1

I also tried the option --extra-cflags="-fPIC" instead of --enable-pic while building ffmpeg with the same result. I don't know what to do further. Any help is greatly appreciated.

dwbuiten commented 1 year ago

FFmpeg needs to be built as shared if you're going to build FFMS2 as shared.

qyot27 commented 1 year ago

Using a static FFmpeg requires passing LDFLAGS="-Wl,-Bsymbolic" when configuring FFMS2.

While this doesn't affect avs2yuv, the issue is that the shared library dependency loop on FFmpeg can cause anything from no status output to a deadlock when opening an FFMS2 (or LSMASHSource) using script in a shared build of FFmpeg. Either you have to corral two separate sets of shared libraries that don't collide with each other, or one can be shared and one static, or both are static (or even the same build).

Josch600 commented 1 year ago

Thanks, this worked for me.