From 40f0271ccf802e75a9524d340ba6dc7abf83a80a Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sat, 6 Nov 2021 14:08:19 -0700 Subject: [PATCH] Fix M1 mac build I changed wasmer to use the llvm backend because it compiles the fastest and supports aarch64. If we later run into llvm versioning issues of some sort, we should switch this to cranelift. Also re-adds serde-json which is used on macos. --- Cargo.lock | 116 +++++++++++++++++++++++----------- cli/Cargo.toml | 4 +- compiler/build/Cargo.toml | 3 + compiler/gen_wasm/Cargo.toml | 2 +- compiler/test_gen/Cargo.toml | 2 +- compiler/test_wasm/Cargo.toml | 2 +- 6 files changed, 88 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4c35ad9cd..3be8407258 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -353,7 +353,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" dependencies = [ - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -1099,32 +1099,6 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" -[[package]] -name = "dynasm" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc2d9a5e44da60059bd38db2d05cbb478619541b8c79890547861ec1e3194f0" -dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dynasmrt" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42276e3f205fe63887cca255aa9a65a63fb72764c30b9a6252a7c7e46994f689" -dependencies = [ - "byteorder", - "dynasm", - "memmap2 0.2.3", -] - [[package]] name = "either" version = "1.6.1" @@ -1644,14 +1618,25 @@ version = "0.1.0" source = "git+https://github.com/rtfeldman/inkwell?tag=llvm12-0.release8#14b78d96d2dbc95694e181be66e4cd53df3fc02f" dependencies = [ "either", - "inkwell_internals", + "inkwell_internals 0.3.0 (git+https://github.com/rtfeldman/inkwell?tag=llvm12-0.release8)", "libc", - "llvm-sys", + "llvm-sys 120.2.1", "once_cell", "parking_lot", "regex", ] +[[package]] +name = "inkwell_internals" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e1f71330ccec54ee62533ae88574c4169b67fb4b95cbb1196a1322582abd11" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "inkwell_internals" version = "0.3.0" @@ -1850,6 +1835,19 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +[[package]] +name = "llvm-sys" +version = "110.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b7cc88ba864d592f52132ed3a19a97118fe16c92a63961f54b0ab7279c5407f" +dependencies = [ + "cc", + "lazy_static", + "libc", + "regex", + "semver 0.11.0", +] + [[package]] name = "llvm-sys" version = "120.2.1" @@ -3107,6 +3105,7 @@ dependencies = [ "roc_std", "roc_types", "roc_unify", + "serde_json", "target-lexicon", "tempfile", ] @@ -3592,6 +3591,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.4.0" @@ -3677,13 +3685,22 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser", + "semver-parser 0.10.2", ] [[package]] @@ -3692,6 +3709,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "semver-parser" version = "0.10.2" @@ -4532,7 +4555,7 @@ dependencies = [ "target-lexicon", "thiserror", "wasmer-compiler", - "wasmer-compiler-singlepass", + "wasmer-compiler-llvm", "wasmer-derive", "wasmer-engine", "wasmer-engine-dylib", @@ -4562,22 +4585,28 @@ dependencies = [ ] [[package]] -name = "wasmer-compiler-singlepass" +name = "wasmer-compiler-llvm" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9429b9f7708c582d855b1787f09c7029ff23fb692550d4a1cc351c8ea84c3014" +checksum = "9ec5b3542941aaea793a51af9a7da2f9f7ed9edcc928f5c84e1bd84071818c39" dependencies = [ "byteorder", - "dynasm", - "dynasmrt", + "cc", + "itertools 0.10.1", "lazy_static", + "libc", "loupe", - "more-asserts", + "object 0.25.3", "rayon", + "regex", + "rustc_version 0.2.3", + "semver 1.0.4", "smallvec", + "target-lexicon", "wasmer-compiler", "wasmer-types", "wasmer-vm", + "wasmer_inkwell", ] [[package]] @@ -4731,6 +4760,21 @@ dependencies = [ "wasmer-types", ] +[[package]] +name = "wasmer_inkwell" +version = "0.2.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eca826323f39b29a38cd31c8eb33de76945c6193f30a2806c6cde6f6cd42cb1" +dependencies = [ + "either", + "inkwell_internals 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "llvm-sys 110.0.2", + "once_cell", + "parking_lot", + "regex", +] + [[package]] name = "wasmparser" version = "0.78.2" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index fe5618efc6..7be49bbce3 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -78,11 +78,11 @@ inkwell = { path = "../vendor/inkwell", optional = true } target-lexicon = "0.12.2" tempfile = "3.2.0" -wasmer = { version = "2.0.0", optional = true, default-features = false, features = ["default-singlepass", "default-universal"] } +wasmer = { version = "2.0.0", optional = true, default-features = false, features = ["default-llvm", "default-universal"] } wasmer-wasi = { version = "2.0.0", optional = true } [dev-dependencies] -wasmer = { version = "2.0.0", default-features = false, features = ["default-singlepass", "default-universal"] } +wasmer = { version = "2.0.0", default-features = false, features = ["default-llvm", "default-universal"] } wasmer-wasi = "2.0.0" pretty_assertions = "1.0.0" indoc = "1.0.3" diff --git a/compiler/build/Cargo.toml b/compiler/build/Cargo.toml index f523e43e48..80c87fe626 100644 --- a/compiler/build/Cargo.toml +++ b/compiler/build/Cargo.toml @@ -32,6 +32,9 @@ tempfile = "3.2.0" inkwell = { path = "../../vendor/inkwell", optional = true } target-lexicon = "0.12.2" +[target.'cfg(target_os = "macos")'.dependencies] +serde_json = "1.0.69" + [features] default = ["llvm", "target-aarch64", "target-x86_64", "target-wasm32"] target-arm = [] diff --git a/compiler/gen_wasm/Cargo.toml b/compiler/gen_wasm/Cargo.toml index d47ae589ce..1b75be949e 100644 --- a/compiler/gen_wasm/Cargo.toml +++ b/compiler/gen_wasm/Cargo.toml @@ -12,7 +12,7 @@ roc_mono = { path = "../mono" } bumpalo = { version = "3.8.0", features = ["collections"] } roc_std = { path = "../../roc_std" } -wasmer = { version = "2.0.0", default-features = false, features = ["default-singlepass", "default-universal"] } +wasmer = { version = "2.0.0", default-features = false, features = ["default-llvm", "default-universal"] } [dev-dependencies] roc_can = { path = "../can" } diff --git a/compiler/test_gen/Cargo.toml b/compiler/test_gen/Cargo.toml index 3ea03e4dfb..c56a1d4cee 100644 --- a/compiler/test_gen/Cargo.toml +++ b/compiler/test_gen/Cargo.toml @@ -32,7 +32,7 @@ libc = "0.2.106" inkwell = { path = "../../vendor/inkwell" } target-lexicon = "0.12.2" libloading = "0.7.1" -wasmer = { version = "2.0.0", default-features = false, features = ["default-singlepass", "default-universal"] } +wasmer = { version = "2.0.0", default-features = false, features = ["default-llvm", "default-universal"] } wasmer-wasi = "2.0.0" tempfile = "3.2.0" diff --git a/compiler/test_wasm/Cargo.toml b/compiler/test_wasm/Cargo.toml index 472b8d4576..000f3ee6c1 100644 --- a/compiler/test_wasm/Cargo.toml +++ b/compiler/test_wasm/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" # roc_module = { path = "../module" } # roc_mono = { path = "../mono" } -wasmer = { version = "2.0.0", default-features = false, features = ["default-singlepass", "default-universal"] } +wasmer = { version = "2.0.0", default-features = false, features = ["default-llvm", "default-universal"] } wasmer-wasi = "2.0.0" roc_collections = { path = "../collections" }