Resurrecting this thread, because I think Korli’s work is the most recent work on porting Go?
I was able to use Korli’s code to cross-compile Go 1.18 for Haiku today (from macOS 10.13 High Sierra running Go 1.20). The resulting Go compiler really can compile working Haiku programs, but I have to recompile several times to get through the fork/exec bugs in the compiler. Also networking doesn’t work, but at least I can compile programs with networking code, which is more than I can with Go 1.4.
Some errors seems spurious - one compile error while compiling my own Go programs claimed this when it encountered a call to os.Hostname():
But compiling my program again, it was suddenly fine! Another error along the way was:
go build internal/reflectlite: mkdir: errno 2147483653
And most errors were of the form:
go build [packagename]: [path-to-compile-or-asm] fork/exec [path-to-compile-or-asm] errno 2147483653
Does anyone know what “errno 2147483653” is? My guess is it’s meant to be a negative error code and should actually be “errno -6”, but I still don’t know what that means.
I’d need networking to work in Go before I can actually get work done with this. My Go programs mostly call out to SFTP servers. But this seems like it’s actually really far along!
If it’s a Haiku error code, you’d have better luck converting it to hex.
In this case, the error translates to 0x80000005, which corresponds to B_BAD_VALUE.
Nice!
I never had time to sync the work I did with korli’s. I was careful in trying to get every commit clean, so if you have time, you might want to just walk through the commits there and compare if I did something differently.
You might be able to use strace to find the failing fork/exec calls and see if any of the arguments are obviously bad. (Note you might need to specify some flags to strace if there’s multiple threads/processes in use.)