Skip to content

Commit

Permalink
Build against LLVM 9 on macOS/Azure (#296)
Browse files Browse the repository at this point in the history
* Set LLVM_CONFIG_PATH when building on macOS

* Conditionally install typing package

* Don't run pip install in quiet mode

* Enable shell command tracing in provision_mac.sh

* Disable command tracing in provision_mac.sh

* Print diagnostics for azure pipelines

* Print diagnostics before building c2rust on Darwin

* Provision LLVM 9 on macOS
  • Loading branch information
thedataking authored Sep 15, 2020
1 parent 4062985 commit 514b53b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
34 changes: 12 additions & 22 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,44 +111,34 @@ jobs:
# whereas the brew version does not, this causes curl-sys to
# build its own curl which then fails to link on Azure Devops.
brew remove curl
# prepare environment for the following steps
source $HOME/.cargo/env
brew info llvm@9
displayName: 'Provision macOS'
- script: |
source $HOME/.cargo/env
# Temporary fix to use LLVM 9 due to problems with LLVM 10.0.1
export LLVM_CONFIG_PATH=$(brew --prefix llvm@9)/bin/llvm-config
cargo build --release
displayName: 'Fast build against host clang/LLVM'
- script: |
source $HOME/.cargo/env
python3 ./scripts/test_translator.py ./tests
- script: python3 ./scripts/test_translator.py ./tests
displayName: 'Test translator (fast build)'

- script: |
source $HOME/.cargo/env
cargo clean
- script: cargo clean
displayName: 'Cargo clean'

- script: |
source $HOME/.cargo/env
python3 ./scripts/build_translator.py --with-llvm-version=7.0.1
- script: python3 ./scripts/build_translator.py --with-llvm-version=7.0.1
displayName: 'Developer build against local LLVM 7'

- script: |
source $HOME/.cargo/env
python3 ./scripts/test_translator.py ./tests
- script: python3 ./scripts/test_translator.py ./tests
displayName: 'Test translator against developer build (LLVM 7)'

- script: |
source $HOME/.cargo/env
cargo clean && rm -rf build
- script: cargo clean && rm -rf build
displayName: 'Cargo clean && rm -rf build'

- script: |
source $HOME/.cargo/env
python3 ./scripts/build_translator.py --with-llvm-version=8.0.0
- script: python3 ./scripts/build_translator.py --with-llvm-version=8.0.0
displayName: 'Developer build against local LLVM 8'

- script: |
source $HOME/.cargo/env
python3 ./scripts/test_translator.py ./tests
- script: python3 ./scripts/test_translator.py ./tests
displayName: 'Test translator against developer build (LLVM 8)'
8 changes: 5 additions & 3 deletions scripts/provision_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ done
SCRIPT_DIR="$(dirname "$0")"
export HOMEBREW_NO_AUTO_UPDATE=1

hb_packages=(python cmake ninja gpg ccache llvm)
# NOTE(perl): Due to problems with LLVM 10.0.1 we request LLVM 9 for now
# https://discourse.brew.sh/t/llvm-config-10-0-1-advertise-libxml2-tbd-as-system-libs/8593
hb_packages=(python cmake ninja gpg ccache llvm@9)
for item in "${hb_packages[@]}"; do
brew info "${item}" | grep --quiet 'Not installed' && brew install "${item}"
brew info "${item}" | grep 'Not installed' > /dev/null && brew install "${item}"
done

type -P "pip3" >/dev/null || {
Expand All @@ -30,7 +32,7 @@ type -P "pip3" >/dev/null || {

# Python 3 packages
pip3 install --user --upgrade pip
pip3 install -r "$SCRIPT_DIR/requirements.txt" --user --disable-pip-version-check --quiet
pip3 install -r "$SCRIPT_DIR/requirements.txt" --user --disable-pip-version-check

RUST_TOOLCHAIN_FILE="$SCRIPT_DIR/../rust-toolchain"
export RUST_VER=$(cat $RUST_TOOLCHAIN_FILE | tr -d '\n')
Expand Down
2 changes: 1 addition & 1 deletion scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pip
plumbum >= 1.6.3
psutil
pygments
typing
typing;python_version<"3.5"
scan-build
pyyaml

0 comments on commit 514b53b

Please sign in to comment.