-
Notifications
You must be signed in to change notification settings - Fork 18k
gccgo: Is there a way to build a binary which will be run on AIX? what GOARCH and GOOS should I choose? #20983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Dup of #19200? |
Thank you, Is there a tutorial on how to configure gccgo? I have gcc installed but it seems not as easy to use it with gccgo... |
We (BullFreeware project) have ported gccgo on AIX. You need to download and install GCC 7.1.0-7 (for AIX 7.1 and 7.2) or GCC 7.1.0-6 (for AIX 6.1). There are 3 RPMs: What you have to do: go version Let me know if you succeed to use it. Current test status:
|
Big thanks @trex58 ! I Will test it tomorrow.. I was close to stop the benchmark of golang for my project.. |
Thanks @trex58 , I finally managed to make it work on 7.1! But what I was expected became true => the binary produce with the go compiler on 7.1 is not working on AIX 6.2 : ( . So go language is not a wonderful cross platform tool as I thought ;(. Last question => Do you know if some day AIX will be support officialy? |
About Gcc Go for AIX 7.1, look at: Go & libgo for AIX 7.1 : In general, all RPM packages built for AIX 6.1 can be used on AIX 7.1 and 7.2, except Gcc (and Gcc Go), and some more RPMs (PostgreSQL). |
Hummm A binary produced on AIX 7.1 does not work on AIX 6.1 ? About Gcc Go beeing officialy supported on AIX, there are 2 ways:
Moreover, we still are working on solving issues in libgo, and there are bugs and limitations in Gcc Go that prevent some features to run correctly on AIX. (AIX/Power architecture is different from Linux/x86_64 and some Go code is provinding code that was not used on Linux/x86_64 but is used on AIX/Power). |
The executables produced by GCC Go depend on Go packages that are provided by libgo.a. Thus, you can compile on AIX 7.2 and run it on AIX 6.1, if same version of GCC Go is installed (libgo and libgcc RPMs) on the AIX 6.1 machine. cat Hello.go go build Hello.go ./Hello ldd ./Hello One can compile with -static-go in order of no more be dependent on libgo.a . However, the a.out file will be big (>= 68MB). |
@trex58 Interesting project. I'd like to know more about the current status (couldn't find the info on the BullFreeware site, but can see new versions). Would compiling Telegraf be feasible? |
Hi, we are continuously improving the port on AIX, submitting changes to the Go and GCC projects. See: https://go-review.googlesource.com/q/reix (and old: https://go-review.googlesource.com/q/sarter) . I've recently produced a new snapshot of GCC 8 (20171205), which enables to build Filebeat 6.0, Kubernetes 1.8, and more. Take it at: http://www.bullfreeware.com/go/go8.0.0/aix7.2/ . And I know I'll have to teach AIX to golang.org/x asap. |
@tw-bert I have issues on AIX. That probably deals (as usual) with AIX operating system not managed in some code. Not difficult to work it around. |
Version 7.2.0 is available on AIX: version for AIX 7.2 : A snapshot of GCC 8.0.0 for AIX made the 5th of December is available at: Today snapshot of GCC Go 8.0.0 now integrates Go v1.10 , making Go runtime on AIX to crash. We are working on fixing this. |
@trex58 With the latest changes, do you think it's worth trying to build Telegraf again? |
Version 8.0.1, snapshot 20180206, for AIX 7.2, is available on BullFreeware: About Telegraf, the maintainer of GCC Go said to me, the 25th of January: "I believe this program is fixed now." Please give it a try with this version 8.0.1 . |
@trex58: Great. I got your go environment running, on a custom path (shared server, POC). Here's GOARCH="ppc"
GOBIN=""
GOCACHE="/otadb/golang/gocache/go-build"
GOEXE=""
GOHOSTARCH="ppc"
GOHOSTOS="aix"
GOOS="aix"
GOPATH="/otadb/golang/go"
GORACE=""
GOROOT="/otadb/golang/2/opt/freeware"
GOTMPDIR=""
GOTOOLDIR="/opt/freeware/libexec/gcc/powerpc-ibm-aix7.2.0.0/8.0.1"
GCCGO="/otadb/golang/2/opt/freeware/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build282652504=/tmp/go-build -gno-record-gcc-switches -funwind-tables" Sidenote: I did I'm running into someting that very well can be a noob error (apart from fiddling around with it, I have almost zero experience in Go - my intention is only to build & run it):
Additional info: Using built-in specs.
COLLECT_GCC=/otadb/golang/2/opt/freeware/bin/gccgo
Target: powerpc-ibm-aix7.2.0.0
Configured with: ../gcc-8.0.1/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran,objc,obj-c++,go --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --with-cloog=no --with-ppl=no --disable-libstdcxx-pch --enable-__cxa_atexit --disable-werror --host=powerpc-ibm-aix7.2.0.0
Thread model: aix
gcc version 8.0.1 20180206 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-c' '-shared-libgcc'
go1 - -quiet -dumpbase - -auxbase - -L/otadb/golang/2/opt/freeware/bin/../lib/gcc/powerpc-ibm-aix7.2.0.0/8.0.1 -L/otadb/golang/2/opt/freeware/bin/../lib/gcc -L/otadb/golang/2/opt/freeware/bin/../lib/gcc/powerpc-ibm-aix7.2.0.0/8.0.1/../../.. -o /tmp/cciUCyny.s
COLLECT_GCC_OPTIONS='-c' '-shared-libgcc'
/usr/bin/as -u -mpwr4 -many -o -.o /tmp/cciUCyny.s
COMPILER_PATH=/otadb/golang/2/opt/freeware/bin/../libexec/gcc/powerpc-ibm-aix7.2.0.0/8.0.1/:/otadb/golang/2/opt/freeware/bin/../libexec/gcc/
LIBRARY_PATH=/otadb/golang/2/opt/freeware/bin/../lib/gcc/powerpc-ibm-aix7.2.0.0/8.0.1/:/otadb/golang/2/opt/freeware/bin/../lib/gcc/:/otadb/golang/2/opt/freeware/bin/../lib/gcc/powerpc-ibm-aix7.2.0.0/8.0.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-shared-libgcc' Any clue on |
@trex58 Side issue: |
@trex58 Never mind about the |
Version 8.0.1, snapshot 20180305, for AIX 7.2, is available on BullFreeware: go version |
@trex58 Thanks for keeping us posted. I have to find the time to give it the attention it deserves. |
Anyone managed to build a static go binary on aix, without any dependencies? mine already needs some of them: |
Hi lukibahr,
|
@trex58 I test on AIX6.1 use http://www.bullfreeware.com/affichage.php?id=3899, but It 's too slow.
real 0m7.537s And the CPU is higher than 20% |
That's indeed a bit slow. On our system, AIX7.1, P-8: time go env
...
real 0m0.655s
user 0m0.253s
sys 0m0.090s |
We have improved the time needed for starting a Go a.out within last versions of GCC Go 8.0.1 . |
@trex58 can we build static on AIX 7.2 than run on AIX 6.1 to solve this problem |
"Build Go static on AIX 7.2 that runs on AIX 6.1" ? Hummm AIX guarantees ascendent compatibility only. I fear that, in the reverse way, it will not work. I do not have GCC 8.0.1 installed on my AIX 6.1 machine. So I cannot test. |
@tw-bert I test on AIX7.1, it same as before. Which version do you use?The GCC 8.0.1 rpm version can only install on AIX7.2 |
Latest version on AIX 7.2 (which is my main Gcc Go development environment) is: gcc-8.0.1-20180305 . |
@trex58 I want 8.0.1-20180305 on AIX 7.1, thanks |
GCC Go 8.0.1 snapshot 2018/03/05 for AIX 7.1 is available at: |
@trex58 thanks, it‘s faster than before. but when I use '-static' it error:
|
Yes. I can reproduce it. ld: 0711-318 ERROR: Undefined symbols were found.
|
-lcrypt is missing from command line: |
@trex58 " _kgrantpt symbol is missing" I got same error. Is there any other way? |
Is there binary version of recent filebeat (6.2.4 or 6.2.3) compiled for AIX 7.2 ? Latest binary version on Bull Freeware http://www.bullfreeware.com/go/ is of version 6.0.0-alpha. Thanks, Luca |
Hi Luca |
I've delivered a first release of GCC 8.1.0 for AIX 7.2, with Go v1.10, on BullFreeware: One must install the following go packages (and their dependencies in bold): Tests results: BSum.sh gcc-8.1.0-1.spec.res_20180507_091433
../BIN/ParseLibgoAll.sh gcc-8.1.0-1.spec.res_20180507_091433 Dir: /libgo (32bit) Dir: /pthread/libgo Dir: /ppc64/libgo (64 bit) Dir: /pthread/ppc64/libgo |
@trex58 @better0332 I'm on AIX7.1 and hit the same problem.
|
Hi I think that you should use: -static-libgo -static-libgcc instead. |
Hi @trex58, thanks for the in-depth response. I managed to build using Another question: Would it be possible to build a "static" binary that could run on AIX 6.x? Running the binary built with bash-4.4# oslevel -s && /tmp/helloworld
6100-09-09-1717
exec(): 0509-036 Cannot load program insiderd because of the following errors:
0509-130 Symbol resolution failed for insiderd because:
0509-136 Symbol faccessat (number 12) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol fchmodat (number 15) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol fchownat (number 17) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol mkdirat (number 32) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol mknodat (number 34) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol renameat (number 41) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol unlinkat (number 57) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol ___strcmp64 (number 72) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol openat (number 193) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-136 Symbol open64at (number 194) is not exported from
dependent module /usr/lib/libc.a[shr_64.o].
0509-192 Examine .loader section symbols with the
'dump -Tv' command.
bash-4.4# The AIX version and gccgo version I'm using to build the binary: bash-4.4# go version
go version go1.10.3 gccgo (GCC) 8.2.0 aix/ppc
bash-4.4#
bash-4.4# gccgo --version
gccgo (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bash-4.4#
bash-4.4# oslevel -s
7100-05-02-1810
bash-4.4# I suspect it have something to do with the libc.a being different, as you already pointed out. There's some way of working around it? Thanks in advance! |
Hi Felipe, |
golang v1.11.1 has been delivered on BullFreeware. |
The openat() family (which comes from POSIX 2008) was introduced with AIX 7.1 |
golang 1.11.4 is available on BullFreeware. Build of golang v1.12 on AIX starts to appear "ok" on the golang buildfarm: |
Just to make sure I understand, cross compilation is not available as in the OP question? With gccgo we still need to build on AIX? |
@sfc-tbrown AFAIK, yes... you still need to build gcc-go for AIX, and then used it to build Go binaries for AIX To run on AIX 6.x I needed to build gccgo for AIX 6, and the same for AIX 7 |
DWARF support was introduced in AIX 7.1 (Ref: IBM AIX Version 7.1 Differences Guide) |
HI team //#include <stdio.h> //export printHello func main() { i have the gcc,gccgo installed and i ma able to compile and run go program without CGO correctly . thanks a lot |
Hello, dbx -a 21037528(dbx) where |
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?windows but I want a binary for AIX
Question
Is there a way to build a binary which will be run on AIX? what GOARCH and GOOS should I choose?
The text was updated successfully, but these errors were encountered: