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

Unable to build quickstart hello image #2202

Open
isc-rsaptars opened this issue Mar 4, 2024 · 21 comments
Open

Unable to build quickstart hello image #2202

isc-rsaptars opened this issue Mar 4, 2024 · 21 comments

Comments

@isc-rsaptars
Copy link

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/rust@0.35.0
2024/03/04 11:36:55.627472 DEBUG:  -> paketo-buildpacks/procfile@5.6.4
2024/03/04 11:36:55.627474 DEBUG:  -> paketo-buildpacks/syft@1.32.1
2024/03/04 11:36:55.627475 DEBUG:  -> paketo-community/cargo@0.10.1
2024/03/04 11:36:55.627476 DEBUG:  -> paketo-community/rust-dist@1.19.0
2024/03/04 11:36:55.627477 DEBUG:  -> paketo-community/rustup@1.9.1
2024/03/04 11:36:55.627478 DEBUG:  -> dev.knative-extensions.go@0.0.6
2024/03/04 11:36:55.627484 DEBUG:  -> paketo-buildpacks/go@4.7.0
2024/03/04 11:36:55.627485 DEBUG:  -> paketo-buildpacks/ca-certificates@3.6.7
2024/03/04 11:36:55.627486 DEBUG:  -> paketo-buildpacks/environment-variables@4.5.6
2024/03/04 11:36:55.627487 DEBUG:  -> paketo-buildpacks/git@1.0.8
2024/03/04 11:36:55.627488 DEBUG:  -> paketo-buildpacks/go-build@2.2.0
2024/03/04 11:36:55.627489 DEBUG:  -> paketo-buildpacks/go-dist@2.4.5
2024/03/04 11:36:55.627491 DEBUG:  -> paketo-buildpacks/go-mod-vendor@1.0.28
2024/03/04 11:36:55.627492 DEBUG:  -> paketo-buildpacks/image-labels@4.5.5
2024/03/04 11:36:55.627493 DEBUG:  -> paketo-buildpacks/procfile@5.6.8
2024/03/04 11:36:55.627494 DEBUG:  -> paketo-buildpacks/watchexec@2.8.7
2024/03/04 11:36:55.627495 DEBUG:  -> paketo-buildpacks/java-native-image@9.0.0
2024/03/04 11:36:55.627496 DEBUG:  -> paketo-buildpacks/bellsoft-liberica@10.5.3
2024/03/04 11:36:55.627497 DEBUG:  -> paketo-buildpacks/ca-certificates@3.6.8
2024/03/04 11:36:55.627498 DEBUG:  -> paketo-buildpacks/datadog@5.4.0
2024/03/04 11:36:55.627499 DEBUG:  -> paketo-buildpacks/environment-variables@4.5.7
2024/03/04 11:36:55.627500 DEBUG:  -> paketo-buildpacks/executable-jar@6.8.4
2024/03/04 11:36:55.627501 DEBUG:  -> paketo-buildpacks/gradle@7.8.1
2024/03/04 11:36:55.627502 DEBUG:  -> paketo-buildpacks/image-labels@4.5.6
2024/03/04 11:36:55.627503 DEBUG:  -> paketo-buildpacks/leiningen@4.7.0
2024/03/04 11:36:55.627504 DEBUG:  -> paketo-buildpacks/maven@6.15.13
2024/03/04 11:36:55.627505 DEBUG:  -> paketo-buildpacks/native-image@5.12.8
2024/03/04 11:36:55.627506 DEBUG:  -> paketo-buildpacks/procfile@5.6.9
2024/03/04 11:36:55.627507 DEBUG:  -> paketo-buildpacks/quarkus@0.2.5
2024/03/04 11:36:55.627508 DEBUG:  -> paketo-buildpacks/sbt@6.12.12
2024/03/04 11:36:55.627509 DEBUG:  -> paketo-buildpacks/spring-boot@5.27.10
2024/03/04 11:36:55.627510 DEBUG:  -> paketo-buildpacks/syft@1.45.0
2024/03/04 11:36:55.627511 DEBUG:  -> paketo-buildpacks/upx@3.4.8
2024/03/04 11:36:55.627512 DEBUG:  -> paketo-buildpacks/java@12.0.0
2024/03/04 11:36:55.627513 DEBUG:  -> paketo-buildpacks/apache-tomcat@7.15.0
2024/03/04 11:36:55.627514 DEBUG:  -> paketo-buildpacks/apache-tomee@1.8.1
2024/03/04 11:36:55.627515 DEBUG:  -> paketo-buildpacks/azure-application-insights@5.17.4
2024/03/04 11:36:55.627517 DEBUG:  -> paketo-buildpacks/bellsoft-liberica@10.5.3
2024/03/04 11:36:55.627518 DEBUG:  -> paketo-buildpacks/ca-certificates@3.6.8
2024/03/04 11:36:55.627519 DEBUG:  -> paketo-buildpacks/clojure-tools@2.8.15
2024/03/04 11:36:55.627520 DEBUG:  -> paketo-buildpacks/datadog@5.4.0
2024/03/04 11:36:55.627521 DEBUG:  -> paketo-buildpacks/dist-zip@5.6.9
2024/03/04 11:36:55.627522 DEBUG:  -> paketo-buildpacks/encrypt-at-rest@4.5.15
2024/03/04 11:36:55.627523 DEBUG:  -> paketo-buildpacks/environment-variables@4.5.7
2024/03/04 11:36:55.627524 DEBUG:  -> paketo-buildpacks/executable-jar@6.8.4
2024/03/04 11:36:55.627526 DEBUG:  -> paketo-buildpacks/google-stackdriver@9.0.0
2024/03/04 11:36:55.627527 DEBUG:  -> paketo-buildpacks/gradle@7.8.1
2024/03/04 11:36:55.627528 DEBUG:  -> paketo-buildpacks/image-labels@4.5.6
2024/03/04 11:36:55.627529 DEBUG:  -> paketo-buildpacks/jattach@1.6.0
2024/03/04 11:36:55.627530 DEBUG:  -> paketo-buildpacks/java-memory-assistant@1.4.10
2024/03/04 11:36:55.627531 DEBUG:  -> paketo-buildpacks/leiningen@4.7.0
2024/03/04 11:36:55.627532 DEBUG:  -> paketo-buildpacks/liberty@4.0.1
2024/03/04 11:36:55.627533 DEBUG:  -> paketo-buildpacks/maven@6.15.13
2024/03/04 11:36:55.627534 DEBUG:  -> paketo-buildpacks/node-engine@3.2.2
2024/03/04 11:36:55.627535 DEBUG:  -> paketo-buildpacks/procfile@5.6.9
2024/03/04 11:36:55.627536 DEBUG:  -> paketo-buildpacks/quarkus@0.2.5
2024/03/04 11:36:55.627537 DEBUG:  -> paketo-buildpacks/sbt@6.12.12
2024/03/04 11:36:55.627538 DEBUG:  -> paketo-buildpacks/spring-boot@5.27.10
2024/03/04 11:36:55.627539 DEBUG:  -> paketo-buildpacks/syft@1.45.0
2024/03/04 11:36:55.627540 DEBUG:  -> paketo-buildpacks/watchexec@2.9.0
2024/03/04 11:36:55.627541 DEBUG:  -> paketo-buildpacks/yarn@1.3.2
2024/03/04 11:36:55.627542 DEBUG:  -> paketo-buildpacks/procfile@5.6.9
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: dev.knative-extensions.go@0.0.6 ========
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:  dev.knative-extensions.go@0.0.6
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.

@matejvasek
Copy link
Contributor

Have you changed module name in go.mod? @isc-rsaptars

@matejvasek
Copy link
Contributor

The module must be named function, @isc-rsaptars .

@isc-rsaptars
Copy link
Author

Here is my go.mod file:

module function

go 1.21

I believe this is similar to #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:  dev.knative-extensions.go@0.0.6

@isc-rsaptars
Copy link
Author

isc-rsaptars commented Mar 4, 2024

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

@matejvasek
Copy link
Contributor

Ah I see.

@matejvasek
Copy link
Contributor

matejvasek commented Mar 4, 2024

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.

@matejvasek
Copy link
Contributor

@isc-rsaptars I think paketo buildpacks might not support arm64 yet.

@isc-rsaptars
Copy link
Author

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?

@isc-rsaptars
Copy link
Author

Optionally, are there any instructions on how to build images using the -b s2i option?

@matejvasek
Copy link
Contributor

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.

@matejvasek
Copy link
Contributor

matejvasek commented Mar 4, 2024

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.

@matejvasek
Copy link
Contributor

If you find some other buildpack builder that works for arm64 you can use it by --builder-image={YOUR IMAGE HERE}.

@isc-rsaptars
Copy link
Author

Thanks! I will keep you updated on how that goes

@isc-rsaptars
Copy link
Author

@matejvasek looks like paketo-buildpack does support arm64 now: paketo-buildpacks/jammy-tiny-stack#108

@isc-rsaptars
Copy link
Author

How is the ghcr.io/knative/builder-jammy-tiny image built?

@matejvasek
Copy link
Contributor

@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.

@matejvasek
Copy link
Contributor

paketobuildpacks/builder-jammy-tiny:latest image is not multi-arch.

@Vishal1297
Copy link

Vishal1297 commented Mar 9, 2024

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

@Vishal1297
Copy link

Vishal1297 commented Mar 10, 2024

Here is my go.mod file:

module function

go 1.21

I believe this is similar to #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:  dev.knative-extensions.go@0.0.6

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

@matejvasek
Copy link
Contributor

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.

@matejvasek
Copy link
Contributor

@lkingland could you please look at this? I do not own arm machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants