-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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? |
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. |
Hello, to cross-compile the aix executable on windows, I use go version 1.16 and 1.19, Compiling command GOOS=aix GOARCH=ppc64 CGO_ENABLED=0 go build The compiled file cannot be executed on aix with oslevel=7.2.0.0. Illegal instruction(coredump) is returned. Is there a solution |
@Neo4jvv Have you tried a more recent release, like 1.21 or 1.22rc1? |
Yes, I followed up with 1.13, 1.15, 1.21.6,but nothing worked @randall77 |
Cross compile from windows wont work for AIX on power system. You have to compile on Power system. I added a link to github repo in this thread, check the readme there. That might help you. |
@onlysumitg : I think @Neo4jvv 's issue is different, as they are trying to compile with @Neo4jvv Does cross-compiling work for you from another OS, like linux? I can get the same binary compiling from amd64/linux and arm64/darwin: hello.go:
arm64/darwin:
amd64/linux:
|
Sorry, Missed the cgo_enabled flag. Yes it should work. But you need to make some changes in go runtime/code as recommended by @rfx77 |
@randall77 I can compile linux/amd64, linux/arm64 files from windows and execute normally, but aix/ppc64 compiled files will fail to execute |
That is strange. |
Download the go lang code from repo i mentioned on windows and cross compile using that. It will work. |
@onlysumitg Where do I get the link you uploaded, this is the first time I asked on github, I don't know how to operate, can you post the link here |
Try this one https://github.com/onlysumitg/ibmigo. I have to find the link that explain how to compile go from the source code. |
@onlysumitg Is your approach to compile go code on an aix host? But my development environment is windows, if I do not have an aix host is not able to implement this method |
@Neo4jvv dont worry about the readme. I wrote that considering the need to cgo. I belive you can use this golang code. Compile it on windows and use that version to cross compile for aix/ppc. I can try to write down exact step for windows in few days. |
@onlysumitg Okay, I'll try it now. Thank you |
@onlysumitg Please try to write the operation steps of windows,Please ,Please ,Please ,thank u, thank u,thank u |
@onlysumitg GOROOT=D:\ibmigo-main\go cannot be set directly after cloning this DIRECTORY locally, and the go file in the bin directory is not an exe file |
@Neo4jvv the ibmigo is for AIX PPC64 not for windows. for windows please give a try to following: |
I needed 1.22 support so I've consolidated the mods mentioned above and put them under the control of a GOEXPERIMENT flag. https://github.com/JasonTashtego/go Hopefully someone besides me can get some use out of it. |
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: