Skip to content

Commit 2a3bb81

Browse files
committed
Use lld to link on OSX with LLVM 13
1 parent 0e5e33e commit 2a3bb81

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

genbindings.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ rm src/main/java/org/ldk/enums/*.class src/main/java/org/ldk/impl/bindings*.clas
8686

8787
IS_MAC=false
8888
[ "$($CC --version | grep apple-darwin)" != "" ] && IS_MAC=true
89+
IS_APPLE_CLANG=false
90+
[ "$($CC --version | grep "Apple clang version")" != "" ] && IS_APPLE_CLANG=true
8991

9092
echo "Building Java bindings..."
9193
COMPILE="$COMMON_COMPILE -mcpu=$LDK_TARGET_CPU -Isrc/main/jni -pthread -ldl -shared -fPIC"
9294
[ "$IS_MAC" = "false" ] && COMPILE="$COMPILE -Wl,--no-undefined"
9395
[ "$IS_MAC" = "true" ] && COMPILE="$COMPILE -mmacosx-version-min=10.9"
96+
[ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && COMPILE="$COMPILE -fuse-ld=lld"
97+
[ "$IS_MAC" = "true" -a "$IS_APPLE_CLANG" = "false" ] && echo "WARNING: Need at least upstream clang 13!"
9498
[ "$IS_MAC" = "false" -a "$3" != "false" ] && COMPILE="$COMPILE -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,malloc -Wl,-wrap,free"
9599
if [ "$3" = "true" ]; then
96100
$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

0 commit comments

Comments
 (0)