]> git.bitcoin.ninja Git - ldk-java/commitdiff
Use lld to link on OSX with LLVM 13
authorMatt Corallo <git@bluematt.me>
Mon, 18 Oct 2021 21:40:23 +0000 (21:40 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 18 Oct 2021 21:40:23 +0000 (21:40 +0000)
genbindings.sh

index 4cb6502b4235b18bd6a53c5c3fe7bcd53e4b3803..912cc1cdce44e892d349291de5a179c064f67a7c 100755 (executable)
@@ -86,11 +86,15 @@ rm src/main/java/org/ldk/enums/*.class src/main/java/org/ldk/impl/bindings*.clas
 
 IS_MAC=false
 [ "$($CC --version | grep apple-darwin)" != "" ] && IS_MAC=true
+IS_APPLE_CLANG=false
+[ "$($CC --version | grep "Apple clang version")" != "" ] && IS_APPLE_CLANG=true
 
 echo "Building Java bindings..."
 COMPILE="$COMMON_COMPILE -mcpu=$LDK_TARGET_CPU -Isrc/main/jni -pthread -ldl -shared -fPIC"
 [ "$IS_MAC" = "false" ] && COMPILE="$COMPILE -Wl,--no-undefined"
 [ "$IS_MAC" = "true" ] && COMPILE="$COMPILE -mmacosx-version-min=10.9"
+[ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && COMPILE="$COMPILE -fuse-ld=lld"
+[ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && echo "WARNING: Need at least upstream clang 13!"
 [ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free"
 if [ "$3" = "true" ]; then
        $COMPILE -o liblightningjni_debug$LDK_TARGET_SUFFIX.so -g -fsanitize=address -shared-libasan -rdynamic -I"$1"/lightning-c-bindings/include/ $2 src/main/jni/bindings.c "$1"/lightning-c-bindings/target/$LDK_TARGET/debug/libldk.a -lm