wasmtime-java icon indicating copy to clipboard operation
wasmtime-java copied to clipboard

Deploy to a Maven repository

Open dsyer opened this issue 3 years ago • 4 comments

I have 0 experience with Rust, and this project will not build for me. Maybe we could have something deployed to Maven Central or something. I'd like to try it, but I have no chance currently.

dsyer avatar Feb 15 '22 17:02 dsyer

Hi, thanks for the interest in this project.

I don't think the project is currently in a state to publish to Maven Central, but I do think we should do that in the future. There are some challenges, as we have to build native support for the wasmtime runtime for target platforms. Again, it should be possible, but we'll need to build a better CI pipeline to handle that situation.

In terms of compiling, have you followed the building steps and those aren't working? Could you share your error if that's the case? Also, what platform are you compiling on? My dev system is macOS, so I haven't really tested the other platform builds, though they may work.

bluejekyll avatar Feb 15 '22 18:02 bluejekyll

I'm on Linux (Ubuntu base). If you follow the instructions in the README you first find that you need to install mvn. Once you do that you get this:

$ make init
====> Testing for all tools
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /home/vscode/.sdkman/candidates/maven/current
Java version: 17.0.2, vendor: GraalVM Community, runtime: /home/vscode/.sdkman/candidates/java/22.0.0.2.r17-grl
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-99-generic", arch: "amd64", family: "unix"
/bin/sh: 1: cargo: not found
rust is required, e.g. curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | sh
/bin/sh: 1: cargo: not found
make: *** [Makefile:50: init] Error 127

If you follow the hint and do the curl | sh thing it generates some garbage that I don't understand. This looks fishy: default host triple: x86_64-unknown-linux-gnu ("unknown" sounds bad, I guess), but if you persevere it installs rust. So then try again and make init now succeeds. Next:

$ make test
...
 cargo:warning=clang -cc1as: error: unknown target triple 'x86_64-unknown-linux-gnu', please use -triple or -arch
  exit status: 1

  --- stderr


  error occurred: Command "/home/vscode/wasi-sdk-14.0/bin/clang" "--sysroot=/home/vscode/wasi-sdk-14.0/share/wasi-sysroot" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-unknown-linux-gnu" "-Wall" "-Wextra" "-o" "/workspaces/hello-wasi/tmp/wasmtime-java/target/debug/build/rsix-80ccb8fa5e747e1f/out/src/imp/linux_raw/arch/outline/x86_64.o" "-c" "src/imp/linux_raw/arch/outline/x86_64.S" with args "clang" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: clang -cc1as: error: unknown target triple 'x86_64-unknown-linux-gnu', please use -triple or -arch

error: build failed
make: *** [Makefile:68: build] Error 101

So that looks bad, and I have no clue what it means.

dsyer avatar Feb 16 '22 10:02 dsyer

I figured out how to get round that (I have clang from wasi-sdk installed as the default C compiler - useful for compiling WASMs, but not for building native libraries). Then I got an error from Maven which seems to suggest the project won't build with Java 17(?). Downgraded to Java 11 and make test succeeded.

dsyer avatar Feb 16 '22 10:02 dsyer

I also had to make some changes to the Wasmtime bootstrapper because it doesn't know that os.arch=amd64 is known to Rust as x86_64. Then I can finally run "Hello World". See #8.

dsyer avatar Feb 16 '22 10:02 dsyer