Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/bind: Android app with Go library and targetSdkVersion=23 crashes on Android 6 #12890

Closed
ekrivenja opened this issue Oct 9, 2015 · 11 comments

Comments

@ekrivenja
Copy link

I have some prototype app with Go library, built with gomobile bind command.
Until today I was building it with targetSdkVersion=22 and all worked fine, include Android 6.
Today I decided to rebuild it with targetSdkVersion=23 and got an Exception on my Nexus with Android 6:

E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/my.app.package/lib/arm/libgojni.so: has text relocations
E/AndroidRuntime:     at java.lang.Runtime.loadLibrary(Runtime.java:372)
E/AndroidRuntime:     at java.lang.System.loadLibrary(System.java:1076)
E/AndroidRuntime:     at go.LoadJNI.(LoadJNI.java:5)
E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
E/AndroidRuntime:     at java.lang.Class.forName(Class.java:285)
E/AndroidRuntime:     at go.Seq.(Seq.java:23)
-= skipped library calls to have it shortest=-
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:818)

I think, the problem is very similar to
http://stackoverflow.com/questions/32346402/libavcodec-so-has-text-relocations

gomobile version +83be1bf Thu Oct 8 21:24:20 2015 +0000 (android); androidSDK=C:\Android\android-sdk\platforms\android-23
@ekrivenja
Copy link
Author

In case I run same app, but built with targetSdkVersion=22, on same device, it shows me just warnings:

W/linker: /data/app/my.app.package/lib/arm/libgojni.so: is missing DT_SONAME will use basename as a replacement: "libgojni.so"
W/linker: /data/app/my.app.package/lib/arm/libgojni.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

@hyangah
Copy link
Contributor

hyangah commented Oct 9, 2015

It seems it's related to #9210 which is blocked by #12581

cc @crawshaw

@crawshaw
Copy link
Member

@ekrivenja I believe this is fixed. Could you run get -u golang.org/x/mobile/cmd/gomobile && gomobile init and rebuild? If that doesn't fix this, please reopen this issue.

@ekrivenja
Copy link
Author

gomobile version +82d11f2 Tue Oct 13 19:59:19 2015 +0000 (android); androidSDK=C:\Android\android-sdk\platforms\android-23

Sorry, but the issue is still there, same exception with targetSdkVersion=23, same warnings with with targetSdkVersion=22

@ekrivenja
Copy link
Author

@crawshaw, I cannot reopen this issue, because you closed it, I think.

@hyangah
Copy link
Contributor

hyangah commented Oct 16, 2015

reopened it.

@hyangah hyangah reopened this Oct 16, 2015
@crawshaw
Copy link
Member

Are you using Go tip?

@ekrivenja
Copy link
Author

What do you mean "Go tip"? I don't understand, sorry.

@hyangah
Copy link
Contributor

hyangah commented Oct 16, 2015

It means the development version which is not released yet.
What does 'go version' command say?

The fix is in the source tree now and will be officially available with 1.6.
To test the fix, you can follow the instruction here
https://golang.org/doc/install/source
And use the master branch.

@ekrivenja
Copy link
Author

@hyangah, thank you, now I understand. I thought only gomobile was fixed.
I am using Go 1.5.1 now.

 go version go1.5.1 windows/amd64 

I'll try master branch.

@ekrivenja
Copy link
Author

Master branch was used

go version devel +9358f7f Fri Oct 16 15:51:49 2015 +0000 windows/amd64 

In case of targetSdkVersion=22 I see only one warning now

W/linker: /data/app/my.app.package/lib/arm/libgojni.so: is missing DT_SONAME will use basename as a replacement: "libgojni.so"

In case of targetSdkVersion=23, no warnings, no exceptions.
It is fixed, thank you!
Closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants