Skip to content

phodal/rust-llvm-practises

Repository files navigation

Rust LLVM Practise

├── helloworld   // hello, world demo
└── stdlib       // Rust call c libs demo

Setup

  1. Rust 1.39+ + LLVM 10.0
  2. use llvmenv to Manage multiple LLVM/Clang builds
  3. Rust LLVM wrapper use inkwell
  4. generated LLVM IR code see in main.ll

Install LLVM

brew install cmake ninja

Homebrew 11

brew install llvm

remote

cargo install llvmenv

usage

llvmenv init
llvmenv entries
local-llvm 10.0.0

about 1.5 hours in my MBP 2018

local

Add local llvm for build to: `$XDG_CONFIG_HOME/llvmenv/entry.toml

docs: https://docs.rs/llvmenv/0.3.0/llvmenv/entry/index.html

[local-llvm]
path = "/path/to/your/src"
target = ["X86"]
```

**build**

```
llvmenv build-entry local-llvm
```

### run & build

```
LLVM_SYS_101_PREFIX=$HOME/llvm/llvm-10.0.1.src/build cargo build
LLVM_SYS_101_PREFIX=$HOME/llvm/llvm-10.0.1.src/build cargo run

About

Rust LLVM Practises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published