0

I have an IL2CPP scripting backend Unity Android export taken from Unity editor version 2020.3.48f1 (Mac intel variant on Mac m1 machine) for target architecture ARM64.

When I try executing il2cpp binary file (located at unityLibrary/src/main/Il2CppOutputProject/IL2CPP/build/deploy/netcoreapp3.1) locally, it runs just file -

MacBook-Pro netcoreapp3.1 % ./il2cpp 

Options:
  --emit-null-checks                              Enables generation of null checks
...

file command output (ran locally) is -

MacBook-Pro netcoreapp3.1 % file il2cpp
il2cpp: Mach-O 64-bit executable x86_64

Now I am trying to build the Android export project inside docker using base image amazoncorretto:17 (ran with --platform linux/amd64 option ie. docker container architecture is x86_64 same as il2cpp binary file) but I keep getting error -

bash-4.2# ./il2cpp
bash: ./il2cpp: cannot execute binary file

file command output (ran inside docker container) is -

sh-4.2# file il2cpp
il2cpp: Mach-O 64-bit executable

x86_64 is missing in above output (as opposed to when I run it on my host machine) but I don't know if its relevant.

Architecture of both docker container and file is same (both are x86_64).

Question: How can I run il2cpp (and complete Unity export Android build) in a docker image (preferably any version of amazoncorretto)?

I cannot figure out why the executable runs locally but not inside docker container.

Note: I ran my Mac generated il2cpp inside same base docker image on a linux host but it gives same error.

Any help is appreciated.

Thanks

2
  • 1
    You're trying to run a Mach-O on Linux... Commented Jul 16, 2023 at 17:56
  • MacOS and Linux are different operating systems. There are no MacOS-native containers; Docker Desktop works by running a hidden Linux VM. You probably need to compile this tool on Linux, maybe via a multi-stage Dockerfile. Commented Jul 16, 2023 at 20:55

1 Answer 1

0

As pointed out in comments, the reason why binary was not executing inside a linux container because it was built on mac.

By exporting Unity project on ubuntu machine and using it inside amazoncorretto:17 docker container (on ubuntu machine as well), the script started executing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.