From 8d8ab27544918725c63db61a657bdbf107d9be01 Mon Sep 17 00:00:00 2001 From: Francisco Gindre Date: Mon, 15 Mar 2021 10:19:40 -0300 Subject: [PATCH] Fix issue #234 cargo fails to build on Mac OS Big Sur --- Scripts/build_librustzcash_xcode.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Scripts/build_librustzcash_xcode.sh b/Scripts/build_librustzcash_xcode.sh index cc449b3a..6e557bb6 100755 --- a/Scripts/build_librustzcash_xcode.sh +++ b/Scripts/build_librustzcash_xcode.sh @@ -43,7 +43,14 @@ else fi echo "cargo lipo --manifest-path ${PODS_TARGET_SRCROOT}/Cargo.toml $FEATURE_FLAGS --targets $ZCASH_ACTIVE_ARCHITECTURE --release" - +if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then + # Assume we're in Xcode, which means we're probably cross-compiling. + # In this case, we need to add an extra library search path for build scripts and proc-macros, + # which run on the host instead of the target. + # (macOS Big Sur does not have linkable libraries in /usr/lib/.) + echo "export LIBRARY_PATH=\"${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}\"" + export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}" +fi if [ ! -f ${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME} ]; then cargo lipo --manifest-path ${PODS_TARGET_SRCROOT}/Cargo.toml $FEATURE_FLAGS --targets $ZCASH_ACTIVE_ARCHITECTURE --release persist_environment