how to build ffmpeg shared libraries without version suffix

穿精又带淫゛_ 提交于 2019-12-09 12:59:46

问题


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.


回答1:


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"




回答2:


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


来源:https://stackoverflow.com/questions/36911982/how-to-build-ffmpeg-shared-libraries-without-version-suffix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!