Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
x/mobile: ndk-build finds wrong library path for dlopen #17807
go version go1.7.1 darwin/amd64
gomobile version +6ecf8ee Sun Oct 16 10:25:40 2016
On the gomobile example directory, create an Android binding library :
extract the so library from the resulting aar.
add the result to the sample project (the same thing as gperf)
without even referencing the function on the main cpp, build the project (gradle build) --> build successful
install the resulting apk
What did you expect to see?
a working app
What did you see instead?
java.lang.UnsatisfiedLinkError: dlopen failed: library "/Users/me/Desktop/vm-win/ndk-build-golang/hello-libs-2/app/src/main/cpp/../../../../distribution/libgo/lib/arm64-v8a/libgojni.so" not found
after decomposing the code and focusing only on the library build (basic ndk project) I still get the same thing :
When I check the symbols on the intermediate library (libhello-libs.so) I see that the libgojni.so is referenced with a full path instead of just the filename (which is the case of a C-based library)
(both libraries are at the same level when I extract the apk)
A C-based library is working but not the Go-based one. Maybe the latter is missing something ?
I've uploaded a buildable project to https://github.com/ab-smith/ndk-build-golang
I can make it work by patching the libhello-libs.so and fixing the path binary, but this is not a solution.
changed the title from
Gomobile/ndk-build wrong library path for dlopen
x/mobile: ndk-build finds wrong library path for dlopen
Nov 7, 2016
The issue here is that gomobile does not set a library SONAME at the linker step for building
To solve the issue you must instruct the linker to set the SONAME value of
You can have a look here for more information about shared library workflow.