-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to install ldc for Mac Arm #51
Comments
there is a check that aborts the extension right now if you are not on x86_64: We don't have any devices outside the GitHub Actions runners, so we only have x86 runners and can't really test if the extension works on other architectures. |
I am trying to cross-compile for Arm64 Mac. Ldc supports this if the correct environment variables are set. Here is an example: - name: Setup Mac Arm64
shell: bash
if: contains(matrix.os, 'macos-11')
run: |
ARCH="arm64"
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "triple=$ARCH-apple-macos" >> $GITHUB_ENV
echo "DFLAGS='-mtriple=$triple -Xcc=target -Xcc=$ARCH-apple-macos'" >> $GITHUB_ENV
echo "CPPFLAGS=$CPPFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS -arch $ARCH" >> $GITHUB_ENV |
cross compiling to arm should be possible, though I haven't tried before. It might be possible to run and include the output of the ldc-build-runtime tool in setup-dlang: https://wiki.dlang.org/Building_LDC_runtime_libraries |
I am able to setup LDC for cross-compilation - name: Setup Mac Arm64
shell: bash
if: contains(matrix.os, 'macos-11')
run: |
ARCH="arm64"
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "triple=$ARCH-apple-macos" >> $GITHUB_ENV
echo "DFLAGS='-mtriple=$triple -Xcc=target -Xcc=$ARCH-apple-macos'" >> $GITHUB_ENV
echo "CPPFLAGS=$CPPFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS -arch $ARCH" >> $GITHUB_ENV
# Manually install ldc
# Due to https://github.com/dlang-community/setup-dlang/issues/51
curl -LJO https://github.com/ldc-developers/ldc/releases/download/v1.28.0/ldc2-1.28.0-osx-$ARCH.tar.xz
tar -xf ldc2-1.28.0-osx-$ARCH.tar.xz
rm ldc2-1.28.0-osx-$ARCH.tar.xz
LDC_PATH="~/ldc"
mkdir -p $LDC_PATH
mv ldc2-1.28.0-osx-$ARCH $LDC_PATH
# Activate ldc
echo "LIBRARY_PATH=$LDC_PATH/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LDC_PATH/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV
echo "PATH=$LDC_PATH/bin${PATH:+:}${PATH:-}" >> $GITHUB_ENV
echo "DMD=ldmd2" >> $GITHUB_ENV
echo "DC=ldc2" >> $GITHUB_ENV
However, it seems that dub support for arm64 is also missing. I might have to compile directly in this case. |
cross compiling to arm should work like this now:
|
Does setup-dlang support ldc for Mac ARM?
The text was updated successfully, but these errors were encountered: