[FFmpeg-user] ffmpeg built static, yet "libopenjp2.so.7: cannot open shared object file"

Reindl Harald h.reindl at thelounge.net
Sun Aug 13 16:29:33 EEST 2017



Am 13.08.2017 um 15:19 schrieb tlum:
> On 8/13/2017 6:58 AM, Reindl Harald [via FFmpeg-users] wrote:
> Lets try and keep this topic on the topic of linking the static
> libopenjp2.a and away from religious dogma please.

you did not provide any useful informations how you built excatly

> Correct me if I'm mistaken, but AFAIK, ffmpeg does not maintain an
> srpm?. In any event, that would be tricky to do for static builds, given
> the licensing

what the hell has licensing with rpmbuild to do?

don't be silly - there is no legal differnce between let spit "make 
install" directly into the system or in the buildroot - licensing is all 
about distribution and what let you imagine that that case affects 
distribute your own self built package to your own servers - it's all 
about "can i distribute that package for other people"

> So that leaves us with guides like this one
> https://trac.ffmpeg.org/wiki/CompilationGuide/Centos .

no, that leaves you with "write a spec is not rocket science"

> Your constructive feedback is appreciated

just build and link the library proper, see example for x264 and that 
way i can install ffmpeg-libs from fedora-repos for software linked 
agianst it and my /usr/bin/ffmpeg is finally always the latest version 
for CLI
________________________________________

[builduser at testserver:/rpmbuild/SPECS]$ cat x264-latest.spec
%global            snapshot 20170629

Summary:           H264/AVC video encoder (static build)
Name:              x264-latest
Version:           0.152.2851
Release:           1%{?dist}
License:           GPLv2+
Group:             System Environment/Libraries
URL:               https://www.videolan.org/developers/x264.html
Source0:           x264-%{snapshot}.tar.xz
Source1:           x264-snapshot-latest.sh
BuildRequires:     yasm

%description
x264 is a free library for encoding H264/AVC video streams, written from 
scratch

%prep
%setup -q -n x264-%{snapshot}

%build
./configure \
  --prefix=%{_prefix}/local \
  --exec-prefix=%{_prefix}/local \
  --bindir=%{_prefix}/local/bin \
  --libdir=%{_prefix}/local/lib64 \
  --includedir=%{_prefix}/local/include \
  --extra-cflags="%{optflags} -Ofast -ffast-math 
-funsafe-math-optimizations -Wno-pointer-sign -minline-all-stringops 
-fno-strict-aliasing -flto -ffat-lto-objects -fuse-ld=gold 
-fuse-linker-plugin" \
  --extra-ldflags="-Wl,--as-needed -Wl,-z,now -Wl,-z,relro 
-Wl,-z,noexecstack %{optflags} -Ofast -ffast-math 
-funsafe-math-optimizations -Wno-pointer-sign -minline-all-stringops 
-fno-strict-aliasing -flto -ffat-lto-objects -fuse-ld=gold 
-fuse-linker-plugin" \
  --enable-lto \
  --enable-static \
  --enable-pic \
  --enable-strip \
  --disable-avs \
  --disable-cli \
  --disable-ffms \ 
 

  --disable-gpac \ 
 

  --disable-lavf \ 
 

  --disable-opencl \ 
 

  --disable-swscale 
 

%{__make} %{?_smp_mflags} 
 

 
 

%install 
 

make install DESTDIR=%{buildroot} 
 

rm -rf %{buildroot}%{_prefix}/local/bin/ 
 

rm -rf %{buildroot}%{_prefix}/local/lib64/pkgconfig/x264.pc 
 

mkdir %{buildroot}%{_prefix}/local/x264/ 
 

mv %{buildroot}%{_prefix}/local/lib64/libx264.a 
%{buildroot}%{_prefix}/local/x264/
mv %{buildroot}%{_prefix}/local/include/x264.h 
%{buildroot}%{_prefix}/local/x264/
mv %{buildroot}%{_prefix}/local/include/x264_config.h 
%{buildroot}%{_prefix}/local/x264/
strip --strip-unneeded --strip-debug 
%{buildroot}%{_prefix}/local/x264/libx264.a

%files
%{_prefix}/local/x264/libx264.a
%{_prefix}/local/x264/x264.h
%{_prefix}/local/x264/x264_config.h

%changelog
* Thu Jun 29 2017 Reindl Harald <h.reindl at thelounge.net>
- update to upstream snapshot 0.152.2851
________________________________________

[builduser at testserver:/rpmbuild/SPECS]$ cat ffmpeg-latest.spec
%global            snapshot 20170607

Summary:           Audio/Video-Encoder (static build)
Name:              ffmpeg-latest
Version:           3.3.2
Release:           1%{?dist}
License:           GPLv3+
Group:             Applications/Multimedia
URL:               http://ffmpeg.org/
Source0:           ffmpeg-%{snapshot}.tar.xz
Source1:           ffmpeg-snapshot-latest.sh
BuildRequires:     bzip2-devel
BuildRequires:     imlib2-devel
BuildRequires:     lame-devel
BuildRequires:     libtheora-devel
BuildRequires:     x264-latest
BuildRequires:     x265-devel
BuildRequires:     zlib-devel
BuildRequires:     libvpx-devel
BuildRequires:     openssl-devel
BuildRequires:     yasm
Provides:          ffmpeg
Obsoletes:         ffmpeg

%description
FFMpeg is a complete and free Internet live audio and video broadcasting 
solution for Linux

%package           manpages
Group:             Manpages
Summary:           Manpages for ffmpeg-latest
BuildArch:         noarch
%description       manpages

%prep
%setup -q -n ffmpeg-%{snapshot}

%build
mkdir generic
pushd generic
../configure \
  --prefix=%{_prefix}/local \
  --bindir=%{_prefix}/local/bin \
  --mandir=%{_prefix}/local/man \
  --extra-cflags="-I%{_prefix}/local/x264 %{optflags} -Ofast -ffast-math 
-funsafe-math-optimizations -Wno-pointer-sign -minline-all-stringops 
-fno-strict-aliasing -flto -fno-fat-lto-objects -fuse-ld=gold 
-fuse-linker-plugin -Wa,--noexecstack" \
  --extra-ldflags="-I%{_prefix}/local/x264 -L%{_prefix}/local/x264 -ldl 
-Wl,--as-needed -Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack %{optflags} 
-Ofast -ffast-math -funsafe-math-optimizations -Wno-pointer-sign 
-minline-all-stringops -fno-strict-aliasing -flto -fno-fat-lto-objects 
-pie -fPIE -fuse-ld=gold -fuse-linker-plugin -Wa,--noexecstack" \
  --enable-lto \
  --ar=gcc-ar \
  --ranlib=true \
  --enable-nonfree \
  --enable-gpl \
  --enable-pic \
  --enable-version3 \
  --enable-libmp3lame \
  --enable-libtheora \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libvpx \
  --enable-openssl \
  --enable-static \
  --enable-runtime-cpudetect \
  --disable-amd3dnow \
  --disable-amd3dnowext \
  --disable-avdevice \
  --disable-debug \
  --disable-devices \
  --disable-ffplay \
  --disable-ffprobe \
  --disable-ffserver \
  --disable-htmlpages \
  --disable-hwaccels \
  --disable-iconv \
  --disable-libdc1394 \
  --disable-libfreetype \
  --disable-libgsm \
  --disable-libopencore-amrnb \
  --disable-libopencore-amrwb \
  --disable-libopencv \
  --disable-libopenjpeg \
  --disable-libopus \
  --disable-librtmp \
  --disable-libschroedinger \
  --disable-libspeex \
  --disable-libvorbis \
  --disable-libxvid \
  --disable-podpages \
  --disable-postproc \
  --disable-protocol=gopher \
  --disable-shared \
  --disable-txtpages
%{__make} %{?_smp_mflags}
make documentation
popd
CURRENT_DIR=`pwd`
mkdir -p %{buildroot}%{_prefix}/local/bin/
gcc -fPIC -fPIE -pie -Wl,-z,now -Wl,-z,relro,-z,noexecstack 
$CURRENT_DIR/tools/qt-faststart.c -o qt-faststart

%install
pushd generic
make install DESTDIR=%{buildroot}
popd
install -D -m0755 qt-faststart 
"%{buildroot}%{_prefix}/local/bin/qt-faststart"
mkdir %{buildroot}%{_bindir}
ln -s %{_prefix}/local/bin/ffmpeg %{buildroot}%{_bindir}/ffmpeg
rm -rf %{buildroot}%{_prefix}/local/include 
%{buildroot}%{_prefix}/local/lib %{buildroot}%{_prefix}/local/lib64 
%{buildroot}%{_prefix}/local/share
strip -s %{buildroot}%{_prefix}/local/bin/qt-faststart 
%{buildroot}%{_prefix}/local/bin/ffmpeg

%files
%{_prefix}/local/bin/ffmpeg
%{_prefix}/local/bin/qt-faststart
%{_bindir}/ffmpeg

%files manpages
%{_prefix}/local/man/man1/*
%{_prefix}/local/man/man3/*

%changelog
* Thu Jun 29 2017 Reindl Harald <h.reindl at thelounge.net>
- rebuild against x264 0.152.2851


More information about the ffmpeg-user mailing list