diff --git a/docker/Dockerfile.aarch64-apple-darwin-cross b/docker/Dockerfile.aarch64-apple-darwin-cross index 346ee3f..7a03c62 100644 --- a/docker/Dockerfile.aarch64-apple-darwin-cross +++ b/docker/Dockerfile.aarch64-apple-darwin-cross @@ -31,8 +31,3 @@ ENV PATH=$PATH:/opt/osxcross/bin \ COPY cross-toolchains/docker/darwin-entry.sh / ENTRYPOINT ["/darwin-entry.sh"] - -# by default, older versions of macOS (<10.9) link to libstdc++, -# but rust expects it to link to libc++. -ENV CFLAGS_x86_64_apple_darwin="-stdlib=libc++" \ - CXXFLAGS_x86_64_apple_darwin="-stdlib=libc++" diff --git a/docker/Dockerfile.x86_64-apple-darwin-cross b/docker/Dockerfile.x86_64-apple-darwin-cross index ca2cabb..933fbe8 100644 --- a/docker/Dockerfile.x86_64-apple-darwin-cross +++ b/docker/Dockerfile.x86_64-apple-darwin-cross @@ -31,8 +31,3 @@ ENV PATH=$PATH:/opt/osxcross/bin \ COPY cross-toolchains/docker/darwin-entry.sh / ENTRYPOINT ["/darwin-entry.sh"] - -# by default, older versions of macOS (<10.9) link to libstdc++, -# but rust expects it to link to libc++. -ENV CFLAGS_x86_64_apple_darwin="-stdlib=libc++" \ - CXXFLAGS_x86_64_apple_darwin="-stdlib=libc++" diff --git a/docker/darwin-entry.sh b/docker/darwin-entry.sh index 4b8882e..9dcb1bc 100755 --- a/docker/darwin-entry.sh +++ b/docker/darwin-entry.sh @@ -15,4 +15,13 @@ declare -x CC_${envvar_suffix}="${tools_prefix}"-clang declare -x CXX_${envvar_suffix}="${tools_prefix}"-clang++ declare -x CARGO_TARGET_${upper_suffix}_LINKER="${tools_prefix}"-clang +# by default, older versions of macOS (<10.9) link to libstdc++, +# but rust expects it to link to libc++, we can set stdlib to libc++. +# +# some time, the osxcross clang wrapper can't use right ld linker, +# the error looks like: /usr/bin/ld: unrecognized option '-dynamic'. +# let the clang wrapper to use its own linker in the osxcross bin path. +declare -x CFLAGS_${envvar_suffix}="-stdlib=libc++ -fuse-ld=${tools_prefix}-ld" +declare -x CXXFLAGS_${envvar_suffix}="-stdlib=libc++ -fuse-ld=${tools_prefix}-ld" + exec "$@" diff --git a/docker/darwin.sh b/docker/darwin.sh index 4236e24..2d9ed55 100755 --- a/docker/darwin.sh +++ b/docker/darwin.sh @@ -12,7 +12,7 @@ if [[ "${MACOS_SDK_FILE}" == "nonexistent" ]] && [[ -z "${MACOS_SDK_URL}" ]]; th fi main() { - local commit=17bb5e2d0a46533c1dd525cf4e9a80d88bd9f00e + local commit=ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b install_packages curl \ gcc \ @@ -20,7 +20,7 @@ main() { make \ patch \ xz-utils \ - python + python3 apt-get update apt-get install --assume-yes --no-install-recommends clang \