jobs:
check_bindings:
+ strategy:
+ fail-fast: false
+ matrix:
+ # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
+ # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
+ distro: [ "debian:bullseye", "fedora:39" ]
runs-on: ubuntu-latest
- # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
- # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
- container: debian:bullseye
+ container: ${{ matrix.distro }}
env:
TOOLCHAIN: stable
steps:
- name: Install native Rust toolchain, Valgrind, and build utilitis
+ if: "matrix.distro == 'debian:bullseye'"
run: |
apt-get update
apt-get -y dist-upgrade
apt-get -y install cargo libstd-rust-dev-wasm32 valgrind lld git g++ clang wget
+ - name: Install native Rust toolchain, Valgrind, and build utilitis
+ if: "matrix.distro == 'fedora:39'"
+ run: |
+ dnf -y install cargo rust-std-static-wasm32-wasi valgrind lld git g++ clang wget which diffutils
- name: Checkout source code
uses: actions/checkout@v2
with:
git clone https://github.com/rust-bitcoin/rust-lightning
cd rust-lightning
git checkout 0.0.118-bindings
+ - name: Pin memchr
+ if: "matrix.distro == 'debian:bullseye'"
+ run: |
# Pin memchr until we can remove it
+ cd rust-lightning
cargo update -p memchr --precise "2.5.0" --verbose
- name: Fix Github Actions to not be broken
run: git config --global --add safe.directory /__w/ldk-c-bindings/ldk-c-bindings
case "$ENV_TARGET" in
"x86_64"*)
export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge"
- export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
+ export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=sandybridge -mtune=sandybridge"
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS"
;;
"aarch64_apple_darwin")
*)
# Assume this isn't targeted at another host and build for the host's CPU.
export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=native"
- export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -mcpu=native"
+ export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=native -mtune=native"
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS"
;;
esac
fi
fi
else
- CLANG_LLVM_V=$(clang --version | head -n1 | awk '{ print substr($4, 0, 2); }')
+ # Output is something like clang version 17.0.3 (Fedora 17.0.3-1.fc39) or Debian clang version 14.0.6
+ CLANG_LLVM_V=$(clang --version | head -n1 | awk '{ print substr($3, 0, 2); }')
+ [ "$CLANG_LLVM_V" = "ve" ] && CLANG_LLVM_V=$(clang --version | head -n1 | awk '{ print substr($4, 0, 2); }')
if [ -x "$(which ld.lld)" ]; then
LLD_LLVM_V="$(ld.lld --version | awk '{ print $2; }')"
if [ "$LLD_LLVM_V" = "LLD" ]; then # eg if the output is "Debian LLD ..."
MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG"
done
export CFLAGS_x86_64_apple_darwin="$CFLAGS_x86_64_apple_darwin -O3 -fPIC -fembed-bitcode"
- RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
+ RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mtune=sandybridge" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
fi
fi
# If we're on an M1 don't bother building X86 binaries
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode"
# Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts
cargo clean --release
- CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
+ CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
if [ "$2" = "true" ]; then
$CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 -c demo.cpp -o demo.o