In order to run ogg123 (for getting wav from ogg vorbis) I need to get (not found) or compile static build. I tried this on Amazon Linux (the same version as current AWS Lambda):

./configure --disable-shared --enable-static
make LDFLAGS=-lm SHARED=0 CC='gcc -static'

Produced ogg123 filesize is 288K but when I copied that file to another Amazon Linux and tried to run I get error while loading shared libraries: libvorbisfile.so.3: cannot open shared object file: No such file or directory

  • It looks like this wasn't static build. One comment, it might be better to also supply -fPIC gcc flag although that won't solve this particular problem. Can you post a link to the source code that you're trying to compile?
    – bytefire
    Oct 18, 2017 at 14:44
  • The source code of ogg123 is here github.com/xiph/vorbis-tools/tree/master/ogg123 Oct 18, 2017 at 15:47

1 Answer 1


If you only want to decode wav from ogg vorbis, you can simply use oggdec utility to do that, instead of ogg123 (which has more dependencies).

To build a "static" version of oggdec, you will first need to build static versions of libogg and libvorbis libraries, like this:

#Create staging directory
mkdir -p $STAGING

mkdir -p $SRC

#Build artifacts
mkdir -p $OUT

#Build a static version of "libogg"
wget downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.xz -qO-|tar -C $SRC -xJ
pushd $SRC/libogg*/
./configure --prefix=$OUT --disable-shared
make install

#Build a static version of "libvorbis"
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz -qO-|tar -C $SRC -xJ
pushd $SRC/libvorbis*/
./configure --prefix=$OUT LDFLAGS="-L$OUT/lib" CPPFLAGS="-I$OUT/include" --disable-shared
make install

Now you can build oggdec (vorbis-tools), statically linked to libogg and libvorbis:

#Build "vorbis-tools"
wget downloads.xiph.org/releases/vorbis/vorbis-tools-1.4.0.tar.gz -qO- | tar -C $SRC -xz
pushd $SRC/vorbis-tools*/
./configure LDFLAGS="-L$OUT/lib" CPPFLAGS="-I$OUT/include"

You can use ldd, to check the list of dependencies for your newly built oggdec binary:

ldd $SRC/vorbis-tools*/oggdec/oggdec

linux-vdso.so.1 (0x00007ffc85792000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbcba839000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbcba48e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbcbab3a000)

The resulting binary is not really fully "static", as it still exposes dependency on some system libraries (in particular "libc" and "libm"), but that should be just fine for running it under "Amazon Linux".

  • Awesome advice, helped me out a lot statically linking a similar set of utilities! Feb 23, 2018 at 21:00
  • Works for oggenc, thank you again. Apr 10, 2019 at 12:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .