-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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? |
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. |
Hello, thanks all for your work on it. Based on your repo https://github.com/JasonTashtego succesfully compiled go on ibmi. Only one small remark, the tagptr_64bit.go should be updated too, to replace 0xa by 0x7 to work well without any memory issue. To avoid issue with unlinkat, I used //go build: !unix && !aix in removeall_at.go. Some issue with downloading go dependencies when trying to compile a go project with timeout on proxy.golang.org... Awesome and great community work! |
Hello, I tried to use go1.24 on IBMi but it fails with issue during garbage collector. As a workaround I can disable the garbage collector using export GOGC=off, at least I can compile the hello world example. Building Go cmd/dist using /home/stormalf/go1.24. (devel go1.24-585f995 Sat Nov 30 13:09:43 2024 +0100 X:iseriesaix aix/ppc64) internal/abiSIGSEGV: segmentation violation goroutine 0 gp=0x7000000483828c0 m=3 mp=0x700000048051008 [idle]: goroutine 1 gp=0x7000000480021c0 m=3 mp=0x700000048051008 [GC assist marking]: goroutine 2 gp=0x700000048002700 m=nil [force gc (idle)]: goroutine 3 gp=0x7000000480028c0 m=nil [GC sweep wait]: goroutine 4 gp=0x700000048002e00 m=nil [runnable]: goroutine 5 gp=0x700000048002fc0 m=nil [finalizer wait]: goroutine 22 gp=0x7000000480036c0 m=nil [GC worker (idle)]: r0 0x0 r1 0x18049c4d8 |
@stormalf -- Good to see someone else using it! I believe the tagptr_64bit.go change is in the first commit to the branch. Did you find another change necessary in that file ? |
Hello @JasonTashtego you're right, it was the change that I was looking for. Thanks. About the issue with go dependencies, I found that it was caused by /etc/resolv.conf that should be created. Not sure why, but go dependencies failed until I created the /etc/resolv.conf and specifying the nameserver field. The go version 1.24 is working fine on IBMi (by disabling for now the garbage collector). I will try to compile some go projects to check if we can have it running also on IBMi like grafana... |
Looks like I can try to build this, on Linux (technically, Ubuntu/WSL2), and it gets as far as starting to build the tests, but if I actually try to use the built toolchain, it bails out, with |
Hello @vmlemon, did you follow the instructions I detailed here : https://github.com/stormalf/go_ibmi ? I remembered having the same issue due to missing changes in files in ../goexperiment folder. Let me know if it helps. |
Thanks, I'll have a look, and let you know. I thought it was due to being on the wrong branch, but I still received it, even on |
I think I had the same issue on my first tries with branch release 1.22, that's why I tried to include all changes in the repo (not 100% the same as Jason probably 95%) and detail each step. It will be interesting to see if you will succeed by following the steps provided. Good luck |
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: