titzer / virgil

A fast and lightweight native programming language
1.24k stars 48 forks source link

shouldn't Rosetta be able to run x86 ? #58

Closed pannous closed 2 years ago

pannous commented 2 years ago
/opt/virgil/ arch
i386
/opt/virgil/ ./bin/v3c-x86-darwin demo.v3
/opt/virgil/ ./demo             
zsh: bad CPU type in executable: ./demo
titzer commented 2 years ago

I am not sure if Rosetta supports 32-bit x86. If you try x86-64-darwin (for this you'll need to first do a 'make' to build a version of the compiler that supports the platform), in theory, Rosetta 2 should be able to run the resulting 64-bit binaries. But there is something wrong with these binaries and Rosetta 2 refuses to run them, though they run natively, at least on Catalina x86-64.

titzer commented 2 years ago

I could use some help trouble-shooting why Rosetta 2 cannot run the x86-64-darwin binaries generated by Virgil.

pannous commented 2 years ago

Maybe I can help if you outline a trouble-shooting procedure

titzer commented 2 years ago
  1. clone the repo
  2. Run bin/dev/aeneas bootstrap
  3. Run bin/dev/v3c-x86-64-darwin -output=/tmp apps/HelloWorld/*.v3
  4. Run /tmp/HelloWord

The current error I get is "overlapping segments" but even rearranging the segments in the binary, I cannot get the program to start. In #60 someone pointed to Rosetta 2 not supporting statically linked exes?

titzer commented 2 years ago

Closing in favor of #60.