Skip to content
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

gccgo: Is there a way to build a binary which will be run on AIX? what GOARCH and GOOS should I choose? #20983

Closed
toussaiv opened this issue Jul 11, 2017 · 51 comments

Comments

@toussaiv
Copy link

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?

@OneOfOne
Copy link
Contributor

Dup of #19200?

@bradfitz
Copy link
Contributor

See in-progress dup issue #19200.

You'll need to use gccgo. There are no plans for the gc compiler (the one from golang.org) to support AIX, but the gccgo compiler should work. Or it appears that it's increasingly working.

Closing as dup of #19200.

@toussaiv
Copy link
Author

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

@trex58
Copy link

trex58 commented Jul 12, 2017

We (BullFreeware project) have ported gccgo on AIX.
It is a first release. Further release should fix some more issues (mainly in libgo).

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).
It is delivered as RPMs.
Look at: http://www.bullfreeware.com/search.php?package=gcc&version=aix7.2
gcc-go-7.1.0-7 for aix7.2 is available at: http://www.bullfreeware.com/affichage.php?id=3733
You'll have to download and install all dependencies (and some more).

There are 3 RPMs:
gcc-go-7.1.0-7.aix7.2.ppc.rpm
libgo-7.1.0-7.aix7.2.ppc.rpm
libgo-devel-7.1.0-7.aix7.2.ppc.rpm
requiring other RPMs (from GCC 7.1.0, and more).

What you have to do:
Let say you have a path = /X/Y/Z/src where is your Go code.
Do:
export GOPATH=/X/Y/Z
cd $GOPATH/src/
go build

go version
go version go1.8.1 gccgo (GCC) 7.1.0 aix/ppc

Let me know if you succeed to use it.

Current test status:

  • go compiler tests : 4 failures out of 7358 tests
  • libgo tests (32bit) : failing tests:
    fmt : TestCountMallocs
    log : TestAll
    net : TestConnAndListener : SIGILL: illegal instruction
    os : TestExecutable
    reflect : TestArrayOfAlg : SIGILL: illegal instruction
    runtime : TestCallers TestCallersPanic
    : TestGoroutineParallelism2 : timed out in gotest
    sync : TestWaitGroupMisuse2 : Unexpected panic:
    syscall : export_unix_test.go:10:22: error: reference to undefined name 'SYS_IOCTL'
    time : TestLoadFixed
    crypto/tls : TestVerifyHostname TestVerifyHostnameResumed : ??
    database/sql : TestStmtCloseDeps : ??
    encoding/gob : TestHugeWriteFails : fatal error: : runtime: out of memory
    go/build : TestDependencies
    log/syslog : TestFlap : SIGILL: illegal instruction
    net/http : TestClientRedirects : timed out in gotest : ??
    net/http/internal : TestChunkReaderAllocs
    os/exec : TestExtraFiles
    os/user : TestGroupIds
    reflect : TestArrayOfAlg : SIGILL: illegal instruction
    runtime/pprof : TestMemoryProfiler
    : TestMathBigDivide : fatal error: out of memory
    : TestMutexProfile : panic: runtime error: index out of range
    sync/atomic : TestNilDeref : timed out in gotest
    : TestUnaligned64 : LoadUint64 did not panic
    : TestValuePanic : Inconsistent store panic: got '
    (SIGILL failures deal with dereferencing function reference)
    ("out of memory" and "timed out" deal with issue in GccGo or limitation on AIX, for now)

@toussaiv
Copy link
Author

Big thanks @trex58 ! I Will test it tomorrow.. I was close to stop the benchmark of golang for my project..

@toussaiv
Copy link
Author

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?

@trex58
Copy link

trex58 commented Jul 13, 2017

About Gcc Go for AIX 7.1, look at:
http://www.bullfreeware.com/search.php?package=gcc&version=aix7.1

Go & libgo for AIX 7.1 :
gcc go : http://www.bullfreeware.com/affichage.php?id=3722
libgo : http://www.bullfreeware.com/affichage.php?id=3723
libgo-devel : http://www.bullfreeware.com/affichage.php?id=3724

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

@trex58
Copy link

trex58 commented Jul 13, 2017

Hummm A binary produced on AIX 7.1 does not work on AIX 6.1 ?
I never experimented this. I'll do.
What are the error messages ? Discuss with me at: tony dot reix at atos dot net .

About Gcc Go beeing officialy supported on AIX, there are 2 ways:

  • we are submitting our patches to FSF and Google in GCC v8: next year, when Gcc v8 is in GA, the code required for Gcc Go on AIX should be available in Gcc v8 code.
  • some day IBM should reuse our work and deliver an "official" version of Gcc Go 7.1.0 for AIX on their "AIX Toolbox" web-site: http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html

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

@trex58
Copy link

trex58 commented Jul 13, 2017

The executables produced by GCC Go depend on Go packages that are provided by libgo.a.
It also requires libgcc_s.a .
Bof of them are provided by GCC libraries:
rpm -q --whatprovides /opt/freeware/lib/libgo.a
libgo-7.1.0-7
rpm -q --whatprovides /opt/freeware/lib/libgcc_s.a
libgcc-7.1.0-7

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
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}

go build Hello.go

./Hello
Hello World!

ldd ./Hello
./Hello needs:
/usr/lib/libc.a(shr.o)
/opt/freeware/lib/libgo.a(libgo.so.11)
/opt/freeware/lib/libgcc_s.a(shr.o)
/usr/lib/librtl.a(shr.o)
/unix
/usr/lib/libcrypt.a(shr.o)
/usr/lib/libpthread.a(shr_xpg5.o)
/usr/lib/libpthread.a(shr_comm.o)
/usr/lib/libpthreads.a(shr_comm.o)

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).
gccgo Hello.go -static-libgo
./a.out

@mikioh mikioh changed the title Is there a way to build a binary which will be run on AIX? what GOARCH and GOOS should I choose? gccgo: Is there a way to build a binary which will be run on AIX? what GOARCH and GOOS should I choose? Jul 21, 2017
@tw-bert
Copy link

tw-bert commented Dec 10, 2017

@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?

@trex58
Copy link

trex58 commented Dec 11, 2017

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.
About Telegraf, I have no idea. Let me know where I can download it and have a look at it.

@tw-bert
Copy link

tw-bert commented Dec 11, 2017

@trex58 Thanks for the info, great stuff. Telegraf: see here . It is a metrics collector, similar to collectd (which some people have succesfully compiled on AIX by the way - I will give it a go if Telegraf's a no-go).

@trex58
Copy link

trex58 commented Dec 11, 2017

@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.
However, on Linux/Power and Linux/x86_64, though the errors I see on AIX do not appear, there are error messages, like:
undefined reference to `github_com_influxdata_telegraf_plugins_inputs_couchdb.metaData$hash'
That's a deeper error.
I've warned the GCC Go team.

@trex58
Copy link

trex58 commented Jan 10, 2018

Version 7.2.0 is available on AIX: version for AIX 7.2 :
http://www.bullfreeware.com/search.php?package=gcc&version=aix7.2

A snapshot of GCC 8.0.0 for AIX made the 5th of December is available at:
http://www.bullfreeware.com/go/go8.0.0/aix7.2/ .
It enables to build Kubernetes and other Go applications. Even in 64bits (ppc64), though there are some issues with 32bit .gox files used instead of 64bit .gox files. Being fixed right now.

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.

@tw-bert
Copy link

tw-bert commented Feb 18, 2018

@trex58 With the latest changes, do you think it's worth trying to build Telegraf again?

@trex58
Copy link

trex58 commented Feb 19, 2018

Version 8.0.1, snapshot 20180206, for AIX 7.2, is available on BullFreeware:
http://www.bullfreeware.com/go/go8.0.1/aix7.2/

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 .

@tw-bert
Copy link

tw-bert commented Feb 19, 2018

@trex58: Great. I got your go environment running, on a custom path (shared server, POC).

Here's go env:

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 ln -s ../../../../../otadb/golang/2/opt/freeware/libexec/gcc/powerpc-ibm-aix7.2.0.0/8.0.1 /opt/freeware/libexec/gcc/powerpc-ibm-aix7.2.0.0/8.0.1 to work around the GOTOOLDIR hard path.

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):
When building the first dependency:

  1. /otadb/golang/go/src/github.com/sparrc/gdm
  2. I do go build from that directory.
  3. I get /otadb/golang/2/opt/freeware/bin/gccgo: can not find compiler "go1": stat go1: no such file or directory

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 go1 ? Can you build sparrc/gdm?

@tw-bert
Copy link

tw-bert commented Feb 19, 2018

@trex58 Side issue: freeware/lib64/libgcc_s.a contained an absolute path in the symlink. I replaced it with a relative one (like the others).

@tw-bert
Copy link

tw-bert commented Feb 20, 2018

@trex58 Never mind about the go1, was just a missing exec flag, my fault entirely.

@trex58
Copy link

trex58 commented Mar 6, 2018

Version 8.0.1, snapshot 20180305, for AIX 7.2, is available on BullFreeware:
http://www.bullfreeware.com/go/go8.0.1/aix7.2/
It contains Go v1.10 .

go version
go version go1.10 gccgo (GCC) 8.0.1 20180305 (experimental) aix/ppc

@tw-bert
Copy link

tw-bert commented Mar 6, 2018

@trex58 Thanks for keeping us posted. I have to find the time to give it the attention it deserves.
I ran into some package dependency problems, not related to your work, but since we don't have a spare AIX server I have to create a proper chroot jail on our shared dev machine first before I can properly test it.

@lukibahr
Copy link

lukibahr commented Mar 27, 2018

Anyone managed to build a static go binary on aix, without any dependencies?

mine already needs some of them:
$ ldd a.out
a.out needs:
/usr/lib/libc.a(shr.o)
/usr/lib/libpthread.a(shr_xpg5.o)
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/7.2.0/libgcc_s.a(shr.o)
/usr/lib/libpthread.a(shr_comm.o)
/usr/lib/librtl.a(shr.o)
/unix
/usr/lib/libcrypt.a(shr.o)
/usr/lib/libpthreads.a(shr_comm.o)

@trex58
Copy link

trex58 commented Apr 3, 2018

Hi lukibahr,
None of these dependencies seem weird for me.
Which commands did you use for generating your a.out ?

  • cat bof.go
    package main
    import "fmt"
    func main() {
    fmt.Printf("Hello !!\n")
    }

  • gccgo /tmp/bof.go

  • ldd a.out
    a.out needs:
    /usr/lib/libc.a(shr.o)
    /opt/freeware/lib/libgo.a(libgo.so.13)
    /opt/freeware/lib/libgcc_s.a(shr.o)
    /unix
    /usr/lib/libcrypt.a(shr.o)
    /usr/lib/libpthread.a(shr_xpg5.o)
    /usr/lib/libpthread.a(shr_comm.o)
    /usr/lib/libpthreads.a(shr_comm.o)

@better0332
Copy link

@trex58 I test on AIX6.1 use http://www.bullfreeware.com/affichage.php?id=3899, but It 's too slow.

time /opt/freeware/bin/go env
GOARCH="ppc"
GOBIN=""
GOEXE=""
GOHOSTARCH="ppc"
GOHOSTOS="aix"
GOOS="aix"
GOPATH="/go"
GORACE=""
GOROOT="/opt/freeware"
GOTOOLDIR="/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/7.2.0"
GCCGO="/opt/freeware/bin/gccgo"
CC="/opt/freeware/bin/gcc"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build626423053=/tmp/go-build -gno-record-gcc-switches"
CXX="/opt/freeware/bin/g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

real 0m7.537s
user 0m7.294s
sys 0m0.155s

And the CPU is higher than 20%

@tw-bert
Copy link

tw-bert commented Apr 3, 2018

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

@trex58
Copy link

trex58 commented Apr 3, 2018

We have improved the time needed for starting a Go a.out within last versions of GCC Go 8.0.1 .
About AIX 6.1, since it does not contains features required for cgo (and also recent DWARF), we plan to deliver GCC Go only/mainly on AIX 7.2 .

@better0332
Copy link

@trex58 can we build static on AIX 7.2 than run on AIX 6.1 to solve this problem

@trex58
Copy link

trex58 commented Apr 3, 2018

"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.
On AIX 7.1, GCC Go should work quite fine. However, for now, I haven't built/tested on AIX 7.1 . I'm still focused on AIX 7.2 where there are still tests failures (however, that does not prevent Kubernetes to compile and run).

@better0332
Copy link

@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

@trex58
Copy link

trex58 commented Apr 5, 2018

Latest version on AIX 7.2 (which is my main Gcc Go development environment) is: gcc-8.0.1-20180305 .
I have a 8.0.1-20180206 version available for AIX 7.1 . Let me know if this version would help you. If yes, I'll push it on BullFreeware.
Meanwhile, I'll launch a build of 8.0.1-20180305 on AIX 7.1 .
And I plan to update 8.0.1 on AIX 7.2 with a recent snapshot.

@better0332
Copy link

@trex58 I want 8.0.1-20180305 on AIX 7.1, thanks

@trex58
Copy link

trex58 commented Apr 6, 2018

GCC Go 8.0.1 snapshot 2018/03/05 for AIX 7.1 is available at:
http://www.bullfreeware.com/go/go8.0.1/aix7.1/
libgo tests have been run, and seem good.

@better0332
Copy link

@trex58 thanks, it‘s faster than before. but when I use '-static' it error:

./go build -gccgoflags -static test.go
...
ld: 0711-224 WARNING: Duplicate symbol: .forward_xfrm_std
ld: 0711-224 WARNING: Duplicate symbol: __gcc_unwind_dbase
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: encrypted_pw_passlen
ld: 0711-317 ERROR: Undefined symbol: getpass_auto
ld: 0711-317 ERROR: Undefined symbol: crypt_r
ld: 0711-317 ERROR: Undefined symbol: max_history_size
ld: 0711-317 ERROR: Undefined symbol: max_pw_passlen
collect2: error: ld returned 8 exit status

@trex58
Copy link

trex58 commented Apr 6, 2018

Yes. I can reproduce it.
We may have not handled this case already. Try without -static . Did it work with GCC Go 7.2 ?
Use: gccgo -v -static test.go in order to see details.
Issue appears within collect2. Use: -bloadmap:/tmp/LM within collect2 to see below details.
Investigating.

ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
Symbol Inpndx TY CL Source-File(Object-File) OR Import-File{Shared-object}
RLD: Address Section Rld-type Referencing Symbol

encrypted_pw_passlen [1396] ER DS (/usr/lib/libc.a[shr.o])
0007c194 .data R_POS [2072] <encrypted_pw_passlen>
getpass_auto [1402] ER DS (/usr/lib/libc.a[shr.o])
0007c950 .data R_POS [3062] <getpass_auto>
crypt_r [1392] ER DS (/usr/lib/libc.a[shr.o])
0007caa4 .data R_POS [3232] <crypt_r>
max_history_size [1398] ER DS (/usr/lib/libc.a[shr.o])
0007cab0 .data R_POS [3238] <max_history_size>
max_pw_passlen [1394] ER DS (/usr/lib/libc.a[shr.o])
0007ccf4 .data R_POS [3528] <max_pw_passlen>

@trex58
Copy link

trex58 commented Apr 6, 2018

-lcrypt is missing from command line:
gccgo -v -static -lcrypt test.go
However, now, _kgrantpt symbol is missing. No idea yet WTF it is.
gcc -v -static -lcrypt test.c does work fine.
Hummmm We think that using -static with Go on AIX may be impossible. Investigating.

@better0332
Copy link

@trex58 " _kgrantpt symbol is missing" I got same error. Is there any other way?

@lucket
Copy link

lucket commented May 11, 2018

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

@trex58
Copy link

trex58 commented May 14, 2018

Hi Luca
Hummmm I do not remember why I provided this version of Filebeat one year ago...
Anyway, I'll soon publish GCC 8.1.0 (with Go v1.10) on the main pages of BullFreeware. And you should be able to build Filebeat by yourself. Let me know if you cannot.
Moreover, remember that the way GCC Go is architectured is probably not yet stable, meaning that objects or libraries built by means of a version A of GCC Go may not be compatible with other objects and libraries builds by means of a version B of GCC Go. An executable should be built by compiling all the source codes it depends by means of the SAME version of GCC Go.
Tony

@trex58
Copy link

trex58 commented May 14, 2018

I've delivered a first release of GCC 8.1.0 for AIX 7.2, with Go v1.10, on BullFreeware:
http://www.bullfreeware.com/search.php?package=gcc&version=aix7.2

One must install the following go packages (and their dependencies in bold):
gcc-c++-8.1.0-1
gcc-8.1.0-1
gcc-cpp-8.1.0-1
libgcc-8.1.0-1
libstdc++-8.1.0-1

libstdc++-devel-8.1.0-1
libgomp-8.1.0-1
gcc-go-8.1.0-1 http://www.bullfreeware.com/affichage.php?id=4299
libgo-8.1.0-1 http://www.bullfreeware.com/affichage.php?id=4300
libgo-devel-8.1.0-1 http://www.bullfreeware.com/affichage.php?id=4301

Tests results:

BSum.sh gcc-8.1.0-1.spec.res_20180507_091433
EP: Expected Passes
UF: Unexpected Failures
EF: Expected Failures
US: Unexpected Successes
UC: Unresolved TestCases
UT: Unsupported Tests

    Tests            EP       UF       EF       US       UC       UT
    ------------------------------------------------------------------
    libffi         1934        0        0        0        0       28
    gfortran      46006       13       84       12        0      371
    g++          109422       28      769       27        9     5194
    libgomp        5367        7        0        0        0      372
    libstdc++     10589       10       76        0        9      790
    go             7389        4        1        0        0        3
    obj-c++        1408        0        2        0        0       59
    objc           2678        1       10        0        0       59
    libatomic        44        0        0        0        0        5
    gcc           87185       25      407       10        9     2789
    ------------------------------------------------------------------
    Total        272022       88     1349       49       27     9670

    GrandTotal:    283205

    UF/GT     :  0.0310729%

../BIN/ParseLibgoAll.sh gcc-8.1.0-1.spec.res_20180507_091433

Dir: /libgo (32bit)
log : TestAll
math : TestPow
net : TestConnAndListener : SIGILL: illegal instruction
os : TestExecutable
runtime : TestSelectStackAdjust
runtime : TestSmhasherTwoNonzero : fatal error: out of memory
syscall : export_unix_test.go:10:22: error: reference to undefined name 'SYS_IOCTL'
time : TestTicker : fatal error: sem_timedwait
compress/flate : TestDeterministic/LM2 : fatal error: runtime: out of memory
crypto/tls : TestVerifyHostname
crypto/tls : TestVerifyHostnameResumed : panic: test timed out after 13m20s
encoding/gob : TestHugeWriteFails : fatal error: out of memory
net/http : TestNoBodyOnChunked304Response : === CONT TestCmdGoNoHTTPServer
net/http/internal : TestChunkReaderAllocs
os/exec : TestExtraFiles : timed out in gotest
runtime/pprof : TestMemoryProfiler TestMutexProfile TestMutexProfile/proto TestEmptyCallStack
runtime/trace : TestEventBatch/G=4950 : fatal error: out of memory
sync/atomic : TestUnaligned64 : timed out in gotest

Dir: /pthread/libgo
log : TestAll
math : TestPow
net : TestConnAndListener : SIGILL: illegal instruction
os : TestExecutable
runtime : TestSelectStackAdjust
runtime : TestSmhasherTwoNonzero : fatal error: out of memory
syscall : export_unix_test.go:10:22: error: reference to undefined name 'SYS_IOCTL'
time : TestTicker : fatal error: sem_timedwait
crypto/tls : TestVerifyHostname TestVerifyHostnameResumed
encoding/gob : TestHugeWriteFails : fatal error: out of memory
net/http : TestNoBodyOnChunked304Response : === CONT TestCmdGoNoHTTPServer
net/http/internal : TestChunkReaderAllocs
os/exec : TestExtraFiles
os/exec : TestIgnorePipeErrorOnSuccess/Infinite : panic: test timed out after 13m20s
os/signal : TestAtomicStop
runtime/pprof : TestMemoryProfiler TestMutexProfile TestMutexProfile/proto TestEmptyCallStack
runtime/trace : TestEventBatch/G=4950 : fatal error: out of memory
sync/atomic : TestUnaligned64 : timed out in gotest

Dir: /ppc64/libgo (64 bit)
crypto : : panic: testing: zero callers found
expvar : : panic: testing: zero callers found
log : TestAll
math : TestPow
net : TestConnAndListener : SIGILL: illegal instruction
os : TestExecutable
runtime : TestPingPongHog TestPhysPageSize TestPanicSystemstack
syscall : export_unix_test.go:10:22: error: reference to undefined name 'SYS_IOCTL'
time : TestLoadFixed
crypto/tls : TestVerifyHostname TestVerifyHostnameResumed
net/http : TestNoBodyOnChunked304Response : === CONT TestCmdGoNoHTTPServer
net/http/internal : TestChunkReaderAllocs
net/mail : : panic: testing: zero callers found
os/exec : TestExtraFiles : panic: test timed out after 13m20s
runtime/pprof : TestMemoryProfiler TestMutexProfile TestMutexProfile/proto TestEmptyCallStack

Dir: /pthread/ppc64/libgo
log : TestAll
math : TestPow
net : TestConnAndListener : SIGILL: illegal instruction
os : TestExecutable
runtime : TestPingPongHog TestPhysPageSize TestPanicSystemstack
syscall : export_unix_test.go:10:22: error: reference to undefined name 'SYS_IOCTL'
time : TestLoadFixed
crypto/tls : TestVerifyHostname
crypto/tls : TestVerifyHostnameResumed : panic: test timed out after 13m20s
net/http : TestNoBodyOnChunked304Response : === CONT TestCmdGoNoHTTPServer
net/http/internal : TestChunkReaderAllocs
os/exec : TestExtraFiles : panic: test timed out after 13m20s
runtime/pprof : TestMemoryProfiler TestMutexProfile TestMutexProfile/proto TestEmptyCallStack

@fesiqueira
Copy link

@trex58 @better0332
Hey guys!
Any of you managed to workaround the "_kgrantpt" issue?

I'm on AIX7.1 and hit the same problem.

$ go build -gccgoflags '-v -static -lcrypt' main.go
.
. tons of output...
.
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: _kgrantpt
collect2: error: ld returned 8 exit status

@trex58
Copy link

trex58 commented Oct 1, 2018

Hi
It is not a symbol in gcc-go & libgo RPMs of GCC v8.2 for AIX 7.2 nor AIX 7.1 .
It is a symbol appearing in AIX kernel.
Using -static implies that the libc.a will be included into the a.out .
_kgrantpt appears in a pty.exp that should appear in /usr/lib and a -bI instruction should fix the issue. However, it is not delivered by AIX... We guess that IBM does not want to make this part of AIX public. And probably also using -static on AIX is not recommended since libc.a may change between 2 sub-versions (TL) of a AIX version and that may result in weird issues.

I think that you should use: -static-libgo -static-libgcc instead.

@fesiqueira
Copy link

Hi @trex58, thanks for the in-depth response.

I managed to build using -static-libgo -static-libgcc as you suggested.

Another question: Would it be possible to build a "static" binary that could run on AIX 6.x?
And... there's no hope of running a Go binary on AIX 5.x, right?

Running the binary built with -static-libgo -static-libgcc on an AIX 6.1 throws the following errors:

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!

@trex58
Copy link

trex58 commented Oct 3, 2018

Hi Felipe,
No, sorry, it it impossible to have GCC Go on AIX 5.x .
About AIX 6.1, we have stopped to port Go on it because (as far as I can remember) this AIX version lacks some feature (DWARF ?) that are required for correctly implementing important Go features. For now, GCC Go v8 requires AIX >=7.1 . Only GCC Go v7.2 is available on AIX 6.1 . About golang v1.11 on AIX, it requires AIX >= 7.2 (TL2 is better than TL0) and Power >= 8 .
So, you say that you build Go HelloWorld on AIX 7.1 TL5 with GCC 8.2.0 and you execute it on AIX 6.1 . Wowww ! AIX provides upward compatibility only. As an example, the openat() routine is not provided by AIX 6.1 TL9 . Moreover, based on document http://public.dhe.ibm.com/systems/power/docs/aix/61/aixcmds4_pdf.pdf , it seems that no TL of AIX 6.1 provides the openat() routine (and some other routines of this family). I've studied this openat() routine already for the port of MariaDB, and openat() cannot be easily implemented.
So, unless I try again to build GCC Go 8.2 on AIX 6.1 in order to remind what exactly is missing (but I have plenty other things to do before), I think that you have to use AIX 7.1 for running Go programs.
Regards,

@trex58
Copy link

trex58 commented Oct 4, 2018

golang v1.11.1 has been delivered on BullFreeware.
Still for AIX 7.2 and Power >=8 only.
http://www.bullfreeware.com/search.php?package=golang
Next version v1.12 for AIX should be made available from golang web-site, in addition to BullFreeware. In February.

@pinacoelho
Copy link

pinacoelho commented Dec 17, 2018

Moreover, based on document http://public.dhe.ibm.com/systems/power/docs/aix/61/aixcmds4_pdf.pdf , it seems that no TL of AIX 6.1 provides the openat() routine (and some other routines of this family). I've studied this openat() routine already for the port of MariaDB, and openat() cannot be easily implemented.

The openat() family (which comes from POSIX 2008) was introduced with AIX 7.1
You can find more info on the "IBM AIX Version 7.1 Differences Guide" RedBook. ( SG24-7910 - http://www.redbooks.ibm.com/redbooks/pdfs/sg247910.pdf )

@trex58
Copy link

trex58 commented Dec 17, 2018

golang 1.11.4 is available on BullFreeware.
Still for AIX 7.2 and Power >= 8 only.
http://www.bullfreeware.com/search.php?package=golang

Build of golang v1.12 on AIX starts to appear "ok" on the golang buildfarm:
https://build.golang.org/#

@sfc-tbrown
Copy link

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?

@fesiqueira
Copy link

@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

@pinacoelho
Copy link

pinacoelho commented Jan 3, 2019

About AIX 6.1, we have stopped to port Go on it because (as far as I can remember) this AIX version lacks some feature (DWARF ?) that are required for correctly implementing important Go features.

DWARF support was introduced in AIX 7.1 (Ref: IBM AIX Version 7.1 Differences Guide)

@seavin
Copy link

seavin commented Feb 19, 2019

HI team
i am face an issue on export a C static library from Go via GCCGO compiler on AIX 7.2. my GO code below :
package main

//#include <stdio.h>
//#include <stdlib.h>
import "C"
import "fmt"

//export printHello
func printHello() {
fmt.Println("hello nuts!")
}

func main() {
// for c build
}
the command i used to compile it is : go build -compiler gccgo -buildmode=c-archive -o caculator.a -gccgoflags '-lgo -static' wrapper.go
then i got a c static library caculator.a , then i use it in a c program as below :
#include <stdio.h>
#include <stdint.h>
#include "caculator.h"
int main()
{
int a=12;
int b=13;
printf("Hello, let's test caculator!");
printHello();
printf("result:%d",12131231);
}
then i tried compile this c program with : gcc -o app main.c caculator.a -pthread
then i got a exec file: app
but when i tried to run it , it seems run into a deadlock , nothing print out
, anyone have an idea on this ?

i have the gcc,gccgo installed and i ma able to compile and run go program without CGO correctly .

thanks a lot

@trex58
Copy link

trex58 commented Feb 19, 2019

Hello,
I'm able to run this code perfectly on Linux/Power with some old GCC Go (plus -lm for math).
It is an issue in AIX. It looks like "runtime_init_done" in libgo/runtime/go-cgo.c is not set, thus showing initialization has not been done.
Investigating.

dbx -a 21037528

(dbx) where
_event_sleep(??, ??, ??, ??, ??, ??) at 0xd0572254
_event_wait(??, ??) at 0xd0572f3c
_cond_wait_local(??, ??, ??) at 0xd05825dc
_cond_wait(??, ??, ??) at 0xd0582ef4
pthread_cond_wait(??, ??) at 0xd058394c
_cgo_wait_runtime_init_done(), line 33 in "go-cgo.c"
printHello(), line 21 in "cgo-gccgo-export-file-prolog"
main() at 0x100005d8

@golang golang locked and limited conversation to collaborators Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests