Skip to content

Commit

Permalink
[gccjit] fix build problems on llvm-18 and add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancern committed Oct 22, 2024
1 parent 8c4725b commit 20e94d6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install build tools and libraries
run: |
sudo apt-get update
sudo apt-get install -y gcc-14 g++-14 cmake ninja-build llvm-18-dev libmlir-18-dev libgccjit-14-dev
- name: Build
run: |
cmake -B build -G Ninja -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 .
cmake --build build
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ In general you need the following tools and libraries to build `mlir-gccjit`:
- A working C++ compiler toolchain that supports C++20 standard.
- [CMake] with minimum version 3.22.
- [Ninja] build system (recommended but not mandatory).
- [LLVM] libraries and development files.
- [MLIR] libraries and development files.
- [libgccjit] libraries and development files.
- [LLVM] libraries and development files. For now we have only tested LLVM-18.
- [MLIR] libraries and development files. For now we have only tested MLIR-18.
- [libgccjit] libraries and development files. For now we have only tested
libgccjit-14.

[CMake]: https://cmake.org/
[Ninja]: https://ninja-build.org/
Expand All @@ -22,7 +23,7 @@ In general you need the following tools and libraries to build `mlir-gccjit`:
For Ubuntu 24.04 (noble) users:

```bash
apt-get install build-essential cmake ninja-build llvm-18-dev libmlir-18-dev libgccjit-13-dev
apt-get install build-essential cmake ninja-build llvm-18-dev libmlir-18-dev libgccjit-14-dev
```

## Build
Expand Down
1 change: 0 additions & 1 deletion src/GCCJITOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "mlir/Support/LLVM.h"
#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/LogicalResult.h"

using namespace mlir;
using namespace mlir::gccjit;
Expand Down
9 changes: 4 additions & 5 deletions src/Translation/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/LogicalResult.h"
#include "llvm/Support/MemoryBuffer.h"

namespace mlir::gccjit {
Expand All @@ -38,15 +37,15 @@ dumpContextToTempfile(gcc_jit_context *ctxt, bool reproducer) {
return file;
}

llvm::LogicalResult copyFileToStream(llvm::sys::fs::TempFile file,
llvm::raw_ostream &os) {
LogicalResult copyFileToStream(llvm::sys::fs::TempFile file,
llvm::raw_ostream &os) {
os.flush();
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer =
llvm::MemoryBuffer::getFile(file.TmpName);
if (!buffer)
return mlir::failure();
return failure();
os << buffer.get()->getBuffer();
return mlir::success();
return success();
}

void registerTranslation(llvm::StringRef name, llvm::StringRef desc,
Expand Down

0 comments on commit 20e94d6

Please sign in to comment.