QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.86k stars 1.31k forks source link

Qwik devcontainer fails on postinstall for Apple M1 chip machines #1158

Closed nnelgxorz closed 5 months ago

nnelgxorz commented 2 years ago

Qwik Version

0.0.105

Operating System (or Browser)

Debian Linux

Node Version (if applicable)

No response

Which component is affected?

Qwik Optimizer (rust)

Expected Behaviour

A contributor should be able to open the project in our devcontainer on an Apple M1 chip machine.

Actual Behaviour

The postInstall script fails because the wasm-pack npm package does not load the binaries for Linux arm64.

Additional Information

I opened a PR on the wasm-pack repo to fix this.

https://github.com/rustwasm/wasm-pack/pull/1170 :+1:

Thanks @youngboy for helping me debug this.

nnelgxorz commented 2 years ago

The fix was merged. Hoping this can be closed once they cut a new release.

AlaDouagi commented 1 year ago

@nnelgxorz still facing the same issue on latest version of main (as for now), I'm using a MacOS 13.3.1 on M1 Max processor, any help please?

AlaDouagi commented 1 year ago

I solved the issue by making the .devcontainer/Dockerfile use the latest versions of packages like so:

FROM cimg/rust:1.70.0-node

RUN rustup toolchain install nightly; \
    rustup default nightly; \
    rustup --version; \
    cargo --version; \
    rustc --version; \
    rustup update; \
    rustup target add wasm32-unknown-unknown; \
    cargo install cargo-insta wasm-pack; \
    rustup component add clippy; \
    corepack enable --install-directory ~/bin

But I faced another error in the last step of Docker file execution on pnpm install:

[489081 ms] [20:50:52] Extension installed successfully: csstools.postcss
Progress: resolved 1027, reused 1027, downloaded 0, added 0, doneccessfully installed.
 ENOENT  ENOENT: no such file or directory, open '/workspaces/qwik/node_modules/.pnpm/github.com+BuilderIo+qwik-build@14c0eec25adc4578067dda9be4c3084e7a5c1adf_undici@5.22.1_dgyirt72l7znqovoz5pu7ibm3a/node_modules/@builder.io/qwik/package.json'

pnpm: ENOENT: no such file or directory, open '/workspaces/qwik/node_modules/.pnpm/github.com+BuilderIo+qwik-build@14c0eec25adc4578067dda9be4c3084e7a5c1adf_undici@5.22.1_dgyirt72l7znqovoz5pu7ibm3a/node_modules/@builder.io/qwik/package.json'
[514134 ms] updateContentCommand failed with exit code 1. Skipping any further user-provided commands.
[514135 ms] Error: Command failed: /bin/sh -c corepack prepare & pnpm install
gioboa commented 11 months ago

@AlaDouagi did you solve this issue?

kanielrkirby commented 9 months ago

@gioboa I've been poking around older issues, and tried the steps mentioned above (M1 Mac, Sonoma 14.0) with no problems. All that really needs to be done is using the up-to-date (not necessarily nightly/beta, just stable is fine) Rust toolchain, at least in my case. e.g.,

RUN rustup toolchain install stable; \
    rustup default stable
# ... rest of the setup ...

I'm not sure if there's something further down that should be looked into, or if changing the Dockerfile is fine.

wmertens commented 9 months ago

Wait so everything builds with rust stable?

kanielrkirby commented 9 months ago

Appears to be that way @wmertens...

My log:

git clone git@github.com:builderio/qwik
Cloning into 'qwik'...
remote: Enumerating objects: 71530, done.
remote: Counting objects: 100% (71529/71529), done.
remote: Compressing objects: 100% (18883/18883), done.
remote: Total 71530 (delta 48539), reused 70363 (delta 47906), pack-reused 1
Receiving objects: 100% (71530/71530), 35.60 MiB | 12.86 MiB/s, done.
Resolving deltas: 100% (48539/48539), done.

cd qwik/.devcontainer

docker build -t qwik-container . --no-cache
[+] Building 68.7s (6/7)                                                                                                                                                                    docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 437B                                                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/cimg/rust:1.72.1-node                                                                                                                                      0.3s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => CACHED [1/4] FROM docker.io/cimg/rust:1.72.1-node@sha256:9c45693a816000c4be79d45c76bbf8e52334cdbcbe36e66dc769cecbbee07881                                                                         0.0s
 => [2/4] RUN rustup --version;     cargo --version;     rustc --version;                                                                                                                             0.2s
 => ERROR [3/4] RUN rustup update;     rustup target add wasm32-unknown-unknown;     cargo install cargo-insta;     cargo install wasm-pack;     rustup component add clippy;     corepack enable -  68.2s
------
 > [3/4] RUN rustup update;     rustup target add wasm32-unknown-unknown;     cargo install cargo-insta;     cargo install wasm-pack;     rustup component add clippy;     corepack enable --install-directory ~/bin:
0.303 + rustup update
0.305 info: no updatable toolchains installed
0.306 info: checking for self-update
0.409 info: cleaning up downloads & tmp directories
0.411 + rustup target add wasm32-unknown-unknown
0.502 info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
1.366 info: installing component 'rust-std' for 'wasm32-unknown-unknown'
2.954 + cargo install cargo-insta
2.993     Updating crates.io index
3.105  Downloading crates ...
3.312   Downloaded cargo-insta v1.35.1
3.352   Installing cargo-insta v1.35.1
3.386     Updating crates.io index
3.974  Downloading crates ...
4.244   Downloaded thiserror-impl v1.0.57
4.258   Downloaded tempfile v3.10.0
4.267   Downloaded bitflags v1.3.2
4.319   Downloaded proc-macro-error-attr v1.0.4
4.337   Downloaded textwrap v0.11.0
4.343   Downloaded structopt-derive v0.4.18
4.359   Downloaded cpufeatures v0.2.12
4.363   Downloaded lazy_static v1.4.0
4.366   Downloaded block-buffer v0.10.4
4.369   Downloaded walkdir v2.4.0
4.372   Downloaded version_check v0.9.4
4.374   Downloaded thiserror v1.0.57
4.383   Downloaded errno v0.3.8
4.385   Downloaded same-file v1.0.6
4.387   Downloaded cfg-if v1.0.0
4.389   Downloaded unicode-width v0.1.11
4.447   Downloaded generic-array v0.14.7
4.451   Downloaded log v0.4.20
4.458   Downloaded getrandom v0.2.12
4.464   Downloaded pest_derive v2.7.7
4.467   Downloaded crossbeam-deque v0.8.5
4.470   Downloaded console v0.15.8
4.474   Downloaded cargo_metadata v0.18.1
4.477   Downloaded quote v1.0.35
4.480   Downloaded fastrand v2.0.1
4.482   Downloaded heck v0.3.3
4.484   Downloaded camino v1.1.6
4.486   Downloaded globset v0.4.14
4.488   Downloaded semver v1.0.22
4.491   Downloaded uuid v1.7.0
4.494   Downloaded yaml-rust v0.4.5
4.496   Downloaded typenum v1.17.0
4.499   Downloaded similar v2.4.0
4.504   Downloaded bitflags v2.4.2
4.507   Downloaded ucd-trie v0.1.6
4.509   Downloaded ignore v0.4.22
4.512   Downloaded ryu v1.0.17
4.515   Downloaded crossbeam-utils v0.8.19
4.517   Downloaded crossbeam-epoch v0.9.18
4.520   Downloaded pest_meta v2.7.7
4.522   Downloaded proc-macro2 v1.0.78
4.525   Downloaded linked-hash-map v0.5.6
4.526   Downloaded itoa v1.0.10
4.527   Downloaded unicode-ident v1.0.12
4.530   Downloaded structopt v0.3.26
4.536   Downloaded digest v0.10.7
4.538   Downloaded crypto-common v0.1.6
4.539   Downloaded pest_generator v2.7.7
4.540   Downloaded serde_derive v1.0.197
4.543   Downloaded cargo-platform v0.1.7
4.544   Downloaded once_cell v1.19.0
4.547   Downloaded sha2 v0.10.8
4.549   Downloaded proc-macro-error v1.0.4
4.575   Downloaded memchr v2.7.1
4.581   Downloaded serde v1.0.197
4.588   Downloaded unicode-segmentation v1.11.0
4.602   Downloaded pest v2.7.7
4.642   Downloaded serde_json v1.0.114
4.662   Downloaded aho-corasick v1.1.2
4.710   Downloaded clap v2.34.0
4.718   Downloaded syn v2.0.50
4.742   Downloaded syn v1.0.109
4.798   Downloaded bstr v1.9.0
4.813   Downloaded regex-syntax v0.8.2
4.824   Downloaded rustix v0.38.31
4.893   Downloaded insta v1.35.1
4.914   Downloaded regex-automata v0.4.5
4.939   Downloaded libc v0.2.153
5.029   Downloaded linux-raw-sys v0.4.13
5.099    Compiling proc-macro2 v1.0.78
5.099    Compiling unicode-ident v1.0.12
5.099    Compiling thiserror v1.0.57
5.099    Compiling version_check v0.9.4
5.099    Compiling serde v1.0.197
5.099    Compiling syn v1.0.109
5.100    Compiling memchr v2.7.1
5.103    Compiling libc v0.2.153
5.344    Compiling crossbeam-utils v0.8.19
5.601    Compiling proc-macro-error-attr v1.0.4
5.834    Compiling ucd-trie v0.1.6
5.875    Compiling unicode-width v0.1.11
5.994    Compiling proc-macro-error v1.0.4
6.042    Compiling once_cell v1.19.0
6.287    Compiling aho-corasick v1.1.2
6.396    Compiling cfg-if v1.0.0
6.414    Compiling serde_json v1.0.114
6.460    Compiling semver v1.0.22
6.767    Compiling quote v1.0.35
6.910    Compiling lazy_static v1.4.0
6.932    Compiling unicode-segmentation v1.11.0
6.981    Compiling camino v1.1.6
7.212    Compiling syn v2.0.50
7.439    Compiling rustix v0.38.31
7.754    Compiling regex-syntax v0.8.2
8.105    Compiling heck v0.3.3
8.402    Compiling crossbeam-epoch v0.9.18
8.434    Compiling textwrap v0.11.0
9.485    Compiling bstr v1.9.0
9.664    Compiling ryu v1.0.17
10.22    Compiling regex-automata v0.4.5
10.31    Compiling itoa v1.0.10
10.47    Compiling linked-hash-map v0.5.6
11.28    Compiling bitflags v2.4.2
11.76    Compiling log v0.4.20
12.24    Compiling same-file v1.0.6
12.41    Compiling linux-raw-sys v0.4.13
12.54    Compiling bitflags v1.3.2
12.61    Compiling clap v2.34.0
13.27    Compiling thiserror-impl v1.0.57
14.07    Compiling serde_derive v1.0.197
16.71    Compiling pest v2.7.7
19.72    Compiling pest_meta v2.7.7
20.48    Compiling globset v0.4.14
21.25    Compiling pest_generator v2.7.7
22.74    Compiling structopt-derive v0.4.18
23.26    Compiling pest_derive v2.7.7
24.40    Compiling walkdir v2.4.0
25.86    Compiling yaml-rust v0.4.5
26.57    Compiling crossbeam-deque v0.8.5
28.09    Compiling console v0.15.8
28.73    Compiling getrandom v0.2.12
29.07    Compiling fastrand v2.0.1
31.19    Compiling cargo-platform v0.1.7
31.27    Compiling similar v2.4.0
31.76    Compiling cargo_metadata v0.18.1
32.33    Compiling insta v1.35.1
32.72    Compiling tempfile v3.10.0
35.62    Compiling uuid v1.7.0
36.15    Compiling ignore v0.4.22
37.06    Compiling structopt v0.3.26
59.53    Compiling cargo-insta v1.35.1
65.39     Finished release [optimized] target(s) in 1m 02s
65.40   Installing /home/circleci/.cargo/bin/cargo-insta
65.40    Installed package `cargo-insta v1.35.1` (executable `cargo-insta`)
65.44 + cargo install wasm-pack
65.48     Updating crates.io index
65.59  Downloading crates ...
65.94   Downloaded wasm-pack v0.12.1
66.00   Installing wasm-pack v0.12.1
66.03     Updating crates.io index
67.19  Downloading crates ...
67.46   Downloaded powerfmt v0.2.0
67.47   Downloaded rand_core v0.6.4
67.49   Downloaded dirs-next v2.0.0
67.52   Downloaded zstd-safe v5.0.2+zstd.1.5.2
67.52   Downloaded addr2line v0.21.0
67.53   Downloaded percent-encoding v2.3.1
67.53   Downloaded time-core v0.1.2
67.53   Downloaded tinyvec_macros v0.1.1
67.54   Downloaded parking_lot_core v0.9.9
67.55   Downloaded password-hash v0.4.2
67.55   Downloaded colorchoice v1.0.0
67.56   Downloaded constant_time_eq v0.1.5
67.57   Downloaded atty v0.2.14
67.57   Downloaded num-conv v0.1.0
67.57   Downloaded equivalent v1.0.1
67.58   Downloaded glob v0.3.1
67.59   Downloaded subtle v2.5.0
67.59   Downloaded hex v0.4.3
67.59   Downloaded heck v0.4.1
67.59   Downloaded utf8parse v0.2.1
67.60   Downloaded human-panic v1.2.3
67.60   Downloaded cipher v0.4.4
67.60   Downloaded cargo_metadata v0.15.4
67.60   Downloaded shell-words v1.1.0
67.60   Downloaded serde_spanned v0.6.5
67.60   Downloaded rustls-pki-types v1.3.0
67.61   Downloaded zeroize v1.7.0
67.61   Downloaded xattr v1.3.1
67.61   Downloaded autocfg v1.1.0
67.61   Downloaded deranged v0.3.11
67.61   Downloaded home v0.5.9
67.61   Downloaded untrusted v0.9.0
67.62   Downloaded toml_datetime v0.6.5
67.62   Downloaded strsim v0.11.0
67.62   Downloaded serde_ignored v0.1.10
67.62   Downloaded pbkdf2 v0.11.0
67.62   Downloaded is_executable v0.1.2
67.62   Downloaded inout v0.1.3
67.62   Downloaded form_urlencoded v1.2.1
67.62   Downloaded fs2 v0.4.3
67.63   Downloaded smallvec v1.13.1
67.63   Downloaded iana-time-zone v0.1.60
67.63   Downloaded clap_derive v4.5.0
67.63   Downloaded bzip2 v0.4.4
67.63   Downloaded byteorder v1.5.0
67.63   Downloaded spin v0.9.8
67.64   Downloaded anstream v0.6.12
67.64   Downloaded crc32fast v1.4.0
67.64   Downloaded pkg-config v0.3.30
67.64   Downloaded zstd v0.11.2+zstd.1.5.2
67.64   Downloaded lock_api v0.4.11
67.65   Downloaded base64ct v1.6.0
67.65   Downloaded either v1.10.0
67.65   Downloaded filetime v0.2.23
67.65   Downloaded rustc-demangle v0.1.23
67.65   Downloaded dialoguer v0.10.4
67.65   Downloaded anstyle-parse v0.2.3
67.66   Downloaded clap v4.5.1
67.66   Downloaded binary-install v0.2.0
67.66   Downloaded anyhow v1.0.80
67.67   Downloaded which v4.4.2
67.67   Downloaded strsim v0.10.0
67.67   Downloaded siphasher v0.3.11
67.67   Downloaded sha1 v0.10.6
67.67   Downloaded toml v0.7.8
67.68   Downloaded parking_lot v0.12.1
67.68   Downloaded env_logger v0.10.2
67.68   Downloaded num-traits v0.2.18
67.68   Downloaded hmac v0.12.1
67.68   Downloaded tinyvec v1.6.0
67.69   Downloaded unicode-bidi v0.3.15
67.69   Downloaded zip v0.6.6
67.69   Downloaded tar v0.4.40
67.70   Downloaded miniz_oxide v0.7.2
67.70   Downloaded zstd-sys v2.0.9+zstd.1.5.5
67.72   Downloaded backtrace v0.3.69
67.73   Downloaded base64 v0.21.7
67.73   Downloaded aes v0.8.4
67.73   Downloaded url v2.5.0
67.74   Downloaded ureq v2.9.6
67.74   Downloaded unicode-normalization v0.1.23
67.75   Downloaded time v0.3.34
67.75   Downloaded winnow v0.5.40
67.76   Downloaded clap_builder v4.5.1
67.77   Downloaded rustls-webpki v0.102.2
67.79   Downloaded object v0.32.2
67.80   Downloaded rustls v0.22.2
67.81   Downloaded idna v0.5.0
67.82   Downloaded bzip2-sys v0.1.11+1.0.8
67.84   Downloaded chrono v0.4.34
67.85   Downloaded gimli v0.28.1
67.86   Downloaded webpki-roots v0.26.1
67.86   Downloaded hashbrown v0.14.3
67.87   Downloaded toml_edit v0.22.6
67.89   Downloaded toml_edit v0.19.15
67.90   Downloaded indexmap v2.2.3
67.90   Downloaded flate2 v1.0.28
67.91   Downloaded cc v1.0.86
67.91   Downloaded toml v0.8.10
67.91   Downloaded scopeguard v1.2.0
67.91   Downloaded os_info v3.7.0
67.92   Downloaded dirs-sys-next v0.1.2
67.92   Downloaded clap_lex v0.7.0
67.92   Downloaded anstyle-query v1.0.2
67.92   Downloaded anstyle v1.0.6
67.92   Downloaded adler v1.0.2
67.97   Downloaded ring v0.17.8
68.10 error: failed to compile `wasm-pack v0.12.1`, intermediate artifacts can be found at `/tmp/cargo-installjMxUGT`.
68.10 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
68.10
68.10 Caused by:
68.10   package `clap_builder v4.5.1` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.72.1
68.10   Try re-running cargo install with `--locked`
------
Dockerfile:7
--------------------
   6 |
   7 | >>> RUN rustup update; \
   8 | >>>     rustup target add wasm32-unknown-unknown; \
   9 | >>>     cargo install cargo-insta; \
  10 | >>>     cargo install wasm-pack; \
  11 | >>>     rustup component add clippy; \
  12 | >>>     corepack enable --install-directory ~/bin
  13 |
--------------------
ERROR: failed to solve: process "/bin/bash -exo pipefail -c rustup update;     rustup target add wasm32-unknown-unknown;     cargo install cargo-insta;     cargo install wasm-pack;     rustup component add clippy;     corepack enable --install-directory ~/bin" did not complete successfully: exit code: 101

View build details: docker-desktop://dashboard/build/default/default/uvzlndzkv0785j811d55n3q6c

# Edited to add the code I mentioned before

docker build -t qwik-container . --no-cache
[+] Building 144.9s (9/9) FINISHED                                                                                                                                                          docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 501B                                                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/cimg/rust:1.72.1-node                                                                                                                                      0.3s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => CACHED [1/5] FROM docker.io/cimg/rust:1.72.1-node@sha256:9c45693a816000c4be79d45c76bbf8e52334cdbcbe36e66dc769cecbbee07881                                                                         0.0s
 => [2/5] RUN rustup toolchain install stable;   rustup default stable                                                                                                                               19.4s
 => [3/5] RUN rustup --version;     cargo --version;     rustc --version;                                                                                                                             0.3s
 => [4/5] RUN rustup update;     rustup target add wasm32-unknown-unknown;     cargo install cargo-insta;     cargo install wasm-pack;     rustup component add clippy;     corepack enable --inst  118.5s
 => [5/5] RUN mkdir /home/circleci/store;     pnpm config set store-dir /home/circleci/store                                                                                                          1.7s
 => exporting to image                                                                                                                                                                                4.8s
 => => exporting layers                                                                                                                                                                               4.8s
 => => writing image sha256:ef42687b71a187403d842fa1cf723d06f6a4340ed0b0af19e69c60741b3e3397                                                                                                          0.0s
 => => naming to docker.io/library/qwik-container                                                                                                                                                     0.0s
wmertens commented 9 months ago

error: failed to compile wasm-pack v0.12.1, intermediate artifacts can be found at /tmp/cargo-installjMxUGT. cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.72.1

So it's not working?

kanielrkirby commented 9 months ago

@wmertens Sorry, probably wasn't enough separation between the two, but essentially:

  1. I git cloneed a fresh repo with no changes.
  2. I tried building, and ran into the same failed build.
  3. I added the following to the Dockerfile:
RUN rustup toolchain install stable; \
    rustup default stable
  1. Tried building again (with --no-cache) and it works just fine.
reosablo commented 9 months ago

error: failed to compile wasm-pack v0.12.1, intermediate artifacts can be found at /tmp/cargo-installjMxUGT. cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.72.1

I have the same issue on Windows WSL.

In my case, I modified the Dockerfile like the bellow and worked:

- FROM cimg/rust:1.72.1-node
+ FROM cimg/rust:1.75.0-node

I'm not sure there are no problem by this change.

wmertens commented 8 months ago

I tried changing the rust toolchain to stable and it didn't work because the optimizer uses unstable features like box.

I then tried to upgrade the nightly but that didn't work because the unstable filterDrain feature changed.

In any case, try installing nixpkgs from nixos.org and running nix develop inside the Qwik source tree. That should give you a fully working dev environment.

gioboa commented 5 months ago

Great @wmertens for this solution. So I'm closing this issue for now, feel free to re-open it if it's still an issue for you.