Skip to content
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

Unable to Generate Logs and Hanging Execution with unityci/editor Docker Image on Mac with Apple Silicon #238

Open
alronz opened this issue Jan 24, 2024 · 3 comments

Comments

@alronz
Copy link

alronz commented Jan 24, 2024

I am trying to use the Docker image unityci/editor:ubuntu-2022.3.18f1-webgl-3.0.1 on a Mac with Apple Silicon (M1/M2) to run the following command after setting the license:

unity-editor -enablePackageManagerTraces -logfile /dev/stdout -quit -batchmode -nographics -buildTarget WebGL -projectPath "/src/Frontend"

Problem Description:

  • When I build the Docker image on Linux or Windows that contains the above command, I observe that the command produces many logs and executes successfully.
  • However, when I build the image using the same command on a Mac with an Apple chip (M1/M2), I encounter the following issues:
    • The command produces no logs.
    • The execution appears to hang without completing.

Note that I execute the docker build command with the flag --platform=linux/amd64 since there is no image for arm64

I would appreciate any insights or guidance on how to resolve this issue and make the Docker image work smoothly on Macs with Apple Silicon. Thank you!

@GabLeRoux
Copy link
Member

GabLeRoux commented Jan 25, 2024

That's a good question, I reproduced this as well. I haven't tried building my own docker image locally on Apple chip (M3 here), but I did reproduce the problem where trying to run unity-editor inside a container and the process did hang without printing anything to console. I even tried with base image (without modules installed).

export DOCKER_DEFAULT_PLATFORM=linux/amd64
docker run -v "$(pwd):/app" --rm docker.io/unityci/editor:2022.3.4f1-base-3 unity-editor \
  -logFile /dev/stdout \
  -quit \
  -serial "$UNITY_SERIAL" \
  -username "$UNITY_EMAIL" \
  -password "$UNITY_PASSWORD" \
  -projectPath "/app/BlankProject"

I'm interested in a solution too. That is an architecture compatibility challenge. I quickly eplored some options.

Rosetta 2

I know there is Rosetta 2, a binary translation layer for running x86_64 applications on ARM architecture. Rosetta can be installed like this:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

But from there, I'm not sure what would be the next steps, I haven't tried anything past this, but I think running with DOCKER_DEFAULT_PLATFORM=linux/amd64 or --platform=linux/amd64 is already using Rosetta.

edit: emulation on macOS usign docker uses QEMU, not Rosetta

Writing a Dockerfile that is ARM compatible

I think for this to work, we'd have to try and use a base image that is already arm compatible and then compile and install dependencies. This is something to explore.

References

@GabLeRoux
Copy link
Member

I did some more investigation on this. You can find a discussion here:
https://discord.com/channels/710946343828455455/1295781822214443038

Right now, this is blocked because there are no arm64 unityhub binaries available:
https://hub-dist.unity3d.com/ui/repos/tree/General/hub-debian-prod-local/pool/main/u/unity/unityhub_amd64/unityhub-amd64-3.9.1.deb

I was able to get the base image to build, but not the hub image.

I did this change for the base image for it to build on arm:

diff --git a/images/ubuntu/base/Dockerfile b/images/ubuntu/base/Dockerfile
index b4d75c6..3e0d8bb 100644
--- a/images/ubuntu/base/Dockerfile
+++ b/images/ubuntu/base/Dockerfile
@@ -59,9 +59,10 @@ RUN apt-get -q update \
 
 # Fix "No useable version of libssl" for Ubuntu 22.04
 # https://forum.unity.com/threads/workaround-for-libssl-issue-on-ubuntu-22-04.1271405/
-RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
- && dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
- && rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb
+RUN apt update && \
+    apt install -y libssl3 && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
 
 # Disable default sound card, which removes ALSA warnings
 RUN /bin/echo -e 'pcm.!default {\n\

But I'm not sure the change is good at all because maybe the libssl1.1 is actually required. Anyway, this part would need to change to become arm compatible.

@gitperr
Copy link

gitperr commented Nov 7, 2024

I think we may need to pull the unity hub down from Unity's own page in this case.

https://unity.com/download has a link to Download for mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants