0

I have built OpenSSL for Android. This has generated a so with an extension in the format .so.1.0.0, and a symlink with the extension.so. This of course is a problem for Android, as it expects all shared libraries to have an extension in the format .so.

(Additionally, I have some other prebuilt libraries that require on a file with the name libssl.so.)

Therefore I need a library to end with .so, and all libraries that depend on it to link to a file with the extension .so. The OpenSSL instructions here: http://wiki.openssl.org/index.php/Android suggest renaming the file to libssl.so. Which I have done.

However, the library still has the soname "libssl.so.1.0.0" When I try and build my own libraries (which also need openSSL) using the ajb-tools (https://subversion.assembla.com/svn/ajb-tools/trunk/android/android-cross/android-cross), using -lopenssl it generates shared objects which apparently require the library file in the format libssl.so.1.0.0, a file that didn't exist anymore at build time. At runtime, the Android app complains it can't find this file.

I have tried putting -l:libssl.so in the makefile of my library, to no avail. readelf -d still reports my libraries need libssl.so.1.0.0.

Is there any way to force a library to link to a specific file name. Or do I have to build OpenSSL in such a way that it generates a library that has its soname set to ".so"?

rod
  • 3,403
  • 4
  • 19
  • 25
  • I managed to build a version-less `libcrypto.so`, see http://stackoverflow.com/a/33869277/4735903. – Loic Nov 23 '15 at 11:00

2 Answers2

1

In the end I manually edited OpenSSL's Makefile.shared, and altered the -soname argument in the shared library build to omit the version name. This worked. Although I'm sure a more elegant solution can be found.

rod
  • 3,403
  • 4
  • 19
  • 25
  • 1
    note tha **libssl.so** is very hard to use in an Android app, because file with such name exists in `/system/lib` directory in the typical Android distribution, and this directory takes precedence over your app private lib directory. On one hand, this may mean that you can rely on the system lib and not waste your time to build and maintain OpenSSL. But if your app needs some features or fixes that are not there in the system lib, you must rename the library, and make sure that all references point to the new renamed one. `libssl.1.0.0.so` would be an option. – Alex Cohn Oct 15 '14 at 10:03
0

as you know, Android require unversion library.
my suggestion to you is write an Android.mk and use ndk-build.
example: see libusbx (https://github.com/libusb/libusb)

Kuldeep Dhaka
  • 533
  • 5
  • 22