rust-ffmpeg icon indicating copy to clipboard operation
rust-ffmpeg copied to clipboard

Can't find libpostproc.so during linking process .

Open Ticsmtc opened this issue 3 years ago • 3 comments

Env: Os: Linux (opensuse) ffmpeg version use : 4.3.2

Step 1:

cross compile ffmpeg using musl

#!/bin/bash

export PATH=/home/even/build/armv7l-linux-musleabihf-cross/bin:$PATH
export sysroot=/home/even/build/armv7l-linux-musleabihf-cross

./configure \
        --prefix=$sysroot \
        --sysroot=$sysroot \
        --cross-prefix=armv7l-linux-musleabihf- \
        --arch=arm \
        --target-os=linux \
        --host-os=linux \
        --enable-cross-compile \
        --extra-cflags="-I${sysroot}/include -march=armv7 -mfpu=vfp -mfloat-abi=hard" \
        --extra-ldflags="-L${sysroot}/lib" \
        --enable-shared \
        --enable-static \
        --enable-gpl \
        --enable-nonfree \
        --enable-ffmpeg \
        --disable-ffplay \
        --enable-swscale \
        --enable-pthreads \
        --disable-armv5te \
        --disable-armv6 \
        --disable-armv6t2 \
        --disable-yasm \
        --disable-stripping 
        
make uninstall
make clean
make -j14
make install

new project

.
├── build.rs
├── .cargo
│   └── config.toml
├── Cargo.lock
├── Cargo.toml
├── cross_build.sh
└── src
    └── main.rs

.cargo/config.toml

[target.armv7-unknown-linux-musleabihf]
linker = "/home/even/build/armv7l-linux-musleabihf-cross/bin/armv7l-linux-musleabihf-gcc"
ar = "/home/even/build/armv7l-linux-musleabihf-cross/bin/armv7l-linux-musleabihf-ar"

cross_build.sh

#!/bin/bash


#clean
cargo clean

#env
export PKG_CONFIG_PATH_armv7_unknown_linux_musleabihf=/home/even/build/armv7l-linux-musleabihf-cross/usr/lib/pkgconfig
export PKG_CONFIG_armv7_unknown_linux_musleabihf=/home/even/build/armv7l-linux-musleabihf-cross/usr/lib/pkgconfig

export PKG_CONFIG_ALLOW_CROSS=1
cargo build --target="armv7-unknown-linux-musleabihf" --verbose

Problem

error: linking with `/home/even/build/armv7l-linux-musleabihf-cross/bin/armv7l-linux-musleabihf-gcc` failed: exit code: 1

/home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: warning: libpostproc.so.55, needed by /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so, not found (try using -rpath or -rpath-link)
          /home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so: undefined reference to `pp_free_mode@LIBPOSTPROC_55'
          /home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so: undefined reference to `pp_free_context@LIBPOSTPROC_55'
          /home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so: undefined reference to `pp_postprocess@LIBPOSTPROC_55'
          /home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so: undefined reference to `pp_get_context@LIBPOSTPROC_55'
          /home/even/build/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/10.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /home/even/build/armv7l-linux-musleabihf-cross/lib/libavfilter.so: undefined reference to `pp_get_mode_by_name_and_quality@LIBPOSTPROC_55'

seems that libpostproc.so not be found or some of the reference missing in libpostproc.so , but i am sure it exist in the same directory with libavutil.so etc. so i think the search path of ld is correct.

Ticsmtc avatar Aug 01 '21 10:08 Ticsmtc

temporary solved by adding --disable-postproc to ffmpeg compile configure args .

Ticsmtc avatar Aug 01 '21 15:08 Ticsmtc

Did you managed to solve this problem somehow? I would like to make a static rust binary when using this ffmpeg-next crate (so without a need to provide libav*.so libraries on the host system). Am I right that this is not currently possible?

manio avatar Jan 08 '22 04:01 manio

Did you managed to solve this problem somehow? I would like to make a static rust binary when using this ffmpeg-next crate (so without a need to provide libav*.so libraries on the host system). Am I right that this is not currently possible?

emmm, i slove it by building a custom docker image using rust tool called cross , i complied ffmpeg inside image and work fine. you can try that.

and , maybe ffmpeg-next using static lib by defult ? somehow i use single executable running fine on my board(arm32 , no ffmpeg in system ) . but when building it , it says link .so , wired .

Ticsmtc avatar Jan 08 '22 07:01 Ticsmtc