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

Test static windows build #386

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
302f20e
Add build_shared_library_windows
webmaster128 Dec 13, 2022
9193a04
Add wasmvm_test_windows CI job
webmaster128 Dec 1, 2022
c175955
Avoid dot notation for relative paths in persist_to_workspace
webmaster128 Dec 1, 2022
0769266
Increase build_shared_library_windows machine size
webmaster128 Dec 1, 2022
1942061
Try windows path notation in persist_to_workspace of build_shared_lib…
webmaster128 Dec 1, 2022
948f355
Attach workspace at C:/builds
webmaster128 Dec 1, 2022
141deac
Harden ffiErrorWithMessage implementation
webmaster128 Dec 1, 2022
e7c07bb
Make void return types more explicit
webmaster128 Dec 1, 2022
27b936b
Use errno-sys to set errnos
webmaster128 Jan 16, 2023
aacb7e1
Try external linker
webmaster128 Dec 1, 2022
cfb9cd9
Make clippy happy
webmaster128 Dec 5, 2022
4bb6b30
Advoid explicit linker setting
webmaster128 Dec 5, 2022
052b59c
Return error as integer in save_wasm/remove_wasm/load_wasm/pin/unpin
webmaster128 Jan 16, 2023
38aec9b
Start NO_ERRNO docs
webmaster128 Dec 5, 2022
f98c51f
Let analyze_code return error
webmaster128 Dec 5, 2022
44f7b6e
Let get_metrics return error directly
webmaster128 Dec 5, 2022
5486d1e
Let init_cache return error directly
webmaster128 Dec 5, 2022
07ed64c
Use CachePtr consistently and remove cache_t
webmaster128 Jan 16, 2023
76a5518
Let C.instantiate and C.execute return error code directly
webmaster128 Dec 5, 2022
0fb2b21
Let 2 arg C calls return error directly
webmaster128 Dec 5, 2022
85751f9
Remove unused ffiErrorWithMessage
webmaster128 Dec 5, 2022
92ee8cb
Remove errno
webmaster128 Jan 16, 2023
cef818f
Refactor ErrorCode
webmaster128 Dec 5, 2022
5eb012a
Avoid FFI calls for errmsg, out that are not used
webmaster128 Dec 5, 2022
94d9840
Get CPU info of Windows machine
webmaster128 Dec 6, 2022
1813526
Replace .dll with .a for Windows
Jan 17, 2023
dd96099
Replace .dll with .a in CI
webmaster128 Jan 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 98 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ version: 2.1
orbs:
win: circleci/windows@5.0

commands:
show_cpu_info:
steps:
- run:
name: Show CPU info
command: |
set -o errexit
curl -sS -L --output py-cpuinfo.zip https://github.com/workhorsy/py-cpuinfo/archive/refs/tags/v9.0.0.zip
unzip -q py-cpuinfo.zip
python py-cpuinfo-*/cpuinfo/cpuinfo.py

jobs:
# All checks on the codebase that can run in parallel to build_shared_library
libwasmvm_sanity:
Expand Down Expand Up @@ -79,6 +90,7 @@ jobs:
- run:
name: Reset git config set by CircleCI to make Cargo work
command: git config --global --unset url.ssh://git@github.com.insteadof
- show_cpu_info
- run:
name: Install Rust
command: |
Expand Down Expand Up @@ -233,7 +245,7 @@ jobs:
name: Create release build of libwasmvm
command: make build-rust
- persist_to_workspace:
root: ./internal/api
root: internal/api
paths:
- libwasmvm.x86_64.so
- save_cache:
Expand All @@ -247,6 +259,55 @@ jobs:
- libwasmvm/target/release/deps
key: cargocache-v3-build_shared_library-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}

# Analogue to build_shared_library this builds wasmvm.dll using a native Rust installation
# (i.e. no docker builders). In contrast to libwasmvm_sanity_windows this is a release build
# and gets its own build cache.
build_shared_library_windows:
executor:
name: win/default
size: large
shell: bash.exe
steps:
- checkout
- run:
name: Reset git config set by CircleCI to make Cargo work
command: git config --global --unset url.ssh://git@github.com.insteadof
- show_cpu_info
- run:
name: Install make
command: |
set -o errexit
choco install -y make
- run:
name: Install Rust
command: |
set -o errexit
curl -sS --output rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
./rustup-init.exe --no-modify-path --profile minimal --default-toolchain 1.60.0 -y
echo 'export PATH="$PATH;$USERPROFILE/.cargo/bin"' >> "$BASH_ENV"
- run:
name: Show Rust version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cachev4-build_shared_library_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}
- cachev4-build_shared_library_windows-rust:1.60.0-
- run:
name: Create release build of libwasmvm
command: make build-rust
- persist_to_workspace:
root: internal\api
paths:
- libwasmvm.a
- save_cache:
paths:
# ".." is the easiest way to get $HOME here (pwd is $HOME\project)
- ../.cargo/registry
- libwasmvm/target/release/.fingerprint
- libwasmvm/target/release/build
- libwasmvm/target/release/deps
key: cachev4-build_shared_library_windows-rust:1.60.0-{{ checksum "libwasmvm/Cargo.lock" }}

# Test the Go project
wasmvm_test:
docker:
Expand All @@ -269,6 +330,37 @@ jobs:
command: make test-safety
- run: make build-go

# Test the Go project on Windows
wasmvm_test_windows:
executor:
name: win/default
shell: bash.exe
environment:
GORACE: "halt_on_error=1"
steps:
- checkout
- show_cpu_info
- run:
name: Install make and mingw
# See https://github.com/docker/containerd-packaging/pull/294 for discussion around mingw version
command: |
set -o errexit
choco install -y make
choco install -y mingw --version 10.2.0 --allow-downgrade
- run:
name: Show Go version information
command: |
go version
make --version
- attach_workspace:
at: C:/builds
- run:
name: Copy libwasmvm.a to system library path
command: cp /c/builds/libwasmvm.a /c/Windows/System32
- run:
name: Run Go tests
command: make test

test_alpine_build:
machine:
image: ubuntu-2004:202101-01
Expand Down Expand Up @@ -379,9 +471,13 @@ workflows:
filters: # required since other jobs with tag filters require this one
tags:
only: /.*/
- build_shared_library_windows
- wasmvm_test:
requires:
- build_shared_library
- wasmvm_test_windows:
requires:
- build_shared_library_windows
- build_static_lib:
requires:
- build_shared_library
Expand Down Expand Up @@ -415,6 +511,7 @@ workflows:
- format-scripts
- lint-scripts
- wasmvm_test
- wasmvm_test_windows
filters:
tags:
ignore:
Expand Down
21 changes: 21 additions & 0 deletions docs/NO_ERRNO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Why we are not using errno anymore

wasmvm up until 1.1.1 used errno to communicate errors over the FFI that
happened in the Rust code. The [errno](https://crates.io/crates/errno) crate was
used to set error values in Rust and
[cgo automatically read them](https://utcc.utoronto.ca/~cks/space/blog/programming/GoCgoErrorReturns)
and made them available in the error return value of
`ptr, err := C.init_cache(...)`.

Unfortunately errno does not work well for us when trying to support Windows. On
Windows, `errno`
[uses a Windows API](https://github.com/lambda-fairy/rust-errno/blob/v0.2.8/src/windows.rs#L60-L70)
which then is not what cgo expects. Also Rust's
[libc does not help us](https://github.com/rust-lang/libc/issues/1644) solving
the issue. Using the C errno variable via
[rust-errno](https://github.com/lambda-fairy/rust-errno) caused linker errors
using the Go "internal" linker.

In order to avoid wasting more time and remaining flexible when it comes to the
linker we use, we let all FFI functions return their error as an integer. The
result then goes into an output pointer.
Loading