How to crosscompile from mac M1

I am trying to build a small raylib app from my macM1 to my steamdeck but I failed at compiling it to linux amd64. I got an error message saying that cross compiling is disable.

I guess this is a question of time before it work porperly.

What are my possibilities rigth now ?

I can virtualise a linux or windows arm distro, maybe using girhub action :thinking:

What do you suggest ?

thanks

Cross-compiling is possible, but won’t generate a finished binary–only an object file, which still needs to be linked. You’d need a separate tool for cross-linking, which would require appropriate system libraries and such for the target.

As far as I know, built-in cross-linking support isn’t currently being worked on, and Bill’s stance is that you shouldn’t be blindly building to a target without testing it. And if you have a system to test on, then you also have a system to build natively on. See: https://x.com/TheGingerBill/status/1905541514945495262

So the possible answers, in approximate order of preference, are:

  • Have a “real” system matching the target, to build and test on natively.
  • Have a VM matching the target, to build and test on “natively”.
  • Use some form of compatibility layer (e.g. Wine, for a Windows target) to build and test “”“natively”“”. Note that compatibility layers may not perfectly reflect the behavior on the real target.
  • Cross-compile to an object file with the Odin compiler, then cross-link via a separate tool. This doesn’t really give you an option for testing the build.
1 Like

Interesting.

I have not though that cross linking could be an issue. :thinking: I am not really sure I ageed with this statement, you could have different people building for other testing on their own.

Anyway, Thank you for the anwser :slightly_smiling_face: