ruby.wasm icon indicating copy to clipboard operation
ruby.wasm copied to clipboard

jco is not found on build

Open krmbn0576 opened this issue 1 year ago • 7 comments

$ rake npm:ruby-head-wasm-wasi

...
npx jco transpile --no-wasi-shim --instantiation --valid-lifting-optimization /home/user/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi/tmp/ruby.component.wasm -o /home/user/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi/dist/component
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/jco - Not found
npm ERR! 404
npm ERR! 404  'jco@*' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2024-05-16T01_40_50_213Z-debug-0.log
rake aborted!
Command failed with status (1): [npx jco transpile --no-wasi-shim --instantiation --valid-lifting-optimization /home/user/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi/tmp/ruby.component.wasm -o /home/user/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi/dist/component]

krmbn0576 avatar May 16 '24 01:05 krmbn0576

Did you run bin/setup?

kateinoigakukun avatar May 16 '24 02:05 kateinoigakukun

Ah, sorry, I guess you did not do git submodule update

kateinoigakukun avatar May 16 '24 02:05 kateinoigakukun

i did run twice, so third trial now is below.

$ ./bin/setup

root="$(cd "$(dirname "$0")/.." && pwd)"
+++ dirname ./bin/setup
++ cd ./bin/..
++ pwd
+ root=/home/user/ruby.wasm

env BUNDLE_GEMFILE="$root/Gemfile" bundle install
+ env BUNDLE_GEMFILE=/home/user/ruby.wasm/Gemfile bundle install
Bundle complete! 7 Gemfile dependencies, 38 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
env BUNDLE_GEMFILE="$root/packages/npm-packages/ruby-wasm-wasi/Gemfile" bundle install
+ env BUNDLE_GEMFILE=/home/user/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/Gemfile bundle install
Bundle complete! 4 Gemfile dependencies, 5 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

# Build vendored jco if Rust toolchain is available and submodule is checked out
if command -v rustc && [ -f vendor/jco/package.json ]; then
  npm -C vendor/jco install
  npm -C vendor/jco run build
else
  echo "Rust toolchain not found or jco submodule not checked out, skipping jco build"
fi
+ command -v rustc
/home/user/.cargo/bin/rustc
+ '[' -f vendor/jco/package.json ']'
+ echo 'Rust toolchain not found or jco submodule not checked out, skipping jco build'
Rust toolchain not found or jco submodule not checked out, skipping jco build
npm ci
+ npm ci

added 344 packages, and audited 352 packages in 3s

90 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

krmbn0576 avatar May 16 '24 02:05 krmbn0576

$ git submodule update
fatal: destination path '/home/user/ruby.wasm/vendor/jco' already exists and is not an empty directory.
fatal: clone of 'https://github.com/bytecodealliance/jco.git' into submodule path '/home/user/ruby.wasm/vendor/jco' failed
Failed to clone 'vendor/jco'. Retry scheduled
fatal: destination path '/home/user/ruby.wasm/vendor/jco' already exists and is not an empty directory.
fatal: clone of 'https://github.com/bytecodealliance/jco.git' into submodule path '/home/user/ruby.wasm/vendor/jco' failed
Failed to clone 'vendor/jco' a second time, aborting

krmbn0576 avatar May 16 '24 02:05 krmbn0576

Could you try removing vendor/jco and git submodule update, then bin/setup again?

kateinoigakukun avatar May 16 '24 02:05 kateinoigakukun

$ rm -rf vendor
$ git submodule update

Cloning into '/home/user/ruby.wasm/vendor/jco'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (3/3), 396 bytes | 396.00 KiB/s, done.
From https://github.com/bytecodealliance/jco
 * branch            fbf3e7559a8f25b9d660b802b4ba25470be784b0 -> FETCH_HEAD
Submodule path 'vendor/jco': checked out 'fbf3e7559a8f25b9d660b802b4ba25470be784b0'

suceeded update submodule, thx! but...

$ ./bin/setup

...
> @bytecodealliance/[email protected] build
> cargo xtask build debug
...

error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-wasi` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasi`

error[E0463]: can't find crate for `compiler_builtins`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: command exited with non-zero code `cargo build --workspace --target wasm32-wasi`: 101

so i did rustup target add wasm32-wasi , finally succeeded! Hmm it seems to depend on the rustup target, so could you please add it to the CONTRIBUTING.md? Thanks!

krmbn0576 avatar May 16 '24 02:05 krmbn0576

Actually, vendor/jco is a temporal solution to make it work before the Kaigi but I should note it in the guide

kateinoigakukun avatar May 16 '24 02:05 kateinoigakukun

I've upstreamed all necessary fixes in jco, so jco is no longer vendored as a submodule

kateinoigakukun avatar Oct 01 '24 03:10 kateinoigakukun