How to set LLVM path variables for a Rust project?

Viewed 767

I saw this talk on YouTube about native NodeJS modules in Rust and I was inspired to try it out. The process until the Neon-based "Hello, World!" is really smooth - no issues there.

I want to try out the llvm-sys crate to have access to LLVM codegen but the build fails.

I notice that the reason is path variables, but I'd like to source them from the local pre-compiled LLVM files copied over from the homebrew Cellar.

Here's my directory structure

lumos_vm git/master*
❯ tree -L 1

.
├── ProgressLog.md
├── ReadMe.md
├── llvm_4.0.0
└── lumos_1

2 directories, 2 files

And here's the stacktrace after running npm install

lumos_vm/lumos_1 git/master*
❯ npm install

> lumos_1@0.1.0 install /Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1
> neon build

neon info running cargo
   Compiling lazy_static v0.2.8
   Compiling utf8-ranges v1.0.0
   Compiling libc v0.2.24
   Compiling semver-parser v0.7.0
   Compiling regex-syntax v0.4.1
   Compiling void v1.0.2
   Compiling unreachable v1.0.0
   Compiling thread_local v0.3.4
   Compiling memchr v1.0.1
   Compiling semver v0.6.0
   Compiling aho-corasick v0.6.3
   Compiling regex v0.2.2
   Compiling llvm-sys v40.0.2
error: failed to run custom build command for `llvm-sys v40.0.2`
process didn't exit successfully: `/Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1/native/target/release/build/llvm-sys-632d8c2c2d97ae93/build-script-build` (exit code: 101)
--- stdout
Didn't find usable system-wide LLVM.
LLVM_SYS_40_PREFIX not set, not using precompiled binaries
LLVM_SYS_40_AUTOBUILD not set, will not automatically compile LLVM

--- stderr
thread 'main' panicked at 'Could not find a compatible version of LLVM', /Users/eklavya/.cargo/registry/src/github.com-1ecc6299db9ec823/llvm-sys-40.0.2/build.rs:14
note: Run with `RUST_BACKTRACE=1` for a backtrace.

neon ERR! cargo build failed

Error: cargo build failed
    at Target.<anonymous> (/Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1/node_modules/neon-cli/dist/neon-cli/target.js:124:35)
    at step (/Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1/node_modules/neon-cli/dist/neon-cli/target.js:32:23)
    at Object.next (/Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1/node_modules/neon-cli/dist/neon-cli/target.js:13:53)
    at fulfilled (/Users/eklavya/Projects/bitworld/ClojureScript/lumos_vm/lumos_1/node_modules/neon-cli/dist/neon-cli/target.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
npm WARN lumos_1@0.1.0 No repository field.

up to date in 26.123s

lumos_vm/lumos_1 git/master*  27s
❯
0 Answers
Related