cernekee / ics-openconnect

Android UI for OpenConnect VPN client
GNU General Public License v2.0
358 stars 129 forks source link

libopenconnect.so has text relocations #35

Closed andrew-sharapo closed 5 years ago

andrew-sharapo commented 5 years ago

There is a closed issue related to this error: https://github.com/cernekee/ics-openconnect/issues/7 But it was closed without any actually good solution. Lowering the target SDK version doesn't seem to be a good approach.

To clarify: it still fails with a latest code version, despite there is a commit: https://github.com/cernekee/openconnect/commit/b31ca89f298644c271e49addeea6bbedc34b079c that seems to be related, and potentially should fix the issue (however, it seems like it didn't)

Going to try to use latest versions of gmp and gnutls libs, but maybe somebody has a solution already?

cernekee commented 5 years ago

Lowering the target SDK version doesn't seem to be a good approach.

Agreed, and the Play Store is going to be enforcing a minimum target SDK version later this year.

To clarify: it still fails with a latest code version

How are you testing this? Did you rebuild the libraries from source?

Are you on arm, arm64, or something else?

I've been running the ics-openconnect master branch on Android O for several months, and haven't seen the nag toast since I applied the fix. The fix will be in the next release.

andrew-sharapo commented 5 years ago

More details:

The runtime error message is:

java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/{APP_ID}/lib/arm/libopenconnect.so: has text relocations

So it is a case for ARM. Thing worth to mention:

Another thing: readelf/scanelf do not show TEXTRELs in openconnect.so, which is strange ...

Also, the app crashes with same error if instead of rebuilding I just use these files: openconnect-wrapper.jar & stoken-wrapper.jar to compile the app.

Some of my findings: 1) There could be an issue with GMP being a static lib. Going to try and add GMP as shared library. https://stackoverflow.com/questions/39232794/shared-library-using-static-gnutls-library-has-text-relocations 2) Build some (or all) libs with API_LEVEL := 26 instead of 14 for arm may help: https://gmplib.org/list-archives/gmp-discuss/2017-May/006109.html https://github.com/Rupan/gmp

Going to try the above and post an update.

andrew-sharapo commented 5 years ago

Hi,

I am so sorry about this, but the problem was with my local environment: I had a custom setup of a project, with a wrong symlink for jni. So I was trying to launch the app with old jni (before --with-pic change was commited, and probably few other changes) and new jar.

I can confirm that the latest codebase works fine with target SDK > 22 on all android devices (tested on multiple arm & arm64 phones).

Sorry for a false-positive alert.

lnpusong123 commented 5 years ago

Hi bro, can you send me your new artifacts? I use the author new artifacts and encounter MTU problem, I wanna check if my build is wrong. Thank you very much.