-
What system are you running Yazi on?macOS What terminal are you running Yazi in?ITerm2
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
|
Cross-compiling in Rust isn't that hard, basically you just need to follow the native build steps here: https://yazi-rs.github.io/docs/installation/#source Then add the cargo build --release --locked --target aarch64-apple-darwinAlso make sure to install that target before running rustup target add aarch64-apple-darwinIf you're using an Intel Mac, replace |
Beta Was this translation helpful? Give feedback.
-
|
I tried the last 3 hours to get it to work by using osxcross but it keeps failing. So no, Cross-compiling in Rust is hard. My Dockerfile for anyone interestedFROM rust:latest AS osxcrossbuilder
WORKDIR /osxcross
RUN apt-get update && \
apt-get install -y \
clang \
cmake \
perl \
python3 \
git \
make \
patch \
xz-utils \
libssl-dev \
curl \
file \
build-essential \
&& git clone https://github.com/tpoechtrager/osxcross.git /osxcross
COPY MacOSX15.5.sdk.tar.xz /osxcross/tarballs/
RUN UNATTENDED=1 ./build.sh
FROM rust:latest AS rustbuilder
WORKDIR /yazi
COPY . .
COPY --from=osxcrossbuilder /osxcross /osxcross
ENV PATH="/osxcross/target/bin:${PATH}"
ENV CC_aarch64_apple_darwin=aarch64-apple-darwin24.5-clang
ENV CXX_aarch64_apple_darwin=aarch64-apple-darwin24.5-clang++
ENV CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=${CC_aarch64_apple_darwin}
ENV MLUA_SYS_STATIC=1
RUN rustup target add aarch64-apple-darwin \
&& rustup component add rust-std --target aarch64-apple-darwin \
&& rm -rf target && cargo clean \
&& cargo build --release --locked --target aarch64-apple-darwin
FROM scratch AS output
COPY --from=rustbuilder /yazi/target/aarch64-apple-darwin/release/yazi /yazi/target/aarch64-apple-darwin/release/yazi /And here is how to create the SDKCopy gen_sdk_package.sh from osxcross and run it on your mac with XCode Commandline installed as described by osxcross. Put the MacOSX15.5.sdk.tar.xz into yazi's root so that the Dockerfile can get it. For completeness, the first lines of the compiler errorMaybe someone can tell me what I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
-
|
This works fine for me: FROM rust:latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential ca-certificates clang cmake curl git llvm lld make pkg-config python3 xz-utils \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/tpoechtrager/osxcross.git /osxcross \
&& curl -L -o /osxcross/tarballs/MacOSX11.3.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz \
&& UNATTENDED=1 OSX_VERSION_MIN=11.0 /osxcross/build.sh \
&& rm -rf /osxcross/tarballs/*
ENV PATH=/osxcross/target/bin:$PATH
ENV SDKROOT=/osxcross/target/SDK/MacOSX11.3.sdk
ENV MACOSX_DEPLOYMENT_TARGET=11.0
ENV CC_aarch64_apple_darwin=oa64-clang
ENV CXX_aarch64_apple_darwin=oa64-clang++
ENV CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=oa64-clang
ENV AR_aarch64_apple_darwin=llvm-ar
ENV RANLIB_aarch64_apple_darwin=llvm-ranlib
WORKDIR /yazi
COPY . .
RUN rustup target add aarch64-apple-darwin \
&& cargo build --locked --release --target aarch64-apple-darwin |
Beta Was this translation helpful? Give feedback.
This works fine for me: