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
runtime: crosscompiled to AIX/ppc64 not working in IBMi PASE (AIX7.2) due to "not in usable address space" #45017
Comments
1.14 is out of support, please test with 1.16 |
same problem
|
ping @trex58 |
ping @Helflym |
@rfx77 This is normal. On AIX 7.2, the pointers allocated by
There are some issues related to this #38966 #35451 as along as some commits (check the history of malloc.go they should be listed there). However, that might not be the only issue regarding IBMi. I don't know. |
On IBM-i 7.4 the Pase Runtime is derived from AIX 7.2, Technology Level 2. |
Strange maybe that AIX feature is there on IBMi or it's set up to the other segment. You can try the VMO tunable which controls that on AIX. It should be something like |
The ENV Variable VMM_CNTRL has no effect. I checked the sourcecode but i am not deep enough in the go source to check what the problem is. can someone guide me to the point where i can change the memory allocation and what to change? Or can i help someone who knows more with my testing. We have a IBMi 7.4 TR3 running so i could help. |
Maybe there is another way to change the default mmap segment. If as you said, IBMi 7.4 is based on AIX 7.2, then the IBMi devs should have said something about that.
I've listed the main things to do above. The AIX comments in |
I did what you suggested and it works. The simple Hello World example runs on IBMi i also tried a simple rest-webserver. works also How can we proceed and what should we test to check if it stable? |
Alright good news! You should be able to bootstrap Go for IBMi with |
Ok. I compiled the bootstrap and it runs on IBM-i. But make.bash does not. here is the output:
|
It looks like some more part in the runtime needs to be changed. But I don't know where. I don't remember having such issues. |
Okay. i also edited malloc at another position and lfstack_64.go. now my webserver seems stable. i will build another bootstrap and give you feedback |
Now i get an error when with make.bash
with more verbosity
|
I did some testing an i cannot get the compiler to work on the ibmi. but all my crosscompiled projets work without a problem. for me it would be sufficient when i can develop on my pc and crosscompile to ibmi. Developing directly on ibmi is not necessary - and no real fun ;-) would it be possible to add a new cross-compile os like (ibmi or aix-pase). i only changed three lines of code but this kills the aix compatibility and i have no aix to test.
|
Well, until anyone managed to get a full bootstrap on IBMi, I guess patches related to IBMi won't be accepted in the source code. |
Since IBM has a good Open-Source strategy with IBM-i maybe someone from IBM could help. Are there any active contributors from them? |
@ThePrez maybe you can jump in at this point? Are there any plans for go support on IBM i and besides that also for providing IBM i VMs for open source development? |
When i use the bootstrap version of go as GOROOT i can compile a simple "Hello World" on IBMi
But it seems to me that the cgo integration is the problem. When i try to compile a net/http server example i get the following error:
The content of the file is:
Has anybody seen this and can help me what the problem might be. Greetings, Update: Problem seems to be the last line which fails in lex.go because the split with / returns only one element. |
Hacked around the problem but now i am back where i was when trying to compile with the bootstrap version:
|
We unfortunately don't have any concrete dates for golang yet. IBM should probably implement those |
Hi, IBMer here working on IBM i. While the IBM i PASE runtime (ie userspace layer) is based on AIX, the kernel is distinct. In the case of 1TB Segment Aliasing, that is not a feature that is implemented in the IBM i kernel, so it does not work and we'll need to use the standard mmap region as has been mentioned previously in this thread. (I've been meaning to bring this up with our kernel folks). I have played around with some Golang stuff a bit on IBM i and have some branches and issues here: https://github.com/kadler/go including https://github.com/kadler/go/tree/pase-go1.15.3. IIRC, this is enough to get some basic Golang programs built in a cross compile manner, but I have not had much luck running the compiler on IBM i itself due to the loader errors @rfx77 you seem pretty gung-ho on go/IBM i. Maybe we can collaborate to move this forward. |
@kadler: i have fixed the 64002005. They all come from concurrency problems with the ifs. i have disabled all parallel work and this is solved but thats not the only problem ;-) i will post in the next minutes my findings with a compile output as summary for all interested. |
So a short summary: Good News and bad news now. With some work i managed to get to the point where i can build toolchain1, go_bootstrap, toolchain2 and toolchain3 on the ibmi The compiler compiles much of the libraries but i have a problem with cgo. it seems to require dwarf debug symbols which are not supported with gcc on ibmi. (gcc -gdwarf) is there any way around this when i want to build golang on the platform. Here is my output (i removed some verbosity):
|
You are running on IBM i 7.4? AFAIK, that's the earliest version where DWARF support might be available (I don't recall if it was out of the box in AIX 7.2). Regardless, you'll need a newer version of GCC which understands DWARF support in AIX as well. While we are working on building a newer GCC version, it is not ready for release yet. |
Yes 7.4. Where can i get this gcc version? |
Bad news on the usablility side. Since cgo is not working because of missing dwarf-2 support on ibmi i cannot compile any odbc api or self-programmed pase-ile bridge --> No connection to anything usefull is possible. @kadler: are there any beta or preview versions of gcc with dwarf-2 so that i can further test |
Hi Franz (@rfx77), out of curiosity I tried to follow your steps and see if I could get go up and running on our IBM i development system (IBM i 7.3). But I seem having troubles getting a proper bootstrap for aix/ppc64 that's working on our IBM i. What I did
Did I miss something? Is there anything I might be doing wrong trying to create the aix/ppc64 bootstrap? Thanks in advance ;) Error output
|
This is not good. Maybe the memory-changes do not work on 7.3 which has AIX 7.1 in PASE Runtime. When i apply my patch (only the changes in malloc.go and lfstack_64bit.go) on a golang on windows and do a crosscompile than it works. this is the simplest step to check if the memory-address changes work. without any memory-patch the bootstrap is not working on ibmi, as any other go programs. |
IIRC go on AIX requires AIX 7.2, so you need at least IBM i 7.4. |
Thanks @kadler for the information. I wasn't aware of that. In that case I'll lean back until we migrated to IBM i 7.4 ;) |
@rfx77 We've now pushed out a build of GCC10 w/ support for DWARF symbols. Let me know how it works with cgo. NOTE: None of our debuggers yet support DWARF symbols in XCOFF files, though. dbx has no clue what to do and GDB 7.9 triggers an internal error and exits. |
go now compiles with cgo support. i sometimes get when try to compile eg. go-odbc i know have a problem with certificates which i cannot solve: |
Okay. i resolved the https issue and finally: I got odbc running on the platform. Now we can do something usefull with go on IBMi |
Go expects a curl-style certificate bundle. If you have the latest ca-certificates package on IBM i, this now gets created at /QOpenSys/var/lib/ca-certificates/ca-bundle.pem. You'll need a change llike I've done here: kadler@c65f230 Note that I've defined a whole new "OS400" platform, while IIRC you're cross-compiling AIX, which uses /var/ssl/certs/ca-bundle.crt. You could either copy the bundle to the other location or adjust src/crypto/x509/root_aix.go to look at both. |
@kadler: Could IBM provide a devel-system so that we can build a build-system to make binaries for os400. Even if we dont get into the official repo we could provide binaries for IBMi customers who want to test. |
That's something I would love to see happen, but has not gone anywhere unfortunately. There are community systems like https://pub400.com/ that are available, though I don't now how suitable such a system is. |
Developing open source software for a closed system is not gonna work out in the long run. People tend to develop open source software or packages in their spare time with their private equipment and therefore need free or at least easy access to the operating system in order to support the community. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
Thanks @ianlancetaylor. I asked the question because it directly relates to the issue in the discussion. This build command is still causing the "not in usable address space" issue on IBM i 7.5 and go version 1.20. Thanks for your reply. |
You have to use my patch. |
@rfx77 Thanks for your reply. I am relatively new to the Go. Can you please give some more details on how to use your patch? |
To be honest the process of getting GO working on IBM-i is not an easy untertaking and i didnt do it with new versions since 2021. So you are on your own. I also dont see that without IBM Support there will be a usefull solution because of the async filesys problems with the IFS and the 64002005 Errors. |
@rfx77 is your statement true for cross-compiled executables also? |
@rfx77 I went back and read through this issue, and it seems like we should maybe just support the What's really unfortunate about all this is that ideally we wouldn't have an
This doesn't seem solvable from our side, but at least we could get past the problems on our side. |
Just to give a hint if this might help... |
Thanks. I was able to cross compile the golang app without cgo for AIX/ppc64. But still not luck with cgo and ODBC uses cgo. |
You need to install gcc10. then you can enable cgo. |
Thanks. I have gcc 11.3.0. It seems I have to compile the code on IBM I(AIX). Cross compile for IBM I(AIX) from Linux is not going to work. When I try to cross compile, gcc complains about undefined -maix64 flag. As per gcc documentation, this flag is hardware specific. |
I have create a version that that works on AIX (on IBM I). Based on this discussion and notes from other people. Its not perfect but its works (somehow) if anyone wants to play around. Its based on golang version 1.20.5 and its able to compile CGO apps as well. |
I want to crosscompile a simple Hello-World example to IBM-i PASE environment. This is a AIX 7.2 subsystem on the IBMi (AS400). Normally AIX compiled code should work in this environment.
But when i want to run the test application i get the following error:
Is this a problem which can be solved easily? How can i fix this?
This is the go code i compiled
i tried the crosscompile from windows and linux with the same result.
greetings,
Franz
The text was updated successfully, but these errors were encountered: