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

Upgrade to llvm 16 #509

Merged
merged 5 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 20 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -30,23 +30,36 @@ jobs:
- name: Set up the Linux env
run: |
set -eux
sudo apt install -y llvm-15 clang-15 libgc-dev
if: matrix.os == 'ubuntu-latest'
sudo apt install -y libgc-dev

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
./llvm
key: llvm-16.0
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "16.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Output versions
run: |
set -eux
rustc --version
cargo --version
clang-15 --version
clang --version

- name: Build and test
run: |
set -eux
cd lib/skc_rustlib; cargo build; cd ../../
env -- LLC=llc-15 CLANG=clang-15 cargo run -- build-corelib
env -- LLC=llc-15 CLANG=clang-15 cargo test
env -- LLC=llc-15 CLANG=clang-15 bash release_test.sh
env -- cargo run -- build-corelib
env -- cargo test
env -- bash release_test.sh

# Run cargo fmt --all -- --check
format:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ skc_codegen = { path = "lib/skc_codegen/" }

ariadne = "0.1.5"
anyhow = "1.0"
inkwell = { git = "https://github.com/TheDan64/inkwell", features = ["llvm15-0"], rev = "4030f76" }
inkwell = { git = "https://github.com/TheDan64/inkwell", features = ["llvm16-0"], rev = "4030f76" }
clap = { version = "3.1.18", features = ["derive"] }
either = "1.5.3"
env_logger = "0.8.2"
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ See [install.md](./doc/guide/src/install.md)
$ cargo test
```

Only integration tests (test/sk/*.sk):
Only integration tests (test/sk/\*.sk):

```
$ cargo test --test integration_test
Expand All @@ -128,15 +128,6 @@ With logging enabled
$ RUST_LOG='trace' cargo test
```

### Troubleshooting

```
/Users/yhara/.cargo/registry/src/github.com-1ecc6299db9ec823/bdwgc-alloc-0.6.0/vendor/libatomic_ops/configure: line 4683: syntax error near unexpected token `disable-shared'
/Users/yhara/.cargo/registry/src/github.com-1ecc6299db9ec823/bdwgc-alloc-0.6.0/vendor/libatomic_ops/configure: line 4683: `LT_INIT(disable-shared)'
```

=> `brew install libtool`

## License

MIT
Expand Down
37 changes: 28 additions & 9 deletions doc/guide/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ Only 64bit environments are supported.

1. Install [Git](https://git-scm.com/)
1. Install [Rust](https://www.rust-lang.org/)
1. Install LLVM 12
- eg. `brew install llvm@12` on Mac
- eg. `sudo apt install llvm-12 clang-12` on Ubuntu
1. Install LLVM 16
- eg. `brew install llvm@16` on Mac
- eg. `sudo apt install llvm-16 clang-16` on Ubuntu
- You may need `sudo apt install cmake` on Ubuntu
- (TODO) `apt install libgc-dev` needed on Ubuntu?

You may need to setup some environment variables. For example, on Mac:

```
export PATH="$(brew --prefix)/opt/llvm@12/bin":$PATH
export LDFLAGS="-L$(brew --prefix)/opt/llvm@12/lib"
export CPPFLAGS="-I$(brew --prefix)/opt/llvm@12/include"
export PATH="$(brew --prefix)/opt/llvm@16/bin":$PATH
export LDFLAGS="-L$(brew --prefix)/opt/llvm@16/lib"
export CPPFLAGS="-I$(brew --prefix)/opt/llvm@16/include"
```

and on Ubuntu:

```
export LLC=llc-12
export CLANG=clang-12
export LLC=llc-16
export CLANG=clang-16
```

### Compiling core library
Expand All @@ -40,7 +40,7 @@ $ cd lib/skc_rustlib; cargo build; cd ../../
$ cargo run -- build-corelib
```

The `build-corelib` subcommand compiles core classes (builtin/*.sk) into ./builtin/builtin.bc and ./builtin/exports.json.
The `build-corelib` subcommand compiles core classes (builtin/\*.sk) into ./builtin/builtin.bc and ./builtin/exports.json.

### Running a program

Expand Down Expand Up @@ -73,3 +73,22 @@ because `shiika` looks for corelib in the current directory by default. You can
```
export SHIIKA_ROOT=/path/to/repo/of/shiika
```

## Troubleshooting

```
error: could not find native static library `Polly`, perhaps an -L flag is missing?

error: could not compile `llvm-sys` due to previous error
```

=> `sudo apt install libpolly-16-dev`

This may happen when you install llvm from https://apt.llvm.org/ .

```
/Users/yhara/.cargo/registry/src/github.com-1ecc6299db9ec823/bdwgc-alloc-0.6.0/vendor/libatomic_ops/configure: line 4683: syntax error near unexpected token `disable-shared'
/Users/yhara/.cargo/registry/src/github.com-1ecc6299db9ec823/bdwgc-alloc-0.6.0/vendor/libatomic_ops/configure: line 4683: `LT_INIT(disable-shared)'
```

=> `brew install libtool`
2 changes: 1 addition & 1 deletion lib/skc_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ skc_mir = { path = "../skc_mir" }
anyhow = "1.0"
serde = { version = "1.0.125", features = ["derive"] }
serde_json = "1.0"
inkwell = { git = "https://github.com/TheDan64/inkwell", features = ["llvm15-0"], rev = "4030f76" }
inkwell = { git = "https://github.com/TheDan64/inkwell", features = ["llvm16-0"], rev = "4030f76" }
either = "1.5.3"
log = "0.4.11"
Loading