Unable to build quickstart `hello` image
System Version: macOS 14.2.1 (23C71) Kernel Version: Darwin 23.2.0 Model Name: MacBook Pro Model Identifier: Mac14,6 Model Number: Z17900052LL/A Chip: Apple M2 Max (ARM) Total Number of Cores: 12 (8 performance and 4 efficiency) Memory: 64 GB
I am trying to follow the steps in this quickstart guide: https://knative.dev/docs/getting-started/build-run-deploy-func
I have reached the build function image step, https://knative.dev/docs/getting-started/build-run-deploy-func, and I get the following error when I run kn func run --registry <registry-url>:
<registry-url> has been redacted on purpose.
Building function image
Still building
Still building
Yes, still building
Don't give up on me
Still building
This is taking a while
Still building
2024/03/04 11:35:48.988515 DEBUG: Pulling image ghcr.io/knative/builder-jammy-tiny:latest
latest: Pulling from knative/builder-jammy-tiny
<<--SKIPPING LOADS OF IMAGE PULL LOGS-->>
2a70484b2fdc: Pull complete
dac873ce9469: Pull complete
1af7985ccff1: Pull complete
fe469f015234: Pull complete
d8788782fbb2: Pull complete
4a4392e8c3e6: Pull complete
ffa6d15a818a: Pull complete
890688e46f12: Pull complete
676abb6d7409: Pull complete
3aeddc19d8d1: Pull complete
e3b33aa2f0de: Pull complete
88ea603dc7ef: Pull complete
d65ea15c8f9a: Pull complete
c7a3eedcf6c6: Pull complete
3a9216d614a1: Pull complete
a43165b9cd50: Pull complete
a8445b2885cd: Pull complete
ef749bc628d4: Pull complete
a8889d4e6fde: Pull complete
0c9599de6b13: Pull complete
97831b21ba0d: Pull complete
4617cfc1d8f5: Pull complete
0d9aefc1bd83: Pull complete
11d61cb69e8a: Pull complete
c0f49e36f7eb: Pull complete
cf1e6a4ef69d: Pull complete
cc3af098e848: Pull complete
d7fc754e347d: Pull complete
f78d0eb83193: Pull complete
db58f93730eb: Pull complete
779573a7c701: Pull complete
485e18b1f484: Pull complete
e6c37a2281bd: Pull complete
29a7844508b3: Pull complete
d80244ccb3ff: Pull complete
e879b0c77169: Pull complete
63dbd1deb6ae: Pull complete
a8d8d0d8fc0b: Pull complete
41457d29d84e: Pull complete
ebc971911162: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:22f5ee58f03067c4853de335f00ecec7a2662f9c1b86293100e8712035d0a52e
Status: Downloaded newer image for ghcr.io/knative/builder-jammy-tiny:latest
2024/03/04 11:36:24.170485 DEBUG: Selected run image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
2024/03/04 11:36:24.170493 DEBUG: Pulling image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
latest: Pulling from paketobuildpacks/run-jammy-tiny
fd4c931ed2e9: Pulling fs layer
f9adea198747: Pulling fs layer
438b3fffff96: Pulling fs layer
f9adea198747: Verifying Checksum
f9adea198747: Download complete
438b3fffff96: Verifying Checksum
fd4c931ed2e9: Verifying Checksum
fd4c931ed2e9: Download complete
fd4c931ed2e9: Pull complete
f9adea198747: Pull complete
438b3fffff96: Pull complete
Digest: sha256:9e9d47afb33cd415f670149df263935b30bcfee338499fd3109078d42aa79cf9
Status: Downloaded newer image for paketobuildpacks/run-jammy-tiny:latest
2024/03/04 11:36:55.627464 DEBUG: Creating builder with the following buildpacks:
2024/03/04 11:36:55.627471 DEBUG: -> paketo-community/[email protected]
2024/03/04 11:36:55.627472 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627474 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627475 DEBUG: -> paketo-community/[email protected]
2024/03/04 11:36:55.627476 DEBUG: -> paketo-community/[email protected]
2024/03/04 11:36:55.627477 DEBUG: -> paketo-community/[email protected]
2024/03/04 11:36:55.627478 DEBUG: -> [email protected]
2024/03/04 11:36:55.627484 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627485 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627486 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627487 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627488 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627489 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627491 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627492 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627493 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627494 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627495 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627496 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627497 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627498 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627499 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627500 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627501 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627502 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627503 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627504 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627505 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627506 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627507 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627508 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627509 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627510 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627511 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627512 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627513 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627514 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627515 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627517 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627518 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627519 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627520 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627521 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627522 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627523 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627524 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627526 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627527 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627528 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627529 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627530 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627531 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627532 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627533 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627534 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627535 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627536 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627537 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627538 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627539 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627540 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627541 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.627542 DEBUG: -> paketo-buildpacks/[email protected]
2024/03/04 11:36:55.676298 DEBUG: Using build cache volume pack-cache-hello_latest-ecab179c2fa9.build
2024/03/04 11:36:55.676352 DEBUG: Running the creator on OS linux with:
2024/03/04 11:36:55.676353 DEBUG: Container Settings:
2024/03/04 11:36:55.676363 DEBUG: Args: /cnb/lifecycle/creator -daemon -launch-cache /launch-cache -app /workspace -cache-dir /cache -run-image index.docker.io/paketobuildpacks/run-jammy-tiny:latest -gid 0 <registry-url>/hello:latest
2024/03/04 11:36:55.676365 DEBUG: System Envs: CNB_PLATFORM_API=0.12
2024/03/04 11:36:55.676367 DEBUG: Image: pack.local/builder/777a6c6d6a777a646465:latest
2024/03/04 11:36:55.676368 DEBUG: User: root
2024/03/04 11:36:55.676376 DEBUG: Labels: map[author:pack]
2024/03/04 11:36:55.676377 DEBUG: Host Settings:
2024/03/04 11:36:55.676378 DEBUG: Binds: pack-cache-hello_latest-ecab179c2fa9.build:/cache /var/run/docker.sock:/var/run/docker.sock pack-cache-hello_latest-ecab179c2fa9.launch:/launch-cache pack-layers-dxbqdksoqh:/layers pack-app-tzwhytqvsr:/workspace
2024/03/04 11:36:55.676380 DEBUG: Network Mode:
===> ANALYZING
Image with name "<registry-url>/hello:latest" not found
===> DETECTING
======== Error: [email protected] ========
unable to satisfy target os/arch constraints; run image: {"os":"linux","arch":"arm64"}, buildpack: [{"os":"linux","arch":"amd64","distros":[{"name":"ubuntu","version":"18.04"}]}]
err: [email protected]
4 of 9 buildpacks participating
paketo-buildpacks/ca-certificates 3.6.7
paketo-buildpacks/go-dist 2.4.5
paketo-buildpacks/go-mod-vendor 1.0.28
paketo-buildpacks/go-build 2.2.0
===> RESTORING
===> BUILDING
Paketo Buildpack for CA Certificates 3.6.7
https://github.com/paketo-buildpacks/ca-certificates
Launch Helper: Contributing to layer
Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
Paketo Buildpack for Go Distribution 2.4.5
Resolving Go version
Candidate version sources (in priority order):
go.mod -> ">= 1.14"
<unknown> -> ""
Selected Go version (using go.mod): 1.21.7
Executing build process
Installing Go 1.21.7
Completed in 2.591s
Generating SBOM for /layers/paketo-buildpacks_go-dist/go
Completed in 1ms
Paketo Buildpack for Go Mod Vendor 1.0.28
Executing build process
Running 'go mod vendor'
go: no dependencies to vendor
Completed in 142ms
Generating SBOM for /workspace/go.mod
Completed in 17ms
Paketo Buildpack for Go Build 2.2.0
Executing build process
Running 'go build -o /layers/paketo-buildpacks_go-build/targets/bin -buildmode pie -trimpath .'
go: no main packages to build
Failed after 223ms
failed to execute 'go build': exit status 1
ERROR: failed to build: exit status 1
Error: failed to build the function: executing lifecycle: failed with status code: 51
Error: exit status 1
I am not able to proceed because of this. Any help you can provide would be much appreciated.
Have you changed module name in go.mod? @isc-rsaptars
The module must be named function, @isc-rsaptars .
Here is my go.mod file:
module function
go 1.21
I believe this is similar to https://github.com/knative/func/issues/2097 (which was resolved?) And the issue stems from this error:
unable to satisfy target os/arch constraints; run image: {"os":"linux","arch":"arm64"}, buildpack: [{"os":"linux","arch":"amd64","distros":[{"name":"ubuntu","version":"18.04"}]}]
err: [email protected]
If I understand the error correctly, the error is due to the linux/arm64 buildpack not being present
Is this something that can be resolved on my end or does KNative not support ARM64 builds for golang.
If it is the latter, what can I do help add support for ARM64 golang builds
Ah I see.
But I think currently is should work in emulation mode. Do you have qemu installed? Then it could possibly run as amd64, but it would be slow.
@isc-rsaptars I think paketo buildpacks might not support arm64 yet.
If I were to create a paketo-buildpack for arm64 following these instructions: https://github.com/dmikusa/paketo-arm64
Is there any configuration that I would have to do for it to play nice with knative func?
Optionally, are there any instructions on how to build images using the -b s2i option?
If I were to create a paketo-buildpack for arm64 following these instructions: https://github.com/dmikusa/paketo-arm64 Is there any configuration that I would have to do for it to play nice with
knative func?
You might try setting builder image and buildpacks in func.yaml.
Optionally, are there any instructions on how to build images using the -b s2i option?
The s2i build strategy is multi-arch however we do not support that for Go, it should however work with the other languages.
If you find some other buildpack builder that works for arm64 you can use it by --builder-image={YOUR IMAGE HERE}.
Thanks! I will keep you updated on how that goes
@matejvasek looks like paketo-buildpack does support arm64 now: https://github.com/paketo-buildpacks/jammy-tiny-stack/pull/108
How is the ghcr.io/knative/builder-jammy-tiny image built?
@matejvasek looks like paketo-buildpack does support arm64 now: paketo-buildpacks/jammy-tiny-stack#108
That's just a stack image not builder/buildpack images.
paketobuildpacks/builder-jammy-tiny:latest image is not multi-arch.
The module must be named
function, @isc-rsaptars .
Hi @matejvasek ,
Can you share me the doc which can help me clear my doubts on this? What's reasoning behind this?
Thanks
Here is my go.mod file:
module function go 1.21I believe this is similar to https://github.com/knative/func/issues/2097 (which was resolved?) And the issue stems from this error:
unable to satisfy target os/arch constraints; run image: {"os":"linux","arch":"arm64"}, buildpack: [{"os":"linux","arch":"amd64","distros":[{"name":"ubuntu","version":"18.04"}]}] err: [email protected]
I am facing same issue but in my case, there is no like this one?
~~unable to satisfy target os/arch constraints; run image:~~
Arch: amd64
Error: go: no main packages to build
The module must be named
function, @isc-rsaptars .Hi @matejvasek ,
Can you share me the doc which can help me clear my doubts on this? What's reasoning behind this?
Thanks
It's just way things were implemented. The package is expected to be just function anything else will not work.
@lkingland could you please look at this? I do not own arm machine.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.