ncubrian
ncubrian

Reputation: 431

build libcurl without soname

I'm trying to build libcurl with ndk r7 in ubuntu and get libcurl.so.5.3.0, its soname is libcurl.so.5. And I also have a libxxx.so which uses libcurl.so. When I use System.loadLibrary("curl"); and System.loadLibrary("xxx"); in android app, I got E/AndroidRuntime(361): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load libcurl.so.5: findLibrary returned null. Does anyone know how to build libcurl.so without a soname or make the soname libcurl.so or how to load libcurl.so.5 in Java. I note that near the end of building libcurl, there's this line -Wl,-soname -Wl,libcurl.so.5 -o .libs/libcurl.so.5.3.0. I don't know where this comes from. Thanks a lot!

Upvotes: 1

Views: 648

Answers (1)

aarontang
aarontang

Reputation: 239

It seems the libcurl.so is a soft link of libcurl.so.5, and the System.loadLibrary can't find the real libcurl.so.5.

You can have a try: rename the libcurl.so.5 to libcurl.so. And try to load it from java again.

Another way: you can direct use libcurl.a instead of libcurl.so to build it in your project. So you needn't load libcurl.so in Java anymore.

Hope it helps.

Upvotes: 2

Related Questions