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

AIX build is broken #5970

Closed
bmarwell opened this issue Dec 11, 2023 · 22 comments
Closed

AIX build is broken #5970

bmarwell opened this issue Dec 11, 2023 · 22 comments
Labels
deferred ⏰ We'll come back to this later upstream ⬆️ Relates to some dependency of this project

Comments

@bmarwell
Copy link
Contributor

Hi,

I just noticed the env vars GOOS=aix GOARCH=ppc64 will lead to a build error:

$ GOOS=aix GOARCH=ppc64 go build
# github.com/dgraph-io/badger
../../../../go/pkg/mod/github.com/dgraph-io/badger@v1.6.2/dir_unix.go:63:13: undefined: unix.Flock
# github.com/dgraph-io/badger/v2
../../../../go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.4/dir_unix.go:62:13: undefined: unix.Flock
# github.com/google/certificate-transparency-go/x509
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/cert_pool.go:65:9: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/root.go:21:32: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/verify.go:759:12: c.systemVerify undefined (type *Certificate has no field or method systemVerify)

I think this should have worked out of the box? => https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63

I found no infos about AIX not being supported. Any help is appreciated.

@bmarwell
Copy link
Contributor Author

bmarwell commented Dec 11, 2023

Just for reference, other not-so-common platforms work fine, too.

~/git/caddy-2.7.6-src/caddy ⌚ 10:25:19
$ GOOS=linux GOARCH=ppc64le go build

~/git/caddy-2.7.6-src/caddy ⌚ 10:27:32
$ file caddy
caddy: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1 (SYSV), statically linked, Go BuildID=G8uALCkYZAyhWc4CyD6c/zliuk-1icIxIIpa3eOMl/vI3N5kg7rx6eOf2RfoYl/on9sJjH1QcQMdAMjc8O0, with debug_info, not stripped

~/git/caddy-2.7.6-src/caddy ⌚ 10:27:34
$ GOOS=linux GOARCH=s390x go build

~/git/caddy-2.7.6-src/caddy ⌚ 10:27:53
$ file caddy
caddy: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), statically linked, Go BuildID=mkeLzHm9-bugelmaRTtG/PPW-2hvu4VfD7pgOy9Wu/97vrcGdc2E5OZK_rR8Rq/bXuMaIM1H6bX4ZVQfbd7, with debug_info, not stripped

@francislavoie
Copy link
Member

I've never even heard of aix. We're not testing for that in our crossbuild job https://github.com/caddyserver/caddy/blob/master/.github/workflows/cross-build.yml

Either way, this is a problem with upstream dependencies. You'll probably need to get the attention of dgraph-io/badger and google/certificate-transparency-go to fix it.

@francislavoie francislavoie added the upstream ⬆️ Relates to some dependency of this project label Dec 11, 2023
@mohammed90
Copy link
Member

For badger, the issue is a gap further upstream in golang.org/x/sys/unix, which is missing some syscalls for AIX, notably Lock.

@bmarwell
Copy link
Contributor Author

I really do not know what to do here. If you would like to help me out, you'd need to create upstream issues for this -- sorry! (and thanks for the quick analysis!).

@mohammed90
Copy link
Member

I really do not know what to do here. If you would like to help me out, you'd need to create upstream issues for this -- sorry! (and thanks for the quick analysis!).

Just so we know the use case, are you trying to use Caddy on AIX, or just mere curiosity?

@bmarwell
Copy link
Contributor Author

Just so we know the use case, are you trying to use Caddy on AIX, or just mere curiosity?

I would like to evaluate different web- and reverse-proxy servers for a few use cases. But AIX is a must-have for me for inclusion into my compatibility matrix. But in terms of use-case, it is just a proof-of-concept, so something in-between, probably.

bmarwell added a commit to bmarwell/caddy that referenced this issue Dec 11, 2023
@bmarwell
Copy link
Contributor Author

I've never even heard of aix. We're not testing for that in our crossbuild job https://github.com/caddyserver/caddy/blob/master/.github/workflows/cross-build.yml

Either way, this is a problem with upstream dependencies. You'll probably need to get the attention of dgraph-io/badger and google/certificate-transparency-go to fix it.

Oh, I can add a PR for that! #5971
Let me just find and sign the CLA form. 😊

@mohammed90
Copy link
Member

Reported upstream:

@mholt
Copy link
Member

mholt commented Dec 12, 2023

We might have to defer this as I think this is largely out of our control. It looks like AIX simply does not support the API needed. But with the tag we can revisit this more easily. Thanks for reporting!

Closing because there's nothing actionable we can do right now (more than Mohammed has done), as far as I know... but feel free to continue discussion.

@mholt mholt closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
@mholt mholt added the deferred ⏰ We'll come back to this later label Dec 12, 2023
@mohammed90
Copy link
Member

@bmarwell, you can use the build tag nobadger to build Caddy on AIX. We don't use Badger anyways; we use bbolt, which works on AIX without issues.

@bmarwell
Copy link
Contributor Author

Thanks, will try! The docs didn't mention this, at least not on the front page.

@bmarwell
Copy link
Contributor Author

Hi @mohammed90

build tag nobadger to build Caddy ...

... how do I do that? Note, I'm not using xcaddy. Haven't found "build tag",
nor "nobadger" in the docs.

@mohammed90
Copy link
Member

mohammed90 commented Jan 10, 2024

Thanks, will try! The docs didn't mention this, at least not on the front page.

Yeah, it wasn't clear on our dependency's repository until I went through their source code.

how do I do that? Note, I'm not using xcaddy

"build tags" are a Go thing, not xcaddy thing. Inside cmd/caddy, run this:

GOOS=aix GOARCH=ppc64 go build -tags nobadger

Note that you'll have to build with the branch add-nobadger-tag (created for PR #6031) HEAD (now merged) because we need a transient dependency (which isn't in our execution path 🤷) to be upgraded to HEAD.

@bmarwell
Copy link
Contributor Author

Woohoo thanks! Can now evaulate caddy as a reverse proxy! Many thanks! 👍🏻

@bmarwell
Copy link
Contributor Author

@mohammed90 how did you get around these error messages?

$ GOOS=aix GOARCH=ppc64 go build -v -tags nobadger -trimpath -o caddy.aix.ppc64-debug
github.com/google/certificate-transparency-go/x509
# github.com/google/certificate-transparency-go/x509
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/cert_pool.go:65:9: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/root.go:21:32: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/verify.go:759:12: c.systemVerify undefined (type *Certificate has no field or method systemVerify)

@mohammed90
Copy link
Member

@mohammed90 how did you get around these error messages?

$ GOOS=aix GOARCH=ppc64 go build -v -tags nobadger -trimpath -o caddy.aix.ppc64-debug
github.com/google/certificate-transparency-go/x509
# github.com/google/certificate-transparency-go/x509
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/cert_pool.go:65:9: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/root.go:21:32: undefined: loadSystemRoots
../../../../go/pkg/mod/github.com/google/certificate-transparency-go@v1.1.6/x509/verify.go:759:12: c.systemVerify undefined (type *Certificate has no field or method systemVerify)

You have to build from the commit b359ca5 because we had to upgrade github.com/google/certificate-transparency-go dependency to HEAD as well.

Basically, if you git-cloned Caddy, do git pull origin master then build from there.

@bmarwell
Copy link
Contributor Author

bmarwell commented Jan 11, 2024

I just used master. Then did the following:

  • Create a new folder: mkdir caddy
  • Change into it: cd caddy
  • Copy Caddy's main.go into the empty folder.
  • Initialize a Go module: go mod init caddy
  • Did go mod tidy

Compile: go build like above

@mohammed90
Copy link
Member

I just used master. Then did the following:

  • Create a new folder: mkdir caddy
  • Change into it: cd caddy
  • Copy Caddy's main.go into the empty folder.
  • Initialize a Go module: go mod init caddy
  • Did go mod tidy

Compile: go build like above

Oh, you'll have to run go get -u github.com/caddyserver/caddy/v2@master after the tidy step.

@bmarwell
Copy link
Contributor Author

Oh I think I need to execute go get github.com/caddyserver/caddy/v2@ although it says optional step. However, according to go, the step is not optional.

@bmarwell
Copy link
Contributor Author

Oh, you'll have to run go get -u github.com/caddyserver/caddy/v2@master after the tidy step.

Yup than the readme is not 100% correct. Instead of making the "go get" step optional, it should mention when to use it. And if you don't use it, you'd need go mod tidy.

@mohammed90
Copy link
Member

Oh, you'll have to run go get -u github.com/caddyserver/caddy/v2@master after the tidy step.

Yup than the readme is not 100% correct. Instead of making the "go get" step optional, it should mention when to use it. And if you don't use it, you'd need go mod tidy.

The README is correct because it's listing the typical workflow of building the latest tagged version without modification. The change in flow for you is because you're trying to build an untagged version that has not been released yet. Once we tag a new version, you won't need to do the go get -u ....

@bmarwell
Copy link
Contributor Author

Thank you for your patience explaining this! :) I am a Java developer only, all of what you said is really helpful! 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deferred ⏰ We'll come back to this later upstream ⬆️ Relates to some dependency of this project
Projects
None yet
Development

No branches or pull requests

4 participants