How to modify librtmp Makefile to remove version suffix?

随声附和 提交于 2019-12-08 04:13:55

问题


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.

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

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

so the file produced file is now 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)

回答1:


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.

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

readelf -d librtmp.so | grep SONAME

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

how can i check executable if it uses SONAME or filename

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 


来源:https://stackoverflow.com/questions/23155401/how-to-modify-librtmp-makefile-to-remove-version-suffix

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