Skip to content

Fix Android build openssl-sys error #199

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

Closed

Conversation

alexanderwiederin
Copy link
Contributor

@alexanderwiederin alexanderwiederin commented Nov 17, 2023

Fixes #197 on macos

@alexanderwiederin alexanderwiederin changed the title fix android build Fix Android build openssl-sys error Nov 17, 2023
@alexanderwiederin alexanderwiederin marked this pull request as ready for review November 17, 2023 15:28
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, while this makes the build pass, it doesn't seem to work when I try to run the android tests in the simulator:

!?pr/199 ~/workspace/ldk-node/bindings/kotlin/ldk-node-android> ./gradlew connectedAndroidTest --scan
10:02:08 V/JdwpProxy-Buffer: CLIENT WRITE (4) OKAY
10:02:08 V/JdwpProxy-Buffer: DEVICE WRITE (14) JDWP2dHandshake
10:02:08 V/JdwpProxy-Buffer: CLIENT WRITE (4) OKAY
10:02:08 V/JdwpProxy-Buffer: CLIENT WRITE (14) JDWP2dHandshake
10:02:08 V/JdwpProxy-Buffer: DEVICE WRITE (19) 00013400000ᅦ1REAQ0000
10:02:08 V/JdwpProxy-Buffer: DEVICE WRITE (23) 00017400010ᅦ1HELO00040001
10:02:08 V/JdwpProxy-Buffer: DEVICE WRITE (19) 00013400020ᅦ1FEAT0000
10:02:08 V/JdwpProxy-Buffer: DEVICE WRITE (19) 00013400030ᅦ1MPRQ0000

> Task :lib:connectedDebugAndroidTest
Starting 1 tests on Pixel_2_API_33(AVD) - 13

org.lightningdevkit.ldknode.AndroidLibTest > node_start_stop[Pixel_2_API_33(AVD) - 13] FAILED
        java.lang.UnsatisfiedLinkError: Unable to load library 'ldk_node':
        dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
Tests on Pixel_2_API_33(AVD) - 13 failed: There was 1 failure(s).
Nov 24, 2023 10:02:09 AM com.google.testing.platform.RunnerImpl$Companion summarizeAndLogTestResult
SEVERE: Execute org.lightningdevkit.ldknode.AndroidLibTest.node_start_stop: FAILED
java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: Unable to load library 'ldk_node':
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
Native library (android-aarch64/libldk_node.so) not found in resource path (.)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.load(Native.java:596)
at com.sun.jna.Native.load(Native.java:570)
at org.lightningdevkit.ldknode._UniFFILib$Companion$INSTANCE$2.invoke(ldk_node.kt:3541)
at org.lightningdevkit.ldknode._UniFFILib$Companion$INSTANCE$2.invoke(ldk_node.kt:271)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at org.lightningdevkit.ldknode._UniFFILib$Companion.getINSTANCE$lib_debug(ldk_node.kt:271)
at org.lightningdevkit.ldknode.Builder$Companion.fromConfig(ldk_node.kt:1135)
at org.lightningdevkit.ldknode.AndroidLibTest.node_start_stop(AndroidLibTest.kt:39)
java.lang.UnsatisfiedLinkError: Unable to load library 'ldk_node':
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
dlopen failed: cannot locate symbol "SSL_free" referenced by "/data/app/~~ELJN6QHlbuM0MvGWAxTvxA==/org.lightningdevkit.test-FZ2d9mVnL5hoApMWWG3QxA==/lib/arm64/libldk_node.so"...
Native library (android-aarch64/libldk_node.so) not found in resource path (.)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
at com.sun.jna.Library$Handler.<init>(Library.java:192)
at com.sun.jna.Native.load(Native.java:596)
at com.sun.jna.Native.load(Native.java:570)
at org.lightningdevkit.ldknode._UniFFILib$Companion$INSTANCE$2.invoke(ldk_node.kt:3541)
at org.lightningdevkit.ldknode._UniFFILib$Companion$INSTANCE$2.invoke(ldk_node.kt:271)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at org.lightningdevkit.ldknode._UniFFILib$Companion.getINSTANCE$lib_debug(ldk_node.kt:271)
at org.lightningdevkit.ldknode.Builder$Companion.fromConfig(ldk_node.kt:1135)
at org.lightningdevkit.ldknode.AndroidLibTest.node_start_stop(AndroidLibTest.kt:39)


Test results saved as file:/Users/ero/workspace/ldk-node/bindings/kotlin/ldk-node-android/lib/build/outputs/androidTest-results/connected/Pixel_2_API_33(AVD)%20-%2013/test-result.pb. Inspect these results in Android Studio by selecting Run > Import Tests From File from the menu bar and importing test-result.pb.

> Task :lib:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

So I suspect we'd still try to use native-tls after all which doesn't seem to work on Android?
Could you try to reproduce that on your side?

@@ -1,11 +1,42 @@
#!/bin/bash

BINDINGS_DIR="bindings/kotlin"
TARGET_DIR="target"
PROJECT_DIR="ldk-node-android"
PACKAGE_DIR="org/lightningdevkit/ldknode"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused, let's remove it while we're here.

@tnull
Copy link
Collaborator

tnull commented Nov 24, 2023

To have the Android test build at all you might want to rebase now after #206 landed.

@tnull
Copy link
Collaborator

tnull commented Nov 24, 2023

Closing this for now as #197 has been resolved by #207. However, as discussed elsewhere, we should add the script improvements as part of a PR that adds Android bindings generation to CI.

@tnull tnull closed this Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kotlin bindings generation fails locally
2 participants