Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
* need zig v0.12.0 or master
* LLVM 17
  • Loading branch information
kassane committed Dec 12, 2023
1 parent 3527843 commit d328c51
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/zigbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ jobs:
runs-on: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2
with:
version: master

- name: Install LLVM (Linux)
if: startsWith(matrix.runs-on, 'ubuntu')
run: |
sudo apt update
sudo apt install -y wget
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt update
sudo apt install -y llvm-16
sudo apt install -y llvm-17
- name: Install LLVM (MacOS)
if: startsWith(matrix.runs-on, 'macos')
Expand Down
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn buildExample(b: *std.Build, i: BuildInfo) void {
exe.addModule("llvm", b.modules.get("llvm").?);
exe.linkSystemLibrary("z");
switch (i.target.getOsTag()) {
.linux => exe.linkSystemLibrary("LLVM-16"), // Ubuntu
.linux => exe.linkSystemLibrary("LLVM-17"), // Ubuntu
.macos => {
exe.addLibraryPath(.{ .path = "/usr/local/opt/llvm/lib" });
exe.linkSystemLibrary("LLVM");
Expand Down
4 changes: 2 additions & 2 deletions examples/fatorial_module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub fn main() void {
defer core.LLVMShutdown();

// Create a new LLVM module
var module: types.LLVMModuleRef = core.LLVMModuleCreateWithName("factorial_module");
var builder: types.LLVMBuilderRef = core.LLVMCreateBuilder();
const module: types.LLVMModuleRef = core.LLVMModuleCreateWithName("factorial_module");
const builder: types.LLVMBuilderRef = core.LLVMCreateBuilder();

// Create the factorial function
const returnType: types.LLVMTypeRef = core.LLVMInt32Type();
Expand Down
2 changes: 1 addition & 1 deletion examples/sum_module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn main() void {
_ = target.LLVMInitializeNativeAsmParser();

// Create a new LLVM module
var module: types.LLVMModuleRef = core.LLVMModuleCreateWithName("sum_module");
const module: types.LLVMModuleRef = core.LLVMModuleCreateWithName("sum_module");
var params: [2]types.LLVMTypeRef = [_]types.LLVMTypeRef{
core.LLVMInt32Type(),
core.LLVMInt32Type(),
Expand Down

0 comments on commit d328c51

Please sign in to comment.