From d2efdc30bcfd00e41f523b12c118b25691c04770 Mon Sep 17 00:00:00 2001 From: Jorge Prendes Date: Sun, 24 Sep 2023 21:59:50 +0100 Subject: [PATCH] refactor cross container and enable seccomp Signed-off-by: Jorge Prendes --- .github/workflows/build.yaml | 2 +- .github/workflows/ci.yaml | 2 +- containerd-shim-lunatic-v1/Cargo.toml | 2 +- containerd-shim-lunatic-v1/Cross.toml | 4 +- containerd-shim-lunatic-v1/Dockerfile | 4 - containerd-shim-slight-v1/Cargo.toml | 2 +- containerd-shim-slight-v1/Cross.toml | 4 +- containerd-shim-slight-v1/Dockerfile | 4 - containerd-shim-spin-v1/Cargo.lock | 140 ++++++++++++++++-- containerd-shim-spin-v1/Cargo.toml | 2 +- containerd-shim-spin-v1/Cross.toml | 6 +- containerd-shim-spin-v1/Dockerfile | 7 - containerd-shim-spin-v1/polyfill/README.md | 8 - containerd-shim-spin-v1/polyfill/polyfill.sh | 16 -- .../polyfill/polyfill_vld1q_s8_x4.h | 14 -- .../polyfill/polyfill_vld1q_u8_x4.h | 14 -- .../polyfill/test_vld1q_s8_x4.c | 2 - .../polyfill/test_vld1q_u8_x4.c | 2 - containerd-shim-wws-v1/Cargo.toml | 2 +- containerd-shim-wws-v1/Cross.toml | 8 + cross/Dockerfile | 21 +++ 21 files changed, 171 insertions(+), 95 deletions(-) delete mode 100644 containerd-shim-lunatic-v1/Dockerfile delete mode 100644 containerd-shim-slight-v1/Dockerfile delete mode 100644 containerd-shim-spin-v1/Dockerfile delete mode 100644 containerd-shim-spin-v1/polyfill/README.md delete mode 100755 containerd-shim-spin-v1/polyfill/polyfill.sh delete mode 100644 containerd-shim-spin-v1/polyfill/polyfill_vld1q_s8_x4.h delete mode 100644 containerd-shim-spin-v1/polyfill/polyfill_vld1q_u8_x4.h delete mode 100644 containerd-shim-spin-v1/polyfill/test_vld1q_s8_x4.c delete mode 100644 containerd-shim-spin-v1/polyfill/test_vld1q_u8_x4.c create mode 100644 containerd-shim-wws-v1/Cross.toml create mode 100644 cross/Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5f22cf6c..129086da 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -29,7 +29,7 @@ jobs: - name: "Install dependencies" run: | sudo apt-get update - sudo apt-get install protobuf-compiler -y + sudo apt-get install -y protobuf-compiler libseccomp-dev - name: build ${{ matrix.shims }} run: | VERBOSE=1 make build SHIMS=${{ matrix.shims }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a43505d1..d2fa89b7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: - name: "Install dependencies" run: | sudo apt-get update - sudo apt-get install protobuf-compiler -y + sudo apt-get install -y protobuf-compiler libseccomp-dev - name: fmt run: | make fmt diff --git a/containerd-shim-lunatic-v1/Cargo.toml b/containerd-shim-lunatic-v1/Cargo.toml index 5cface33..7b979a35 100644 --- a/containerd-shim-lunatic-v1/Cargo.toml +++ b/containerd-shim-lunatic-v1/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] containerd-shim = "0.5.0" -containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] } +containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv1", "cgroupsv2"] } log = "~0.4" anyhow = "1.0.72" chrono = { version = "0.4.26", features = ["std"] } diff --git a/containerd-shim-lunatic-v1/Cross.toml b/containerd-shim-lunatic-v1/Cross.toml index 6c980c2f..98bc95ce 100644 --- a/containerd-shim-lunatic-v1/Cross.toml +++ b/containerd-shim-lunatic-v1/Cross.toml @@ -2,7 +2,7 @@ default-target = "x86_64-unknown-linux-musl" [target.x86_64-unknown-linux-musl] -dockerfile = "./containerd-shim-lunatic-v1/Dockerfile" +dockerfile = "./cross/Dockerfile" [target.aarch64-unknown-linux-musl] -dockerfile = "./containerd-shim-lunatic-v1/Dockerfile" +dockerfile = "./cross/Dockerfile" diff --git a/containerd-shim-lunatic-v1/Dockerfile b/containerd-shim-lunatic-v1/Dockerfile deleted file mode 100644 index da747de9..00000000 --- a/containerd-shim-lunatic-v1/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -RUN apt-get update && apt-get install -y pkg-config libdbus-glib-1-dev libseccomp-dev \ No newline at end of file diff --git a/containerd-shim-slight-v1/Cargo.toml b/containerd-shim-slight-v1/Cargo.toml index a059d494..e36ea262 100644 --- a/containerd-shim-slight-v1/Cargo.toml +++ b/containerd-shim-slight-v1/Cargo.toml @@ -12,7 +12,7 @@ Containerd shim for running Slight workloads. [dependencies] containerd-shim = "0.5.0" -containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] } +containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv1", "cgroupsv2"] } log = "0.4" tokio = { version = "1", features = [ "full" ] } slight = { git = "https://github.com/deislabs/spiderlightning", version = "0.5.1" } diff --git a/containerd-shim-slight-v1/Cross.toml b/containerd-shim-slight-v1/Cross.toml index 900f2f8c..98bc95ce 100644 --- a/containerd-shim-slight-v1/Cross.toml +++ b/containerd-shim-slight-v1/Cross.toml @@ -2,7 +2,7 @@ default-target = "x86_64-unknown-linux-musl" [target.x86_64-unknown-linux-musl] -dockerfile = "./containerd-shim-slight-v1/Dockerfile" +dockerfile = "./cross/Dockerfile" [target.aarch64-unknown-linux-musl] -dockerfile = "./containerd-shim-slight-v1/Dockerfile" +dockerfile = "./cross/Dockerfile" diff --git a/containerd-shim-slight-v1/Dockerfile b/containerd-shim-slight-v1/Dockerfile deleted file mode 100644 index fdc01834..00000000 --- a/containerd-shim-slight-v1/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -RUN apt-get update && apt-get install --assume-yes protobuf-compiler \ No newline at end of file diff --git a/containerd-shim-spin-v1/Cargo.lock b/containerd-shim-spin-v1/Cargo.lock index a0498e80..ae04f5f2 100644 --- a/containerd-shim-spin-v1/Cargo.lock +++ b/containerd-shim-spin-v1/Cargo.lock @@ -110,6 +110,54 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.75" @@ -208,7 +256,7 @@ dependencies = [ "rustc_version", "serde", "serde_json", - "time", + "time 0.3.28", "url", "uuid", ] @@ -229,7 +277,7 @@ dependencies = [ "serde_json", "sha2 0.10.7", "thiserror", - "time", + "time 0.3.28", "url", "uuid", ] @@ -337,7 +385,7 @@ dependencies = [ "sled", "tempfile", "thiserror", - "time", + "time 0.3.28", "tokio", "tokio-stream", "tokio-tar", @@ -750,8 +798,11 @@ checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" dependencies = [ "android-tzdata", "iana-time-zone", + "js-sys", "num-traits", "serde", + "time 0.1.45", + "wasm-bindgen", "windows-targets 0.48.5", ] @@ -793,8 +844,8 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags 1.3.2", - "clap_derive", - "clap_lex", + "clap_derive 3.2.25", + "clap_lex 0.2.4", "indexmap 1.9.3", "once_cell", "strsim", @@ -802,6 +853,28 @@ dependencies = [ "textwrap", ] +[[package]] +name = "clap" +version = "4.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" +dependencies = [ + "clap_builder", + "clap_derive 4.4.2", +] + +[[package]] +name = "clap_builder" +version = "4.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.5.1", + "strsim", +] + [[package]] name = "clap_derive" version = "3.2.25" @@ -815,6 +888,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "clap_derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -824,6 +909,12 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + [[package]] name = "clone3" version = "0.2.3" @@ -843,6 +934,12 @@ dependencies = [ "cc", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "combine" version = "4.6.6" @@ -920,7 +1017,7 @@ dependencies = [ "serde_json", "signal-hook", "thiserror", - "time", + "time 0.3.28", "windows-sys 0.48.0", ] @@ -4635,7 +4732,7 @@ dependencies = [ "num-bigint", "num-traits", "thiserror", - "time", + "time 0.3.28", ] [[package]] @@ -4993,7 +5090,7 @@ source = "git+https://github.com/fermyon/spin?tag=v1.5.0#ca08dd933de32fe09f4c318 dependencies = [ "anyhow", "async-trait", - "clap", + "clap 3.2.25", "ctrlc", "dirs 4.0.0", "futures", @@ -5036,7 +5133,7 @@ source = "git+https://github.com/fermyon/spin?tag=v1.5.0#ca08dd933de32fe09f4c318 dependencies = [ "anyhow", "async-trait", - "clap", + "clap 3.2.25", "futures", "futures-util", "http", @@ -5291,6 +5388,17 @@ dependencies = [ "syn 2.0.29", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.3.28" @@ -5358,7 +5466,7 @@ checksum = "aea68938177975ab09da68552b720eac941779ff386baceaf77e0f5f9cea645f" dependencies = [ "aho-corasick 0.7.20", "cached-path", - "clap 4.4.1", + "clap 4.4.4", "derive_builder 0.12.0", "dirs 4.0.0", "esaxx-rs", @@ -5768,6 +5876,12 @@ dependencies = [ "serde", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "1.4.1" @@ -5840,6 +5954,12 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/containerd-shim-spin-v1/Cargo.toml b/containerd-shim-spin-v1/Cargo.toml index a3907ed9..65decd34 100644 --- a/containerd-shim-spin-v1/Cargo.toml +++ b/containerd-shim-spin-v1/Cargo.toml @@ -12,7 +12,7 @@ Containerd shim for running Spin workloads. [dependencies] containerd-shim = "0.5.0" -containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] } +containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv1", "cgroupsv2"] } log = "0.4" spin-app = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" } spin-core = { git = "https://github.com/fermyon/spin", tag = "v1.5.0" } diff --git a/containerd-shim-spin-v1/Cross.toml b/containerd-shim-spin-v1/Cross.toml index c1496abc..98bc95ce 100644 --- a/containerd-shim-spin-v1/Cross.toml +++ b/containerd-shim-spin-v1/Cross.toml @@ -2,9 +2,7 @@ default-target = "x86_64-unknown-linux-musl" [target.x86_64-unknown-linux-musl] -dockerfile.file = "./containerd-shim-spin-v1/Dockerfile" -dockerfile.context = "./containerd-shim-spin-v1/polyfill/" +dockerfile = "./cross/Dockerfile" [target.aarch64-unknown-linux-musl] -dockerfile.file = "./containerd-shim-spin-v1/Dockerfile" -dockerfile.context = "./containerd-shim-spin-v1/polyfill/" +dockerfile = "./cross/Dockerfile" diff --git a/containerd-shim-spin-v1/Dockerfile b/containerd-shim-spin-v1/Dockerfile deleted file mode 100644 index 18d6cc21..00000000 --- a/containerd-shim-spin-v1/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -RUN apt-get -y update -RUN apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev - -RUN --mount=type=bind,source=/,target=/polyfill /polyfill/polyfill.sh diff --git a/containerd-shim-spin-v1/polyfill/README.md b/containerd-shim-spin-v1/polyfill/README.md deleted file mode 100644 index fbc8ea9d..00000000 --- a/containerd-shim-spin-v1/polyfill/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Polyfill for missing SIMD intrinsics in `cross-rs` image for target `aarch64-unknown-linux-musl` - -A transitive dependency of spin (`llama.cpp` via `ggml`) uses the `vld1q_s8_x4` and `vld1q_u8_x4` compiler built-in SIMD intrinsics. -These intrinsics are missing for `aarch64` in `gcc < 10.3`, while `cross-rs` ships with `gcc 9` for `aarch64-unknown-linux-musl` as of writing. - -The code in this folder does a feature check and patches the `arm_neon.h` header with polyfills if the functions are missing. - -See https://github.com/fermyon/spin/issues/1786 for the upstream issue. diff --git a/containerd-shim-spin-v1/polyfill/polyfill.sh b/containerd-shim-spin-v1/polyfill/polyfill.sh deleted file mode 100755 index 6214e716..00000000 --- a/containerd-shim-spin-v1/polyfill/polyfill.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -ROOT="$(dirname "$0")" -echo "ROOT=$ROOT" -ARM_NEON_PATH="$(aarch64-linux-musl-gcc -E "$ROOT/test_vld1q_s8_x4.c" | grep -m1 "arm_neon.h" | sed -En 's|.*"(/usr/local/[^"]*/arm_neon.h)".*|\1|p')" -echo "ARM_NEON_PATH=$ARM_NEON_PATH" -if command -v aarch64-linux-musl-gcc > /dev/null; then - if ! aarch64-linux-musl-gcc -Werror=implicit-function-declaration -c -o /dev/null "$ROOT/test_vld1q_u8_x4.c"; then - echo "Polyfilling vld1q_u8_x4" - cat "$ROOT/polyfill_vld1q_u8_x4.h" >> $ARM_NEON_PATH - fi - if ! aarch64-linux-musl-gcc -Werror=implicit-function-declaration -c -o /dev/null "$ROOT/test_vld1q_s8_x4.c"; then - echo "Polyfilling vld1q_s8_x4" - cat "$ROOT/polyfill_vld1q_s8_x4.h" >> $ARM_NEON_PATH - fi -fi \ No newline at end of file diff --git a/containerd-shim-spin-v1/polyfill/polyfill_vld1q_s8_x4.h b/containerd-shim-spin-v1/polyfill/polyfill_vld1q_s8_x4.h deleted file mode 100644 index 8d77a165..00000000 --- a/containerd-shim-spin-v1/polyfill/polyfill_vld1q_s8_x4.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __POLYFILL_VLD1Q_S8_X4__ -#define __POLYFILL_VLD1Q_S8_X4__ - -inline int8x16x4_t vld1q_s8_x4(const int8_t *p) -{ - int8x16x4_t ret; - ret.val[0] = vld1q_s8(p + 0); - ret.val[1] = vld1q_s8(p + 16); - ret.val[2] = vld1q_s8(p + 32); - ret.val[3] = vld1q_s8(p + 48); - return ret; -} - -#endif // __POLYFILL_VLD1Q_S8_X4__ diff --git a/containerd-shim-spin-v1/polyfill/polyfill_vld1q_u8_x4.h b/containerd-shim-spin-v1/polyfill/polyfill_vld1q_u8_x4.h deleted file mode 100644 index 4b4a51e5..00000000 --- a/containerd-shim-spin-v1/polyfill/polyfill_vld1q_u8_x4.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __POLYFILL_VLD1Q_U8_X4__ -#define __POLYFILL_VLD1Q_U8_X4__ - -inline uint8x16x4_t vld1q_u8_x4(const uint8_t *p) -{ - uint8x16x4_t ret; - ret.val[0] = vld1q_u8(p + 0); - ret.val[1] = vld1q_u8(p + 16); - ret.val[2] = vld1q_u8(p + 32); - ret.val[3] = vld1q_u8(p + 48); - return ret; -} - -#endif // __POLYFILL_VLD1Q_U8_X4__ diff --git a/containerd-shim-spin-v1/polyfill/test_vld1q_s8_x4.c b/containerd-shim-spin-v1/polyfill/test_vld1q_s8_x4.c deleted file mode 100644 index ad9a4c98..00000000 --- a/containerd-shim-spin-v1/polyfill/test_vld1q_s8_x4.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void test() { vld1q_s8_x4(0); } \ No newline at end of file diff --git a/containerd-shim-spin-v1/polyfill/test_vld1q_u8_x4.c b/containerd-shim-spin-v1/polyfill/test_vld1q_u8_x4.c deleted file mode 100644 index ea853f84..00000000 --- a/containerd-shim-spin-v1/polyfill/test_vld1q_u8_x4.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -void test() { vld1q_u8_x4(0); } \ No newline at end of file diff --git a/containerd-shim-wws-v1/Cargo.toml b/containerd-shim-wws-v1/Cargo.toml index 885d12a1..4ddce081 100644 --- a/containerd-shim-wws-v1/Cargo.toml +++ b/containerd-shim-wws-v1/Cargo.toml @@ -15,7 +15,7 @@ Containerd shim for running Wasm Workers Server workloads. [dependencies] anyhow = "1.0" containerd-shim = "0.5.0" -containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv2"] } +containerd-shim-wasm = { git = "https://github.com/containerd/runwasi", rev = "4d212b968d24d42a27952e8b04979382b543a613", features = ["cgroupsv1", "cgroupsv2"] } wasm-workers-server = { git = "https://github.com/vmware-labs/wasm-workers-server", tag = "v1.6.1" } log = "0.4" tokio = { version = "1", features = [ "full" ] } diff --git a/containerd-shim-wws-v1/Cross.toml b/containerd-shim-wws-v1/Cross.toml new file mode 100644 index 00000000..98bc95ce --- /dev/null +++ b/containerd-shim-wws-v1/Cross.toml @@ -0,0 +1,8 @@ +[build] +default-target = "x86_64-unknown-linux-musl" + +[target.x86_64-unknown-linux-musl] +dockerfile = "./cross/Dockerfile" + +[target.aarch64-unknown-linux-musl] +dockerfile = "./cross/Dockerfile" diff --git a/cross/Dockerfile b/cross/Dockerfile new file mode 100644 index 00000000..e4dcb9aa --- /dev/null +++ b/cross/Dockerfile @@ -0,0 +1,21 @@ +ARG CROSS_BASE_IMAGE +FROM $CROSS_BASE_IMAGE + +# Install Alpine's `apk` to be able to install musl packages +COPY --from=jorgeprendes420/apk-anywhere / / +ENV MARCH=${CROSS_CMAKE_SYSTEM_PROCESSOR} +RUN apk-init ${MARCH} ${CROSS_SYSROOT} + +# configure libsecccomp-rs to use static linking +RUN apk-${MARCH} add libseccomp-static libseccomp-dev +ENV LIBSECCOMP_LINK_TYPE="static" +ENV LIBSECCOMP_LIB_PATH="${CROSS_SYSROOT}/lib" + +# wws needs zlib (though libssh2-sys) +RUN apk-${MARCH} add zlib-dev zlib-static + +# See https://github.com/fermyon/spin/issues/1786 for the upstream issue requiring this polyfill. +RUN --mount=type=bind,from=jorgeprendes420/gcc_vld1q_s8_x4_polyfill,source=/polyfill.sh,target=/polyfill.sh /polyfill.sh + +RUN apt-get -y update && \ + apt-get install -y pkg-config protobuf-compiler