-
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
syscall: use Docker container for making auto-generated files #15282
Comments
I don't think there's anything fundamental to generating OpenBSD's The same looks to be true of the other |
How do you plan to support non-amd64 architectures? |
@hirochachacha, we're supposed to have builders for all Go architectures, and builders are supposed to be hermetic. So really we could/should just be using the builders to generate these. Dmitry generated the race runtime *.so files using the builders for various architectures. We use the builders to generate releases. Seems doable here too. |
@bradfitz Thanks. Are those builders are open to individual developers? |
(Sorry, conclusions are missing) Although 12 (virtual) machines => 12 cross compilers will reduce some costs, it's still painful. |
gomote access is available to those who ask and we recognize as being regular contributors.
Got a proposal? |
I see.
Yeah, I'm convinced, thank you. |
CL https://golang.org/cl/37943 mentions this issue. |
/cc @josephlr who did https://golang.org/cl/37943 |
Updated https://golang.org/cl/37943 with the basic design of how we should go about doing this in general. The steps should look something like:
Also, @bradfitz suggested |
The advantage of At least, that's how it used to be. I haven't really kept up with latest Docker. If you want to use |
Just gave it a run for the first time on my linux/amd64 host. It works great!! I glanced at the diff and it appears that there are quite a few constants that are currently outdated or incorrect in master for various architectures. Well done. I'll review the code now. |
@bradfitz, it seems like the shared directories work on macOS and Windows, so it should be possible to now generate all the Linux go files from a macOS or Windows system. It seems like |
Most of the changes introduced to the
These are a lot of changes, would be easier to submit diffs on a per-architecture basis, or by the type of change (i.e. one diff fixes all the |
Also, what should we do about |
Changes existing exported pad fields to no longer be exported is likely to break existing programs. While clearly those programs should not be referring directly to padding fields, in fact they do. |
In general while for x/sys/unix we can make things right, for syscall we need to preserve existing names even if they seem wrong to us. |
I think that diffs by architecture will be simplest. I assume the sparc64 information in x/sys/unix was built using gccgo. |
That seems reasonable: change them in x/sys/unix but not in syscall. Would we even want this sort of process for syscall as it is "locked down"? |
It would still be nice for syscall also. We do occasionally still update it for Go's needs. By "locked down" we primarily mean that we don't add to it by user request just to add new specific symbols. But if something in the Go std library needs something, we sometimes do update it. |
The main issue I could see is that switching over the building of the |
Since this is going to regenerate all the z* files in x/sys/unix, could this include the change that was suggested by @ianlancetaylor in issue #19560 to define Signal and Errno within x/sys/unix and eliminate the need to continue to use syscall.Signal and syscall.Errno? That will allow Go users to (almost) migrate completely from syscall to x/sys/unix. I don't understand how this proposal works for non-amd64 architectures. The values that are generated and put into the z files are pulled from the host system's header files, which aren't the same for all architectures. So if you are going to use cross compilers you are still reading the header files from the amd64 host. |
I think we should worry about |
Right now the process for adding in new constants, errors, or syscalls for Linux is a pain and unreliable. The scripts are designed to be run on the target architecture and use the header files installed on the user's system. This makes it hard to generate files for all the architectures or to have consistency between users. See golang/go#15282. This CL fixes this issue by making all of the files for the 11 supported architectures directly from source checkouts of Linux, glibc, and bluez. This is done using Docker, the gcc cross-compilers, and qemu emulation. Previously discussed here: https://go-review.googlesource.com/c/37589/ A README.md file is also added to explain how all the parts of the build system work. In order to get the build working for all the architectures, I made some changes to the other scripts called from mkall_linux.go: - Files only used for generating linux code, moved to linux/ - linux/mksysnum.pl supports a specified CC compiler. - The generated C code in mkerrors.sh changed to avoid a warning - mkerrors.sh headers changed to fix powerpc64 bug in sys/ioctl.h - linux/types.go no longer needs to export Ptrace structs in lowercase Build instructions: - Host system needs to be x86-64 Linux - Install Docker (https://docs.docker.com/engine/installation/) - ./mkall.sh (That's it!!!) Change-Id: I87067c14442ba12f8d51991349a43a9d73f38ae0 Reviewed-on: https://go-review.googlesource.com/37943 Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Change https://golang.org/cl/102655 mentions this issue: |
With cgo supporting sparc64 as of CL 102555 and CL 132155, the Docker based build system can be used to generate file for linux/sparc64 as well. Updates golang/go#15282 Change-Id: I109e55f39d3229b24b0029c42074e439c6c54dc8 Reviewed-on: https://go-review.googlesource.com/c/102655 Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Since |
For example, it appears that a few constants were added to |
The auto-generation of the
syscall/z*.go
files is a mess.Their generation depends on the headers installed on the host system, so nobody can reliably generate them without making a bunch of accidental unrelated changes.
This applies equally to pkg
syscall
and togolang.org/x/sys/unix
.Let's use a Dockerfile in there and then run mkwhatever.{sh,pl,go} file in Docker, and then
docker cp
the auto-generated files out of the container back to the host.Recent chaos:
It's less clear what to do about other Unix, like OpenBSD (https://go-review.googlesource.com/#/c/21797/, etc). @mdempsky? Jails? But openbsd is tricky for other reasons: #15227
Windows seems to be fine.
/cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: