-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Creating a build of StandaloneOSX it doesn't work on Mac with M1 chip #329
Comments
Could you please be slightly more descriptive? Are you building on a Mac runner with M1 chip or are you trying to execute the resulting artifact after a successful build on a Mac with M1? Can you speak for whether your other builds work etc.? |
@webbertakken I am trying to run the artifact on a Macbook with M1 Chip. |
Does it work on an intel mac? |
@davidmfinol I don't have an intel mac to test on. but I did build this project previously on the Apple silicone Mac via the Unity Hub and it works great. |
Also, is this a correct way to specific unity version:
|
Actually we recommend not specifying Note that we also don't recommend using |
@webbertakken Then I don't know how to fix the issue, from what I read the version I am using (and is specified in the project) should by default support both Silicion CPU and Intel CPU by default. Therefore, it should work. |
Not sure if you do, but in case you have an M1 yourself, could you try running your (local working) editor to build your project from CLI to see if CLI generated builds works at all on it? We don't do much more than packaging the editor in a container image, not much special at all either. |
@webbertakken How do I do that? |
Here's an example command, that we use inside unity-builder itself. unity-builder/dist/platforms/ubuntu/steps/build.sh Lines 128 to 144 in 4e38a84
Here's also the build script that we use (with |
I'm also having this issue with running builds on my M1 MacBook Pro, with essentially a "Hello World" Unity 2D project (URP). Nothing fancy and I'm using the same Github action definitions as the Getting Started guide from Game CI. On my local machine I am using the 2021.2.16f1 Silicon build, not the Intel one. I suspect this is where the issue may lie. Even though M1 chips should be able to run the x86 builds via Rosetta 2, not sure why this breaks with Mono builds. I have a feeling this may be related to running the builder under Linux trying to build for Mac versus running the editor natively on macOS + Silicon hardware. Probably some M1 growing pains or cross-compiliation. |
Here's the workflow for those wondering: name: Build project
on: [push, pull_request]
jobs:
buildForDesktop:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneOSX
- StandaloneWindows64
- StandaloneLinux64
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }} |
My understanding is that Unity has 3 architecture options for macOS builds:
By default, Unity (and therefore also |
My project is pretty simple and as mentioned I've tried this with a simple project with default package dependencies. I get this: I thought it might be a corrupted file or something, but the "Show Package Contents" works to display what's inside: So I did some digging using
I will continue to dig further and figure this out. Looks like here's the error from the terminal when opening:
And digging into the Console logs:
|
Alright, seems it's a macOS permissions issue that started in Catalina. Not a M1 issue in particular. To fix it:
Seems to be a macOS specific code-signing issues which would explain why building + running locally does not have this issue (it can self-sign using your keychain). For proper builds maybe have to integrate the Some info here: https://gist.github.com/dpid/270bdb6c1011fe07211edf431b2d0fe4 I'm still a bit new to Github actions, mostly my experience is in GitLab CI. But I guess you'd need another post-build stage that takes the Build artifact and signs it using EDIT: Looks like it may be possible to code-sign on non-Mac platforms: https://crates.io/crates/apple-codesign |
If it helps, this is what I use to codesign my macOS builds: https://github.com/finol-digital/Card-Game-Simulator/blob/develop/fastlane/sign-mac-build.sh This script does need to run on a macOS runner, and you can see how I do that here too: https://github.com/finol-digital/Card-Game-Simulator/blob/develop/.github/workflows/main.yml#L274 |
@ewrogers I'm in the same position where my mac build won't open on my M1 Mac, but my Windows builds work fine on my Windows machine. I'm new to CI and also Mac permissions - where do I put these lines to make the M1 build work? Do they go somewhere in the Github Action workflow? |
@wedgiebee You run the commands on your M1 Mac terminal. It assumes that you have downloaded the artifact in your mac's Since this issue seems to be caused permissions/code-signing, I've created a separate issue to document this process, and am closing this issue: game-ci/documentation#262 |
Thanks a bunch for providing your solution. By any chance - would it be possible to run this (with some modifications) on linux runner? Or to codesign and verify the .app is only possible on mac runners? It would be really nice to have everything setup in the build pipeline... |
I don't really think it would work on Linux, since it requires Apple credentials and the codesign tool, which I would assume are only available on mac. |
Bug description
When creating a build of StandaloneOSX it doesn't work on Mac with M1 chip
How to reproduce
build a StandaloneOSX and try to run on Macbook with M1 chip
*Expected behavior:
The game starts
Additional details
The text was updated successfully, but these errors were encountered: