oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.33k stars 160 forks source link

oras build fails with go toolchain not available #1350

Closed Amulyam24 closed 2 months ago

Amulyam24 commented 2 months ago

What happened in your environment?

$ make build-linux-ppc64le
GOARCH=ppc64le CGO_ENABLED=0 GOOS=linux go build -v --ldflags="-w -X oras.land/oras/internal/version.GitCommit=fa65f61c86fa75b23b8f2afffe1ba77a5fbf44b7 -X oras.land/oras/internal/version.GitTreeState=clean" \
        -o bin/linux/ppc64le/oras oras.land/oras/cmd/oras
go: downloading go1.22 (linux/ppc64le)
go: download go1.22 for linux/ppc64le: toolchain not available
make: *** [Makefile:81: build-linux-ppc64le] Error 1

What did you expect to happen?

Binary to be built successfully.

How can we reproduce it?

$ make build-linux-ppc64le
GOARCH=ppc64le CGO_ENABLED=0 GOOS=linux go build -v --ldflags="-w -X oras.land/oras/internal/version.GitCommit=fa65f61c86fa75b23b8f2afffe1ba77a5fbf44b7 -X oras.land/oras/internal/version.GitTreeState=clean" \
        -o bin/linux/ppc64le/oras oras.land/oras/cmd/oras
go: downloading go1.22 (linux/ppc64le)
go: download go1.22 for linux/ppc64le: toolchain not available
make: *** [Makefile:81: build-linux-ppc64le] Error 1

What is the version of your ORAS CLI?

Build failing

What is your OS environment?

Ubuntu 22.04.4 LTS

Are you willing to submit PRs to fix it?

qweeah commented 2 months ago

@Amulyam24 Thanks for reporting this issue. I am using Ubuntu 20.04 with go 1.22.1 and I cannot reproduce this issue. What is the version of the go binary you are using?

Amulyam24 commented 2 months ago

@Amulyam24 Thanks for reporting this issue. I am using Ubuntu 20.04 with go 1.22.1 and I cannot reproduce this issue. Hi @qweeah, with go 1.22 it works.

What is the version of the go binary you are using? 1.21.3

qweeah commented 2 months ago

The error is expected, you need to upgrade go to 1.22.* and then compile oras. IMHO, no change need on ORAS side.

Amulyam24 commented 2 months ago

Updating the toolchain patch version works - https://github.com/oras-project/oras/pull/1351 and this won't need updating the go version as it is handled internally by downloading the desired version for the build Is it not the desired approach? Reference - https://github.com/golang/go/issues/66175

TerryHowe commented 2 months ago

Thanks, I was having this issue too.