cnabio / cnab-to-oci

Tool to convert CNAB bundle.json to OCI index
Apache License 2.0
54 stars 43 forks source link

Cannot build on Ubuntu 20.04 #107

Open rothgar opened 3 years ago

rothgar commented 3 years ago

The make target is looking for gcc-5 which is really old and not available on Ubuntu 20.04. I saw a PR #47 to update it but that has been open for almost a year. Are there any plans to update the build tooling so this tool can continue to be used?

radu-matei commented 3 years ago

Hi, @rothgar! Could you please share the errors you are seeing?

I am able to build on Ubuntu 20.04 with Go 1.15:

➜ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

➜ go version
go version go1.15.4 linux/amd64

➜ make all
CGO_ENABLED=0 go build -ldflags="-s -w -X github.com/cnabio/cnab-to-oci/internal.GitCommit=c859986 -X github.com/cnabio/cnab-to-oci/internal.Version=v0.3.1-beta1-2-gc859986-dirty -X github.com/cnabio/cnab-to-oci/internal.BuildTime=2021-04-09T00:36:04Z" -o bin/cnab-to-oci ./cmd/cnab-to-oci
go test -ldflags="-s -w -X github.com/cnabio/cnab-to-oci/internal.GitCommit=c859986 -X github.com/cnabio/cnab-to-oci/internal.Version=v0.3.1-beta1-2-gc859986-dirty -X github.com/cnabio/cnab-to-oci/internal.BuildTime=2021-04-09T00:36:04Z" -failfast -race github.com/cnabio/cnab-to-oci github.com/cnabio/cnab-to-oci/cmd/cnab-to-oci github.com/cnabio/cnab-to-oci/converter github.com/cnabio/cnab-to-oci/internal github.com/cnabio/cnab-to-oci/relocation github.com/cnabio/cnab-to-oci/remotes github.com/cnabio/cnab-to-oci/tests
?       github.com/cnabio/cnab-to-oci   [no test files]
?       github.com/cnabio/cnab-to-oci/cmd/cnab-to-oci   [no test files]
ok      github.com/cnabio/cnab-to-oci/converter 0.040s
?       github.com/cnabio/cnab-to-oci/internal  [no test files]
?       github.com/cnabio/cnab-to-oci/relocation        [no test files]
ok      github.com/cnabio/cnab-to-oci/remotes   1.655s
?       github.com/cnabio/cnab-to-oci/tests     [no test files]
docker build --build-arg BUILDTIME --build-arg COMMIT --build-arg TAG --build-arg=GOPROXY . -t cnab-to-oci-e2e
[+] Building 15.7s (17/17) FINISHED
docker run --rm --network=host -v /var/run/docker.sock:/var/run/docker.sock cnab-to-oci-e2e
# docker build -f testdata/hello-world/invocation-image/Dockerfile -t 127.0.0.1:49154/e2e/hello-world:0.1.0-

# docker pull hashicorp/http-echo
Using default tag: latest
latest: Pulling from hashicorp/http-echo

# docker tag hashicorp/http-echo 127.0.0.1:49154/e2e/http-echo

# docker push 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc
0.1.0-invoc: digest: sha256:f6f035ab673d39eca36ac7b2ec3dbcd95d0301105a8b6a52b070dc0b9c53b101 size: 941

# docker push 127.0.0.1:49154/e2e/http-echo

# cnab-to-oci fixup /tmp/TestPushAndPullCNAB-969430066/bundle.json --target 127.0.0.1:49154/myuser --insecure-registries 127.0.0.1:49154 --bundle /tmp/TestPushAndPullCNAB-969430066/fixed-bundle.json --relocation-map /tmp/TestPushAndPullCNAB-969430066/relocation.json --auto-update-bundle
Starting to copy image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc...
Completed image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc copy
Starting to copy image 127.0.0.1:49154/e2e/http-echo...
Completed image 127.0.0.1:49154/e2e/http-echo copy

# cnab-to-oci fixup /tmp/TestPushAndPullCNAB-969430066/bundle.json --target 127.0.0.1:49154/myuser --insecure-registries 127.0.0.1:49154 --bundle /tmp/TestPushAndPullCNAB-969430066/fixed-bundle.json --auto-update-bundle
Starting to copy image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc...
Completed image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc copy
Starting to copy image 127.0.0.1:49154/e2e/http-echo...
Completed image 127.0.0.1:49154/e2e/http-echo copy

# cnab-to-oci push /tmp/TestPushAndPullCNAB-969430066/bundle.json --target 127.0.0.1:49154/myuser --insecure-registries 127.0.0.1:49154 --auto-update-bundle
Pushed successfully, with digest "sha256:5f03621609212e0d0640e529da01a957d4fa94d26e68611eec811a556377f4a8"
Starting to copy image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc...
Completed image 127.0.0.1:49154/e2e/hello-world:0.1.0-invoc copy
Starting to copy image 127.0.0.1:49154/e2e/http-echo...
Completed image 127.0.0.1:49154/e2e/http-echo copy

# cnab-to-oci pull 127.0.0.1:49154/myuser@sha256:5f03621609212e0d0640e529da01a957d4fa94d26e68611eec811a556377f4a8 --bundle /tmp/TestPushAndPullCNAB-969430066/pulled-bundle.json --relocation-map /tmp/TestPushAndPullCNAB-969430066/pulled-relocation.json --insecure-registries 127.0.0.1:49154

PASS

➜ ./bin/cnab-to-oci version
Version:      v0.3.1-beta1-2-gc859986-dirty
Git commit:   c859986
Built:        Fri Apr  9 00:36:04 2021
OS/Arch:      linux/amd64
rothgar commented 3 years ago

Sure, here's my output.

lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

# go version
go version go1.16.3 linux/amd64

# make all
CGO_ENABLED=0 go build -ldflags="-s -w -X github.com/cnabio/cnab-to-oci/internal.GitCommit=c859986 -X github.com/cnabio/cnab-to-oci/internal.Version=v0.3.1-beta1-2-gc859986 -X github.com/cnabio/cnab-to-oci/internal.BuildTime=2021-04-09T05:37:52Z" -o bin/cnab-to-oci ./cmd/cnab-to-oci
go test -ldflags="-s -w -X github.com/cnabio/cnab-to-oci/internal.GitCommit=c859986 -X github.com/cnabio/cnab-to-oci/internal.Version=v0.3.1-beta1-2-gc859986 -X github.com/cnabio/cnab-to-oci/internal.BuildTime=2021-04-09T05:37:52Z" -failfast -race github.com/cnabio/cnab-to-oci github.com/cnabio/cnab-to-oci/cmd/cnab-to-oci github.com/cnabio/cnab-to-oci/converter github.com/cnabio/cnab-to-oci/internal github.com/cnabio/cnab-to-oci/relocation github.com/cnabio/cnab-to-oci/remotes github.com/cnabio/cnab-to-oci/tests
# runtime/cgo
cgo: exec gcc-5: exec: "gcc-5": executable file not found in $PATH
?       github.com/cnabio/cnab-to-oci   [no test files]
FAIL    github.com/cnabio/cnab-to-oci/converter [build failed]
FAIL    github.com/cnabio/cnab-to-oci/remotes [build failed]
make: *** [Makefile:68: test-unit] Error 2