Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to build ffmpeg shared libraries without version suffix

is there a way i can configure to build ffmpeg shared libraries for android without version number suffixes? im able to build with different options but always get files like "libavcodec.so.57". i would need the libraries without suffixes like "libavcodec.so". i thought the option "--disable-symver" would do the trick but unfortunately it didn't. the problem is that i have a library (.so file) that depends on ffmpeg shared libraries without suffixes and therefore can't load those im getting built. i have followed mostly the instructions here.

like image 518
andruido Avatar asked Apr 28 '16 10:04

andruido


2 Answers

asking questions leads always to finding answers. that's why i was successful, digging into the make files helped. do the following:

  • run your configuration
  • find "config.mak"
  • change

    SLIBNAME_WITH_VERSION=$(SLIBNAME).$(LIBVERSION) SLIBNAME_WITH_MAJOR=$(SLIBNAME).$(LIBMAJOR)

    to:

    SLIBNAME_WITH_VERSION=$(SLIBNAME)
    SLIBNAME_WITH_MAJOR=$(SLIBNAME)

  • change

    SLIB_INSTALL_NAME=$(SLIBNAME_WITH_VERSION) SLIB_INSTALL_LINKS=$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)

    to:

    SLIB_INSTALL_NAME=$(SLIBNAME)
    SLIB_INSTALL_LINKS=

  • run "make" or "make -j$(nproc)"

  • "make install"

now you will have shared libraries without suffixes.
you can check their dependencies by "readelf -d somefile.so"

like image 108
andruido Avatar answered Oct 27 '22 17:10

andruido


No need to change config.mak

Just add --target-os=android to configure call

My example

NDK=${HOME}/android-sdk-linux/ndk-bundle
ABI=arm

./configure \
    --arch=$ABI \
    --target-os=android \
    --disable-everything \
    --disable-symver \
    --enable-runtime-cpudetect \
    --enable-pic \
    --enable-shared \
    --disable-static \
    --prefix=../build/$ABI \
    --cross-prefix=$NDK/toolchains/$ABI-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/$ABI-linux-androideabi- \
    --sysroot=$NDK/platforms/android-26/arch-$ABI \
    --extra-cflags="-march=armv7-a -mfloat-abi=softfp -fPIC -DANDROID" \
    --extra-ldflags="" \
    || exit 1

    make clean
    make -j4 || exit 1
    make install || exit 1
like image 23
MaxF Avatar answered Oct 27 '22 16:10

MaxF