pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

#imageVersion depends on having Rosetta 2 installed on Apple Silicon Macs #592

Open Rinzwind opened 1 year ago

Rinzwind commented 1 year ago

Pharo Launcher seems to depend on having Rosetta 2 installed on Apple Silicon Macs. The URLs returned by #compatibleVmUrls all refer to Intel-only executables. When one of these is used as the command in #imageVersionCommandWithPreferences:, the call of posix_spawnp in OSSUnixSubprocess fails with error EBADARCH (“Error: posix_spawn(), code: 86, description: Bad CPU type in executable”) if one does not have Rosetta 2 installed (it’s not installed by default, it can be installed through the shell command softwareupdate --install-rosetta). This is not a big issue but it’s something to be aware of and it would be good to remove the dependency if possible.

Rinzwind commented 1 year ago

Small thing I forgot to mention, the comment in #compatibleVm says “an image able to run the image”, that was probably intended to be “a VM able to run the image”:

https://github.com/pharo-project/pharo-launcher/blob/91aaa0631a4fd5885b6c52ac9fbfc27f3959f48d/src/PharoLauncher-Core/PhLVirtualMachineManager.class.st#L232-L240

demarey commented 1 year ago

Hi,

Thank you for the report!

compatibleVm is only intended to be used to determine the Pharo version number of an image if there is no pharo.version file aside the image. In most cases, it won't be used.

In which circumstances did you get a problem?

ps: I just fixed the comment

Rinzwind commented 1 year ago

Ah I see: the zip files from our Jenkins server don’t include a ‘pharo.version’ file, I will add one to avoid the problem (it was reported by a colleague who had just received a new Mac).

demarey commented 1 year ago

Is it ok to close the issue?

Rinzwind commented 1 year ago

Would it be possible to remove the dependency on Rosetta? If not, maybe the error “Bad CPU type in executable” can be handled and resignaled with a clarification that “you may need to install Rosetta 2”?