From b5880922d82ff027c200ae2fe4f7f6c5070c4293 Mon Sep 17 00:00:00 2001 From: ksolana <110843012+ksolana@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:59:14 -0700 Subject: [PATCH] Upgrade llvm-sys to 17.0.1 Fixes: #431 --- .../actions/acquire-solana-tools/action.yml | 4 +-- .github/workflows/llvm-ci-pre-land.yml | 8 ++--- .github/workflows/unit-test.yml | 4 +-- Cargo.lock | 13 ++++++-- language/solana/llvm-extra-sys/Cargo.toml | 2 +- language/solana/llvm-extra-sys/build.rs | 4 +-- language/solana/move-to-solana/Cargo.toml | 2 +- .../tools/move-mv-llvm-compiler/Cargo.toml | 2 +- .../docs/Administration.md | 17 +++++++++++ .../move-mv-llvm-compiler/docs/Development.md | 30 +++++++++---------- scripts/acquire_solana_tools.sh | 2 +- 11 files changed, 56 insertions(+), 32 deletions(-) diff --git a/.github/actions/acquire-solana-tools/action.yml b/.github/actions/acquire-solana-tools/action.yml index c207fcb3b7..ec11d89db5 100644 --- a/.github/actions/acquire-solana-tools/action.yml +++ b/.github/actions/acquire-solana-tools/action.yml @@ -12,7 +12,7 @@ runs: shell: bash run: | mkdir ../llvm - curl -L https://github.com/solana-labs/platform-tools/releases/download/v1.39/move-dev-linux-x86_64.tar.bz2 \ + curl -L https://github.com/solana-labs/platform-tools/releases/download/v1.41/move-dev-linux-x86_64.tar.bz2 \ -o ../llvm/move-dev-linux-x86_64.tar.bz2 ls -lh ../llvm (cd ../llvm && tar xjf move-dev-linux-x86_64.tar.bz2) @@ -22,7 +22,7 @@ runs: shell: bash run: | mkdir ../platform-tools - curl -L https://github.com/solana-labs/platform-tools/releases/download/v1.39/platform-tools-linux-x86_64.tar.bz2 \ + curl -L https://github.com/solana-labs/platform-tools/releases/download/v1.41/platform-tools-linux-x86_64.tar.bz2 \ -o ../platform-tools/platform-tools.tar.bz2 ls -lh ../platform-tools (cd ../platform-tools && tar xjf platform-tools.tar.bz2) diff --git a/.github/workflows/llvm-ci-pre-land.yml b/.github/workflows/llvm-ci-pre-land.yml index 0ffbd9e857..96d08b0342 100644 --- a/.github/workflows/llvm-ci-pre-land.yml +++ b/.github/workflows/llvm-ci-pre-land.yml @@ -59,7 +59,7 @@ jobs: - name: cargo clippy run: cargo xclippy --workspace --all-targets env: - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} - name: cargo fmt run: cargo xfmt --check @@ -85,7 +85,7 @@ jobs: - name: run Solana-based move cli tests run: "cargo test --features solana-backend -p move-cli --test build_testsuite_solana --test move_unit_tests_solana -- --test-threads 1" env: - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} MOVE_NATIVE: ${{ env.MOVE_NATIVE_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} @@ -107,7 +107,7 @@ jobs: - name: run Solana-based move stdlib tests run: "cargo run --features solana-backend -p move-cli --bin move -- test --solana -p language/move-stdlib" env: - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} MOVE_NATIVE: ${{ env.MOVE_NATIVE_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} @@ -129,6 +129,6 @@ jobs: - name: run Solana-based move unit test framework tests run: "cargo test --features solana-backend -p move-unit-test --test move_unit_test_testsuite -- --test-threads 1" env: - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} MOVE_NATIVE: ${{ env.MOVE_NATIVE_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 33727ed945..2d543b9ae5 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -39,7 +39,7 @@ jobs: env: SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} - name: build move-ir-compiler @@ -60,5 +60,5 @@ jobs: env: SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" - LLVM_SYS_150_PREFIX: ${{ env.MOVE_DEV_PATH }} + LLVM_SYS_170_PREFIX: ${{ env.MOVE_DEV_PATH }} PLATFORM_TOOLS_ROOT: ${{ env.PLATFORM_TOOLS_PATH }} diff --git a/Cargo.lock b/Cargo.lock index f62c0b2c63..6647941401 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3680,14 +3680,15 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "150.0.3" +version = "170.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fab12165825f9fe4a9afa32c17bf55a4014a7f0385c5969975f2d04d36cd611c" +checksum = "eed90f72df5504c0af2e3a08ee7762a4a3e42ec2605811fc19f64879de40c50a" dependencies = [ + "anyhow", "cc", "lazy_static 1.4.0", "libc", - "regex", + "regex-lite", "semver 1.0.17", ] @@ -6320,6 +6321,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" version = "0.6.25" diff --git a/language/solana/llvm-extra-sys/Cargo.toml b/language/solana/llvm-extra-sys/Cargo.toml index 041943ffa0..2c416c89f2 100644 --- a/language/solana/llvm-extra-sys/Cargo.toml +++ b/language/solana/llvm-extra-sys/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] libc = "0.2" -llvm-sys = "150.0.3" +llvm-sys = "170.0.1" [build-dependencies] cc = "1.0.78" diff --git a/language/solana/llvm-extra-sys/build.rs b/language/solana/llvm-extra-sys/build.rs index 214843dd62..9de8e1b6f3 100644 --- a/language/solana/llvm-extra-sys/build.rs +++ b/language/solana/llvm-extra-sys/build.rs @@ -7,8 +7,8 @@ use std::{path::PathBuf, process::Command}; fn main() -> anyhow::Result<()> { // Get the path to llvm-config from the llvm-sys crate - let llvm_config_path = std::env::var("DEP_LLVM_15_CONFIG_PATH") - .context("DEP_LLVM_15_CONFIG_PATH not set") + let llvm_config_path = std::env::var("DEP_LLVM_17_CONFIG_PATH") + .context("DEP_LLVM_17_CONFIG_PATH not set") .context("this probably means the llvm-sys build failed")?; let llvm_config_path = PathBuf::from(llvm_config_path); let llvm_config = LlvmConfig::new(llvm_config_path); diff --git a/language/solana/move-to-solana/Cargo.toml b/language/solana/move-to-solana/Cargo.toml index 14e7ff5e5a..1d8b9ccba9 100644 --- a/language/solana/move-to-solana/Cargo.toml +++ b/language/solana/move-to-solana/Cargo.toml @@ -22,7 +22,7 @@ extension-trait = "1.0.1" itertools = "0.10" libc = "0.2" llvm-extra-sys = { path = "../llvm-extra-sys" } -llvm-sys = "150.0.3" +llvm-sys = "170.0.1" log = "0.4.14" move-binary-format = { path = "../../move-binary-format" } move-bytecode-source-map = { path = "../../move-ir-compiler/move-bytecode-source-map" } diff --git a/language/tools/move-mv-llvm-compiler/Cargo.toml b/language/tools/move-mv-llvm-compiler/Cargo.toml index 823b435ab1..5070a33955 100644 --- a/language/tools/move-mv-llvm-compiler/Cargo.toml +++ b/language/tools/move-mv-llvm-compiler/Cargo.toml @@ -38,7 +38,7 @@ move-to-solana = { path = "../../solana/move-to-solana" } clap = { version = "3.1.8", features = ["derive"] } #inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm14-0"] } semver = "1.0.13" -llvm-sys = "150.0.3" +llvm-sys = "170.0.1" llvm-extra-sys = { path = "../../solana/llvm-extra-sys" } extension-trait = "1.0.1" num = "0.4.0" diff --git a/language/tools/move-mv-llvm-compiler/docs/Administration.md b/language/tools/move-mv-llvm-compiler/docs/Administration.md index 1437dea8d8..44c7ae936a 100644 --- a/language/tools/move-mv-llvm-compiler/docs/Administration.md +++ b/language/tools/move-mv-llvm-compiler/docs/Administration.md @@ -27,3 +27,20 @@ to link issue with their PR. [Frequently] Visit relevant move-language, sui, and aptos discord channels. [As needed] Update solana-labs/#proj-move of major updates. + +## Migration +### Toolchain migration to keep up with solana platform tools and move-dev tools +1. Update toolchain versions in scripts/acquire_solana_tools.sh, .github/actions/acquire-solana-tools/action.yml +1. Update LLVM_SYS_{VER}_PREFIX to the correct version +1. Update the versions in documents +1. Fix all build errors +1. Fix all tests +1. Announce in discord + +### Upgrading llvm-sys +1. Create a github issue to track the progress +1. `grep` for all llvm-sys deps and migrate all of them at once (e.g. Cargo.lock files) +1. Fix build errors +1. Update the documentation +1. Update the ci scripts +1. Announce in discord diff --git a/language/tools/move-mv-llvm-compiler/docs/Development.md b/language/tools/move-mv-llvm-compiler/docs/Development.md index e2a2593faa..dfbeafc70a 100644 --- a/language/tools/move-mv-llvm-compiler/docs/Development.md +++ b/language/tools/move-mv-llvm-compiler/docs/Development.md @@ -19,15 +19,15 @@ First, follow the setup instructions for the [move-language/move](https://github Testing requires an installation of the Solana [platform-tools](https://github.com/solana-labs/platform-tools). Platform-tools releases provide a build of llvm (packaged as move-dev tools) that supports the Solana variant of eBPF. Known working revision: -- platform-tools: version `1.39` -- move-dev: version `1.39` +- platform-tools: version `1.41` +- move-dev: version `1.41` `platform-tools` can be extracted from the binary release. Export two environment variables: - `PLATFORM_TOOLS_ROOT` - the path at which `platform-tools` was extracted -- `LLVM_SYS_150_PREFIX` - the path at which `move-dev` tools was extracted (as it has llvm binaries, including llvm-config that llvm-sys can use) +- `LLVM_SYS_170_PREFIX` - the path at which `move-dev` tools was extracted (as it has llvm binaries, including llvm-config that llvm-sys can use) ### After a toolchain update @@ -45,25 +45,25 @@ rustup toolchain install 1.69.0 $ cd /path/to/platform-tools/releases/ # For OSX download (platform-tools-osx-x86_64.tar.bz2, move-dev-osx-x86_64.tar.bz2) for X86, or (move-dev-osx-x86_64.tar.bz2, move-dev-osx-aarch64.tar.bz2) for arm64 devices. -$ wget https://github.com/solana-labs/platform-tools/releases/download/v1.39/move-dev-linux-x86_64.tar.bz2 -$ mkdir v1.39 && cd v1.39 +$ wget https://github.com/solana-labs/platform-tools/releases/download/v1.41/move-dev-linux-x86_64.tar.bz2 +$ mkdir v1.41 && cd v1.41 $ tar -xf ../platform-tools-linux-x86_64.tar.bz2 -$ ls /path/to/platform-tools/releases/v1.39/move-dev +$ ls /path/to/platform-tools/releases/v1.41/move-dev bin include lib -$ wget https://github.com/solana-labs/platform-tools/releases/download/v1.39/platform-tools-linux-x86_64.tar.bz2 +$ wget https://github.com/solana-labs/platform-tools/releases/download/v1.41/platform-tools-linux-x86_64.tar.bz2 $ tar -xf platform-tools-linux-x86_64.tar.bz2 -$ ls /path/to/platform-tools/releases/v1.39/platform-tools +$ ls /path/to/platform-tools/releases/v1.41/platform-tools llvm rust version.md -$ export PLATFORM_TOOLS_ROOT=/path/to/platform-tools/releases/v1.39/platform-tools -$ LLVM_SYS_150_PREFIX=/path/to/platform-tools/releases/v1.39/move-dev +$ export PLATFORM_TOOLS_ROOT=/path/to/platform-tools/releases/v1.41/platform-tools +$ LLVM_SYS_170_PREFIX=/path/to/platform-tools/releases/v1.41/move-dev ``` ## Building ```sh -# export LLVM_SYS_150_PREFIX (See Instructions to get move-dev tools) +# export LLVM_SYS_170_PREFIX (See Instructions to get move-dev tools) # export PLATFORM_TOOLS_ROOT (See Instructions to get solana-labs/platform-tools) -cargo build -p move-ir-compiler -p move-compiler -p move-stdlib +cargo build -p move-mv-llvm-compiler -p move-ir-compiler -p move-compiler -p move-stdlib -p move-cli ``` ## Testing @@ -80,7 +80,7 @@ These test require the `move-ir-compiler` and `move-build` tools (See: [Build in Run the tests with any of these commands: ```sh -# export LLVM_SYS_150_PREFIX (See Instructions to build solana-labs/llvm-project) +# export LLVM_SYS_170_PREFIX (See Instructions to build solana-labs/llvm-project) # export PLATFORM_TOOLS_ROOT (See Instructions to get solana-labs/platform-tools) cargo test -p move-mv-llvm-compiler --test ir-tests cargo test -p move-mv-llvm-compiler --test move-ir-tests @@ -111,7 +111,7 @@ locally if you make changes to move-stdlib for example. - `move-unit-test-framework-tests-solana` - Solana-based move unit test framework tests ```sh -# export LLVM_SYS_150_PREFIX (See Instructions to build solana-labs/llvm-project) +# export LLVM_SYS_170_PREFIX (See Instructions to build solana-labs/llvm-project) # export PLATFORM_TOOLS_ROOT (See Instructions to get solana-labs/platform-tools) # export MOVE_NATIVE=/path/to/move-repo/language/move-native cargo test --features solana-backend -p move-cli --test build_testsuite_solana --test move_unit_tests_solana -- --test-threads 1 @@ -193,7 +193,7 @@ To debug in VS Code add this config: "RUST_BACKTRACE": "all", "RUST_LOG": "debug", "CARGO_MANIFEST_DIR": "something like /home/sol/work/git/move/language/tools/move-mv-llvm-compiler", - "LLVM_SYS_150_PREFIX": "something like /home/sol/work/git/platform-tools/out/rust/build/x86_64-unknown-linux-gnu/llvm", + "LLVM_SYS_170_PREFIX": "something like /home/sol/work/git/platform-tools/out/rust/build/x86_64-unknown-linux-gnu/llvm", "PLATFORM_TOOLS_ROOT": "something like /home/sol/work/git/platform-tools/out/deploy" }, "program": "something like /home/sol/work/git/move/target/debug/deps/dwarf_tests-XXXXXXXXXXXXXXXX", diff --git a/scripts/acquire_solana_tools.sh b/scripts/acquire_solana_tools.sh index 0a521eac24..ffcade0fc8 100755 --- a/scripts/acquire_solana_tools.sh +++ b/scripts/acquire_solana_tools.sh @@ -8,7 +8,7 @@ export MOVE_DEV_PATH export PLATFORM_TOOLS_PATH # platform tools version -version=v1.39 +version=v1.41 # check os and arch OS=$(uname -s)