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

x/sys/unix: mkall.sh fails due to missing files #67178

Closed
programmingkidx opened this issue May 5, 2024 · 7 comments
Closed

x/sys/unix: mkall.sh fails due to missing files #67178

programmingkidx opened this issue May 5, 2024 · 7 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@programmingkidx
Copy link

Go version

go 1.22.0 darwin amd64

Output of go env in your module/workspace:

not needed

What did you do?

In the src/cmd/vendor/golang.org/x/sys/unix folder is the mkall.sh script. It is used to generate several files in its folder. First I changed directories to the src/cmd/vendor/golang.org/x/sys/unix folder. Then I ran GOOS=darwin GOARCH=amd64 ./mkall.sh.

What did you see happen?

I saw these errors:
:25:10: fatal error: 'sys/vsock.h' file not found
#include <sys/vsock.h>
^~~~~~~~~~~~~
1 error generated.
/go-1.22.0/src/cmd/vendor/golang.org/x/sys/unix/_const.go:28:10: fatal error: 'sys/vsock.h' file not found
#include <sys/vsock.h>
^~~~~~~~~~~~~
1 error generated.
stat mksyscall.go: no such file or directory
stat mkpost.go: no such file or directory
cgo: open /go-1.22.0/src/cmd/vendor/golang.org/x/sys/unix/types_darwin.go: no such file or directory
stat mkasm.go: no such file or directory

What did you expect to see?

I expected to see these files generated:

  • zerrors_darwin_amd64.go
  • zsyscall_darwin_amd64.go
  • zsysnum_darwin_amd64.go
  • ztypes_darwin_amd64.go

I did read the README.md file in the same folder and it states:
"To build the files for your current OS and architecture, make sure GOOS and
GOARCH are set correctly and run mkall.sh. This will generate the files for
your specific system. Running mkall.sh -n shows the commands that will be run."

The issue is these files are missing from the unix folder:

  • mksyscall.go
  • mkpost.go
  • mkasm.go
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 5, 2024
@gopherbot gopherbot added this to the Unreleased milestone May 5, 2024
@mauri870
Copy link
Member

mauri870 commented May 5, 2024

These files do exist in the sys repo, e.g https://cs.opensource.google/go/x/sys/+/refs/tags/v0.20.0:unix/mkasm.go. Can you try building from the x/sys source instead?

I believe the vendored copy only includes the autogenerated code to be used, but not the routines to actually generate the code.

@mauri870 mauri870 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 5, 2024
@ianlancetaylor
Copy link
Member

The files under cmd/vendor are incomplete copies of upstream repositories. Those files are created by modifying the upstream repo and then running go mod vendor. In this case you should be looking at the golang.org/x/sys repo.

@programmingkidx
Copy link
Author

@mauri870 Why is the mkall.sh file not removed like the other files?

@ianlancetaylor
Copy link
Member

Go files with //go:build ignore lines are not copied into the vendor directory. There is no special rule for a shell file.

@programmingkidx
Copy link
Author

I'm thinking a rule should be added for shell files.

@ianlancetaylor
Copy link
Member

Unfortunately it's not that simple. It's possible for a .sh file to be embedded into the package using a go:embed directive (see https://pkg.go.dev/embed). It would be possible to complicate go mod vendor by having it compute the total set of embedded files and copy only those over, but simply ignoring shell files isn't safe by itself.

That said, I filed #67233 to propose only copying files that the build system will use.

@programmingkidx
Copy link
Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants