Help with porting golang

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():

cannot find package internal/syscall/execenv (using -importcfg)

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!

Also, pictures or it didn’t happen, so…

4 Likes

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.

iirc there is a commandlinetool called „error“ that should comvert this to a readable name

3 Likes

Awesome, thank you! The error command is giving values that make sense in this context. To save others a lookup:

2147483653 - 0x80000005: Invalid Argument
2147508227 - 0x80006003: No such file or directory

The “Invalid Argument” is the error happening on all the fork/exec calls to compile or asm.

1 Like

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.

3 Likes

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.)

1 Like

Any progress to get lastest Golang?

1 Like