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

incus-0.3: Build failure openfga/go-sdk/oauth2/clientcredentials/clientcredentials.go: expects import "golang.org/x/oauth2" #34

Closed
ganto opened this issue Dec 17, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@ganto
Copy link
Owner

ganto commented Dec 17, 2023

When trying to build incus-0.3 from the release archive via RPM spec file the incusd binary build will fail with:

+ GOPATH=/builddir/build/BUILD/incus-0.3/_build:/usr/share/gocode
+ GO111MODULE=off
+ go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback libsqlite3' -ldflags ' -X github.com/lxc/incus/version=0.3 -B 0x581a52dff56a33d675a511b550782a8c391d2eeb -compressdwarf=false -linkmode=external -extldflags '\''-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '\''' -a -v -x -o /builddir/build/BUILD/incus-0.3/_build/lib/incusd github.com/lxc/incus/cmd/incusd
WORK=/tmp/go-build4146813390
_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/oauth2/clientcredentials/clientcredentials.go:19:5: code in directory /builddir/build/BUILD/incus-0.3/_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/oauth2 expects import "golang.org/x/oauth2"
_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/credentials/credentials.go:9:5: code in directory /builddir/build/BUILD/incus-0.3/_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/oauth2/clientcredentials expects import "golang.org/x/oauth2/clientcredentials"

The error doesn't happen when building the project via Makefile.

@ganto ganto added the bug Something isn't working label Dec 17, 2023
@ganto
Copy link
Owner Author

ganto commented Dec 19, 2023

Just a few notes for troubleshooting:

So it makes sense that the error is triggered when only considering the facts stated above. But why is it not triggered when building via Makefile?

@bketelsen
Copy link

this is a bug in the openfga repo, and should be filed & fixed there. They copied in code from the golang.org oauth2 package, but didn't modify the canonical import directive.

It's not triggered in the Makefile because the dependencies aren't vendored in the repo, but only in the release. So the go tooling is pulling in the golang.org package because that's what the openfga package tells it to do. Confirm this by looking at incus's go.mod file which doesn't mention the openfga org.

Issue filed here
PR filed here

@bketelsen
Copy link

unfortunately, even after PR is accepted and fix is released, incus needs to update the openfga dependency and make a new release.

@bketelsen
Copy link

lxc/incus#315 (comment)

@bketelsen
Copy link

OpenFGA promised a release today to fix this.
Incus 0.4.0 is dropping tomorrow.

So this may resolve in a day or two.

@bketelsen
Copy link

https://github.com/openfga/go-sdk/releases/tag/v0.3.1 OpenFGA fixed release, Incus maintainers will include in tomorrow's 0.4.0 release.

@stgraber
Copy link

Unfortunately we can't as we support building on the latest two Go versions and OpenFGA 0.3.x only builds on 1.21 (not sure if an actual requirement of just an artifact of their go.mod).

@bketelsen
Copy link

for completeness, OpenFGA released a version for go 1.20 to resolve this.

@ganto
Copy link
Owner Author

ganto commented Dec 20, 2023

Wow, thanks a lot for stepping in. I really thought there is something wrong on my side otherwise I would have reported that sooner. I'll therefore try my luck again once incus-0.4 is released.

@bketelsen
Copy link

my pleasure, thanks for packaging Incus & LXD!

@stgraber
Copy link

0.4 is out, well, tag and tarballs are, still working on the announcement :)

@ganto
Copy link
Owner Author

ganto commented Dec 21, 2023

Great, thanks everyone. incus-0.4 is now available for Fedora via COPR.

@ganto ganto closed this as completed Dec 21, 2023
@stgraber
Copy link

Great to hear! Also just a quick reminder to send us a PR for doc/installing.md on the Incus repo so we can have instructions for Fedora users too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants