diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d5c7896..c43b07c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,19 +23,12 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" test -f $HOME/.cargo/bin/just || cargo install just - # Compile the Rust part of the library. - - run: - name: Compile the Rust part of the Go library - command: | - export PATH="$HOME/.cargo/bin:$PATH" - just rust - # Compile and install the Go library. - run: name: Compile and install the Go library command: | export PATH="$HOME/.cargo/bin:$PATH" - just go + just build # Run the library test suites. - run: diff --git a/justfile b/justfile index 6b08cad7..3d347008 100644 --- a/justfile +++ b/justfile @@ -1,9 +1,5 @@ -# Compile the Rust part for this specific system. -rust: - cargo build --release - -# Compile the Go part. -go go-build-args='': +# Compile the library. +build go-build-args='-v': #!/usr/bin/env bash set -euo pipefail cd wasmer @@ -17,9 +13,15 @@ go go-build-args='': *) dylib_extension="so" esac - test -f libwasmer_runtime_c_api.${dylib_extension} || \ + if ! test -f libwasmer_runtime_c_api.${dylib_extension}; then + cargo build --release ln -s ../target/release/deps/libwasmer_runtime_c_api-*.${dylib_extension} libwasmer_runtime_c_api.${dylib_extension} - go build -ldflags="-r $(pwd)" -v {{go-build-args}} . + fi + go build {{go-build-args}} . + +# Compile the Rust part for this specific system. +rust: + cargo build --release # Generate cgo debug objects. debug-cgo: @@ -30,7 +32,7 @@ debug-cgo: # Run all the tests. test: #!/usr/bin/env bash - export LD_LIBRARY_PATH=$(pwd)/wasmer + #export DYLD_PRINT_LIBRARIES=y cd wasmer/test/ # Run the tests. go test -test.v $(find . -type f \( -name "*_test.go" \! -name "example_*.go" \! -name "benchmark*.go" \) ) imports.go diff --git a/wasmer/bridge.go b/wasmer/bridge.go index 8d8cccd6..d3083c08 100644 --- a/wasmer/bridge.go +++ b/wasmer/bridge.go @@ -1,6 +1,6 @@ package wasmer -// #cgo LDFLAGS: -L./ -lwasmer_runtime_c_api +// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmer_runtime_c_api // #include "./wasmer.h" // import "C" diff --git a/wasmer/libwasmer_runtime_c_api.dylib b/wasmer/libwasmer_runtime_c_api.dylib index 5b10678b..dfcfe5a0 100644 Binary files a/wasmer/libwasmer_runtime_c_api.dylib and b/wasmer/libwasmer_runtime_c_api.dylib differ