Hi Sylvain,
as usual - "hello world" example ;-)
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
The system is Ubuntu x86_64 and sorry, I have only Go 1.20.2 on it:
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ go version
go version go1.20.2 linux/amd64
Compiling hello world:
$ go build -o hello
$ GOOS=aix GOARCH=ppc64 go build -o hello_aix
Result:
ls -l
total 5344
-rw-r--r-- 1 user users 24 Nov 28 18:34 go.mod
-rwxr-xr-x 1 user users 1845898 Nov 28 18:35 hello
-rwxr-xr-x 1 user users 3614465 Nov 28 18:35 hello_aix
-rw-r--r-- 1 user users 75 Nov 28 18:34 hello.go
$ file hello_aix
hello_aix: 64-bit XCOFF executable or object module
Copy to AIX and execute there:
$ scp hello_aix aix:
hello_aix 100% 3530KB 21.8MB/s 00:00
$ ssh aix
#./hello_aix
Hello world
------------------------------
Andrey Klyachkin
https://www.power-devops.com------------------------------
Original Message:
Sent: Tue November 28, 2023 09:47 AM
From: Sylvain Manceau
Subject: Golang 1.21
Hi Andrey,
This is very interesting, thanks for your reply!
However, I never could produce XCOFF (AIX) binaries on ppcle (Ubuntu), only ELF... I'd really like to make it, but may need some guidance here!
------------------------------
Sylvain Manceau
------------------------------
Original Message:
Sent: Mon November 27, 2023 05:31 AM
From: Andrey Klyachkin
Subject: Golang 1.21
Hi Sylvain,
you usually (but not always) can cross-compile Google Go from any other device. I compiled several projects on my Mac and used them afterwards on AIX. Of course it doesn't work if you bind to external AIX libraries or use CGO in your project.
------------------------------
Andrey Klyachkin
https://www.power-devops.com