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