Not actually static?
djcp opened this issue · 12 comments
When I run this on a debian jessie machine, and run ldd bin/ffmpeg
, it doesn't look like this is actually generating a statically compiled binary. Tons of libraries are getting dynamically linked in.
If it were a totally static binary, ldd would return not a dynamic executable
.
I was hoping this project would result in a completely portable 64-bit binary but it doesn't appear to. Have I got this wrong? Thanks in advance.
I'm seeing the same. The README seems to note a few "remaining" libraries on OS X (and ldd shows no dynamic libraries on ubuntu), but when run on Arch, the resulting binary is dynamically linked to more than 30 system libraries.
same here on Centos 7
It seems like both arch and centos do not ship *.a object files in -devel packages (or main packages in Arch), checked on libass package.
Does anyone here know how or where I can find a trustworthy guide to compile a truly 100% static version of FFmpeg on Ubuntu x64?
Here are the dependencies I got using this script:
$ ldd ffmpeg
linux-vdso.so.1 => (0x00007ffc368dd000)
libva.so.1 => /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007f7c793f5000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f7c791d3000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f7c78fce000)
libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007f7c78dc6000)
libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007f7c78bc2000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f7c78887000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f7c78587000)
libSDL-1.2.so.0 => /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0 (0x00007f7c782ee000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7c780d0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7c77dc7000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7c77a45000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7c7783c000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7c77638000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f7c7738f000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f7c77162000)
libtheoraenc.so.1 => /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007f7c76f23000)
libtheoradec.so.1 => /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007f7c76d09000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f7c76a5e000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7c76844000)
libass.so.5 => /usr/lib/x86_64-linux-gnu/libass.so.5 (0x00007f7c76614000)
libvdpau.so.1 => /usr/lib/x86_64-linux-gnu/libvdpau.so.1 (0x00007f7c7640f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7c76046000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f7c75e42000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f7c75c3b000)
/lib64/ld-linux-x86-64.so.2 (0x0000557a64792000)
libpulse-simple.so.0 => /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0 (0x00007f7c75a36000)
libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007f7c757e6000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f7c755d4000)
libcaca.so.0 => /usr/lib/x86_64-linux-gnu/libcaca.so.0 (0x00007f7c7530b000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7c750f4000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f7c74eeb000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f7c74cc5000)
libfribidi.so.0 => /usr/lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007f7c74aae000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f7c7486b000)
libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f7c7460c000)
libpulsecommon-8.0.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so (0x00007f7c74392 000)
libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007f7c74186000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f7c73f3a000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007f7c73bae000)
libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f7c7397e000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f7c73755000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f7c7352c000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7c7321a000)
libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f7c72ff5000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f7c72f70000)
libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007f7c72d65000)
libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007f7c72afc000)
libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007f7c728f6000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f7c72685000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f7c72463000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f7c72240000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f7c71f5f000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f7c71d46000)
libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007f7c71ad0000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f7c718b5000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f7c716a0000)
Same here, why is the binary still dynamically linked though its explicitely called static? Without any warnings even..
When I initially started this project the list of non-static dependencies was fairly small. Because it's using the glibc there are always going to be a couple of non-static things (like pthread and GL libs) but this has grown out of hand.
I don't have the time to maintain this project. If anyone wants to step-up I'm happy to give access to the repo or even transfer it.
I have looked into this issue a little. You can get a fully static build of ffmpeg without the --enable-libass
flag using the changes below:
$ git diff
diff --git a/build.sh b/build.sh
index a2595ed..6d04cc2 100755
--- a/build.sh
+++ b/build.sh
@@ -171,13 +171,12 @@ cd $BUILD_DIR/FFmpeg*
PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig" ./configure \
--prefix="$TARGET_DIR" \
--pkg-config-flags="--static" \
- --extra-cflags="-I$TARGET_DIR/include" \
- --extra-ldflags="-L$TARGET_DIR/lib" \
+ --extra-cflags="-I$TARGET_DIR/include -static" \
+ --extra-ldflags="-L$TARGET_DIR/lib -static" \
--bindir="$BIN_DIR" \
--enable-ffplay \
--enable-ffserver \
--enable-gpl \
- --enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
$ ldd bin/ffmpeg
not a dynamic executable
Whether this is good enough, I don't know. However, it looks like a fully static build with libass will be harder to achieve. We can compile a static version of libass from source, but static versions of libgraphite2 and libfribidi are not available in Debian, and this Debian mailing list thread seems to indicate there are no plans to add them any time soon. What's more, libgraphite2 doesn't even seem to have a way to produce a static build out-of-the-box.
If anyone has any ideas, I could look into them, but otherwise I will set this aside for now.
👍 for removing features if they can't be statically compiled. That's the main goal of this project after all.
if you're still interested in transferring this project, I could take over. I need a static ffmpeg for a couple of platforms.
there are already a couple of people helping out sporadically. If you submit a useful PR I don't mind adding you as a collaborator as well.