@@ -353,13 +353,33 @@ if [ "$2" = "true" ]; then
353
353
ls -lha a.out
354
354
fi
355
355
356
+ function REALLY_PIN_CC {
357
+ # -Zbuild-std fails if we have any dependencies of build-deps, which
358
+ # cc added in 1.0.80, thus we pin back to 1.0.79 to avoid that.
359
+ cargo update -p cc --precise " 1.0.79" --verbose
360
+ ( cargo build --features=std -v --release -Zbuild-std=std,panic_abort > /dev/null 2>&1 ) || echo -n
361
+ ( cargo build --features=std -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort > /dev/null 2>&1 ) || echo -n
362
+ # Sadly, std also depends on cc, and we can't pin it in that tree
363
+ # directly. Instead, we have to delete the file out of the cargo
364
+ # registry and build --offline to avoid it using the latest version.
365
+ NEW_CC_DEP=" $CARGO_HOME "
366
+ [ " $NEW_CC_DEP " = " " ] && NEW_CC_DEP=" $HOME "
367
+ if [ -f " $NEW_CC_DEP /.cargo/registry/cache/github.com-" * /cc-1.0.79.crate ]; then
368
+ mv " $NEW_CC_DEP /.cargo/registry/cache/github.com-" * /cc-1.0.79.crate ./
369
+ fi
370
+ rm -f " $NEW_CC_DEP /.cargo/registry/cache/github.com-" * /cc-* .crate
371
+ [ -f ./cc-1.0.79.crate ] && mv ./cc-1.0.79.crate " $NEW_CC_DEP /.cargo/registry/cache/github.com-" * /
372
+ }
373
+
356
374
# Then, check with memory sanitizer, if we're on Linux and have rustc nightly
357
375
if [ " $HOST_PLATFORM " = " x86_64-unknown-linux-gnu" ]; then
358
376
if cargo +nightly --version > /dev/null 2>&1 ; then
359
377
LLVM_V=$( rustc +nightly --version --verbose | grep " LLVM version" | awk ' { print substr($3, 0, 2); }' )
360
378
if [ -x " $( which clang-$LLVM_V ) " ]; then
361
379
cargo +nightly clean
362
- cargo +nightly rustc $CARGO_BUILD_ARGS -Zbuild-std=std,panic_abort --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes
380
+
381
+ REALLY_PIN_CC
382
+ cargo +nightly rustc --offline $CARGO_BUILD_ARGS -Zbuild-std=std,panic_abort --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes
363
383
mv target/x86_64-unknown-linux-gnu/debug/libldk.* target/debug/
364
384
365
385
# Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020,
@@ -552,20 +572,21 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
552
572
LINK_ARG_FLAGS=" -C link-arg=-fuse-ld=$LLD "
553
573
export LDK_CLANG_PATH=$( which $CLANG )
554
574
if [ " $MACOS_SDK " != " " ]; then
575
+ REALLY_PIN_CC
555
576
export CLANG=" $( pwd) /../deterministic-build-wrappers/clang-lto-link-osx"
556
577
for ARG in $CFLAGS_aarch64_apple_darwin ; do
557
578
MANUAL_LINK_CFLAGS=" $MANUAL_LINK_CFLAGS -C link-arg=$ARG "
558
579
done
559
580
export CFLAGS_aarch64_apple_darwin=" $CFLAGS_aarch64_apple_darwin -O3 -fPIC -fembed-bitcode"
560
- RUSTC_BOOTSTRAP=1 RUSTFLAGS=" $BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort
581
+ RUSTC_BOOTSTRAP=1 RUSTFLAGS=" $BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline - v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort
561
582
if [ " $HOST_OSX " != " true" ]; then
562
583
# If we're not on OSX but can build OSX binaries, build the x86_64 OSX release now
563
584
MANUAL_LINK_CFLAGS=" "
564
585
for ARG in $CFLAGS_x86_64_apple_darwin ; do
565
586
MANUAL_LINK_CFLAGS=" $MANUAL_LINK_CFLAGS -C link-arg=$ARG "
566
587
done
567
588
export CFLAGS_x86_64_apple_darwin=" $CFLAGS_x86_64_apple_darwin -O3 -fPIC -fembed-bitcode"
568
- 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 -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
589
+ 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
569
590
fi
570
591
fi
571
592
# If we're on an M1 don't bother building X86 binaries
0 commit comments