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

make build fails on local ubuntu setup #49

Closed
rajatjindal opened this issue Mar 20, 2024 · 5 comments · Fixed by #122
Closed

make build fails on local ubuntu setup #49

rajatjindal opened this issue Mar 20, 2024 · 5 comments · Fixed by #122

Comments

@rajatjindal
Copy link
Contributor

rajatjindal commented Mar 20, 2024

on a fresh checkout of containerd-wasm-shim repo, if I run make build, I always get an error:

 > [stage-0 4/7] RUN apk- add libseccomp-static libseccomp-dev:
0.550 /bin/sh: 1: apk-: not found
Click to see complete logs
VERBOSE=1 make build SHIMS=spin
cross build --release --target x86_64-unknown-linux-musl --manifest-path=containerd-shim-spin/Cargo.toml -vvv
+ cargo metadata --format-version 1 --manifest-path /root/go/src/github.com/spinkube/containerd-shim-spin/containerd-shim-spin/Cargo.toml --filter-platform x86_64-unknown-linux-musl
+ rustc --print sysroot
+ rustup toolchain list
+ rustup target list --toolchain 1.75.0-x86_64-unknown-linux-gnu
+ rustup component list --toolchain 1.75.0-x86_64-unknown-linux-gnu
+ /usr/bin/docker
+ "/root/go/src/github.com/spinkube/containerd-shim-spin" /usr/bin/docker build --label 'org.cross-rs.for-cross-target=x86_64-unknown-linux-musl' --label 'org.cross-rs.workspace_root=/root/go/src/github.com/spinkube/containerd-shim-spin' --tag cross-custom-containerd-shim-spin:x86_64-unknown-linux-musl-73bf3 --build-arg 'CROSS_DEB_ARCH=musl-linux-amd64' --build-arg 'CROSS_BASE_IMAGE=ghcr.io/cross-rs/x86_64-unknown-linux-musl:0.2.5' --file ./cross/Dockerfile /root/go/src/github.com/spinkube/containerd-shim-spin
[+] Building 2.2s (11/14)                                                                                                                                                                              docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                             0.0s
 => => transferring dockerfile: 837B                                                                                                                                                                             0.0s
 => [internal] load metadata for ghcr.io/cross-rs/x86_64-unknown-linux-musl:0.2.5                                                                                                                                0.0s
 => [internal] load metadata for docker.io/jorgeprendes420/apk-anywhere:latest                                                                                                                                   1.4s
 => [internal] load metadata for docker.io/jorgeprendes420/gcc_vld1q_s8_x4_polyfill:latest                                                                                                                       1.5s
 => [internal] load .dockerignore                                                                                                                                                                                0.0s
 => => transferring context: 103B                                                                                                                                                                                0.0s
 => FROM docker.io/jorgeprendes420/apk-anywhere:latest@sha256:16cde7dea78de16da44bb3c26c72dd5a8a6d459e720794ec0bb6b3814a450300                                                                                   0.0s
 => [stage-0 1/7] FROM ghcr.io/cross-rs/x86_64-unknown-linux-musl:0.2.5                                                                                                                                          0.0s
 => CACHED FROM docker.io/jorgeprendes420/gcc_vld1q_s8_x4_polyfill:latest@sha256:5d68f5ec19b2ee90b81399bf4a6ffdf300bbc6c67d3eed28018af2bb4bc36a25                                                                0.0s
 => CACHED [stage-0 2/7] COPY --from=jorgeprendes420/apk-anywhere / /                                                                                                                                            0.0s
 => CACHED [stage-0 3/7] RUN apk-init  ${CROSS_SYSROOT}                                                                                                                                                          0.0s
 => ERROR [stage-0 4/7] RUN apk- add libseccomp-static libseccomp-dev                                                                                                                                            0.6s
------
 > [stage-0 4/7] RUN apk- add libseccomp-static libseccomp-dev:
0.550 /bin/sh: 1: apk-: not found
------
Dockerfile:10
--------------------
   8 |
   9 |     # configure libsecccomp-rs to use static linking
  10 | >>> RUN apk-${MARCH} add libseccomp-static libseccomp-dev
  11 |     ENV LIBSECCOMP_LINK_TYPE="static"
  12 |     ENV LIBSECCOMP_LIB_PATH="${CROSS_SYSROOT}/lib"
--------------------
ERROR: failed to solve: process "/bin/sh -c apk-${MARCH} add libseccomp-static libseccomp-dev" did not complete successfully: exit code: 127
Error:
   0: could not run container
   1: when building custom image
   2: when building dockerfile
   3: `/usr/bin/docker build --label 'org.cross-rs.for-cross-target=x86_64-unknown-linux-musl' --label 'org.cross-rs.workspace_root=/root/go/src/github.com/spinkube/containerd-shim-spin' --tag cross-custom-containerd-shim-spin:x86_64-unknown-linux-musl-73bf3 --build-arg 'CROSS_DEB_ARCH=musl-linux-amd64' --build-arg 'CROSS_BASE_IMAGE=ghcr.io/cross-rs/x86_64-unknown-linux-musl:0.2.5' --file ./cross/Dockerfile /root/go/src/github.com/spinkube/containerd-shim-spin` failed with exit status: 1
make: *** [Makefile:81: build-spin-cross-x86_64-unknown-linux-musl] Error 1

to fix, I usually have to update cross/Dockerfile to hardcode MARCH=x86 and then also update ENV LIBSECCOMP_LIB_PATH="${CROSS_SYSROOT}/lib" manually.

I looked at GitHub actions, and we don't have to do any of this there.

It will be nice to be able to run make build without having to make any local changes to Dockerfile. do we know what might be causing this behavior?

@rajatjindal
Copy link
Contributor Author

ah, this might be related to the cross version. trying the same version as used in Makefile now.

@rajatjindal
Copy link
Contributor Author

this is indeed the cross version. Now trying to think how can we make sure new contributors don't run into this.

a few options could be:

  • automatically install the version we support (can we install it at a repo local location?)
  • warn the user that the version may not work and suggest to install the supported version?

wdyt?

@Mossaka
Copy link
Member

Mossaka commented Mar 28, 2024

Related: deislabs/containerd-wasm-shims#200

I believe I had already pinned the cross version in the Makefile of both repos. That is make install-cross should install the cross version that should work

@rajatjindal
Copy link
Contributor Author

thanks for linking me to that issue. If a user has unsupported version of cross, should we print a warning and ask them to run make install-cross

The reason I ask is user may not even realize that they have unsupported version of cross, and may have to spend time debugging why it didn't worked.

@Mossaka
Copy link
Member

Mossaka commented Apr 3, 2024

yeah that makes sense to me. Would you like to open a PR for adding that warning?

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

Successfully merging a pull request may close this issue.

2 participants