cernekee / ics-openconnect

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

dlopen failed: cannot locate symbol "in6addr_any" referenced by "******/lib/arm64/libopenconnect".so #37

Open langlangsAgo opened 5 years ago

langlangsAgo commented 5 years ago

the problem crash by LeMobile phone. when System.loadLibrary("openconnect")

logcat:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "in6addr_any" referenced by "/data/app/com.example.test-1/lib/arm64/libopenconnect.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
atcom.example.test.application.MeApplication.onCreate(MeApplication.kt:58)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1018)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5207)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1659)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5981)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)
cernekee commented 5 years ago

referenced by "/data/app/com.example.test-1/lib/arm64/libopenconnect.so"

Doesn't look familiar to me. What app is this? How was the library built?

cannot locate symbol "in6addr_any"

Possibly related: this symbol is an extern in API level 24 (Nougat) and above. If I run make_standalone_toolchain.py from NDK r17b twice, once for API level 18 (JB) and once for API level 28 (Pie), only the API 28 libc.so stub includes this symbol. This leads me to wonder if the toolchain used to build your copy of libopenconnect.so is using an API level that is higher than what the device is actually running. i.e. the library was compiled expecting libc.so to provide this symbol, but libc.so on the device is too old to have it.

Is the device's OS older or newer than Nougat?

andrew-sharapo commented 5 years ago

Hi,

Just want to confirm the issue with arm64 version of libopenconnect.so on Android 5 & 6. At the same time, 32-bit lib works fine, so I'm pretty sure it is due to: CFLAGS_arm64 := -Os -D__ANDROID_API__=26 While for 32 (armeabi) it's 14 in: Makefile

Is there a reason to have the API = 26 for arm64 and 21 for x86_64?

cernekee commented 5 years ago

Is there a reason to have the API = 26 for arm64 and 21 for x86_64?

This does look suspicious. make_standalone_toolchain on r17c will take API 21 for both x86_64 and arm64. If I rebuild the ARM64 library with API=21, it compiles and passes a basic smoke test.

The original commit was here. Let's test with 21 for a while and see if anything breaks.

andrew-sharapo commented 5 years ago

Hi Kevin,

Testing of arm64 targeted to API=21 build works fine on devices with Android 5 & 6 so far. Will post another update in a couple of days.

andrew-sharapo commented 5 years ago

To follow on the above, targeting arm64 build to API 21 fixes the issue, and it doesn't seem to have any side effects.