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)
有帮助吗?

解决方案

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 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top