如何修改librtmp Makefile删除版本后缀? [英] How to modify librtmp Makefile to remove version suffix?

查看:152
本文介绍了如何修改librtmp Makefile删除版本后缀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,librtmp编译生成librtmp.so.1文件和符号链接librtmp.so.我需要没有数字后缀的librtmp.so,因为andorid不支持它.

By default librtmp compile produces librtmp.so.1 file and symlink librtmp.so. I need to have librtmp.so without number suffix as andorid does not support it.

我能够修改Makefile以获得librtmp.so文件:

I was able to modify Makefile to get librtmp.so file:

#SO_VERSION=1
#SO_posix=.${SOX}.${SO_VERSION}
SO_posix=${SOX}

因此文件生成的文件现在为librtmp.so

so the file produced file is now librtmp.so

但是android无法加载它,因为它仍然尝试加载librtmp.so.(带点):

But android can't load it as it still tries to load librtmp.so. (with dot):

Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]:   170 could not load needed library 'librtmp.so.' for 'libffmpeg.so' (load_library[1093]: Library 'librtmp.so.' not found)

推荐答案

如果共享库的DT_SONAME动态标记为foobar.so.56,则无论您称呼什么实际文件(例如foo.so),当您使用该库链接可执行文件时,SONAME会记录在可执行文件中(作为DT_NEEDED动态标记),而不是实际的文件名.

If a shared library has DT_SONAME dynamic tag of foobar.so.56, then no matter what you call the actual file (e.g. foo.so, or libbar.so), when you use that library to link an executable, the SONAME is recorded in the executable (as DT_NEEDED dynamic tag), and not the actual file name.

因此,您的librtmp.soDT_SONAMElibrtmp.so..您可以通过以下方式确认这一点:

It follows that your librtmp.so has a DT_SONAME of librtmp.so.. You can confirm that with:

readelf -d librtmp.so | grep SONAME

那么,要摆脱SONAME,您需要做什么?摆脱Makefile中某个位置的-Wl,--soname=....

So what do you need to do to get rid of SONAME? Get rid of -Wl,--soname=... somewhere in your Makefile.

如何检查可执行文件是否使用SONAME或文件名

可执行文件将始终使用SONAME(如果存在).您可以通过在可执行文件的动态部分中查找DT_NEEDED标记来检查可执行文件所需的库:

The executable will always use SONAME (if present). You can check the libraries that executable needs by looking for DT_NEEDED tags in the executable's dynamic section:

readelf -d a.out | grep NEEDED 

这篇关于如何修改librtmp Makefile删除版本后缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆