From 6ff713290fcd464915403ebd67160773885e5cc3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 6 Jul 2021 22:07:42 +0000 Subject: [PATCH] Drop -flto from non-cross-language-lto C++ demo builds It appears somehow the LLVM IR is slipping into the Rust library, causing Ubunto link to fail with the following error: /usr/bin/ld: error: LLVM gold plugin has failed to create LTO module: Invalid record clang: error: linker command failed with exit code 1 (use -v to see invocation) --- genbindings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genbindings.sh b/genbindings.sh index 76a1f28..de5379c 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -344,7 +344,7 @@ fi # Clear stale release build artifacts from previous runs cargo clean --release CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C lto -clang++ $LOCAL_CFLAGS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl +clang++ $LOCAL_CFLAGS -std=c++11 -O2 demo.cpp target/release/libldk.a -ldl strip ./a.out echo "C++ Bin size and runtime with only RL (LTO) optimized:" -- 2.39.5