TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Failed to run custom build commads for `llvm-sys v150.0.5` #405

Closed ASoldo closed 1 year ago

ASoldo commented 1 year ago

Describe the Bug I have started to explore how to make a programming language using Rust. I have created interpreter and parser and it works great. I've tried to use inkwell to compile my script with llvm. Compiler seems to be with no errors but when I try to cargo build or cargo run I encounter a problem. When I try to compile my project within Rust I get this error message:

cargo build                                                                                                                                                                                              ✔  system      00:42:39   
   Compiling llvm-sys v150.0.5
error: failed to run custom build command for `llvm-sys v150.0.5`

Caused by:
  process didn't exit successfully: `/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/llvm-sys-e5e862a1c4a2dab9/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LLVM_SYS_150_PREFIX
  cargo:rerun-if-changed=/usr
  cargo:rerun-if-env-changed=LLVM_SYS_150_IGNORE_BLOCKLIST
  cargo:rerun-if-env-changed=LLVM_SYS_150_STRICT_VERSIONING
  cargo:rerun-if-env-changed=LLVM_SYS_150_NO_CLEAN_CFLAGS
  cargo:rerun-if-env-changed=LLVM_SYS_150_USE_DEBUG_MSVCRT
  cargo:rerun-if-env-changed=LLVM_SYS_150_FFI_WORKAROUND
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = Some("-I/usr/include  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS ")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I/usr/include" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/ll
vm-sys-2d8b24c59a5937cf/out/wrappers/target.o" "-c" "wrappers/target.c"
  exit status: 0
  cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
  AR_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
  AR_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
  ARFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
  ARFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  running: ZERO_AR_DATE="1" "ar" "cq" "/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/llvm-sys-2d8b24c59a5937cf/out/libtargetwrappers.a" "/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/llvm-sys-2d8b24c59a5937cf/out/wrappers/target.o"
  exit status: 0
  running: "ar" "s" "/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/llvm-sys-2d8b24c59a5937cf/out/libtargetwrappers.a"
  exit status: 0
  cargo:rustc-link-lib=static=targetwrappers
  cargo:rustc-link-search=native=/home/rootster/Documents/rust-dojo/prime-lang/target/debug/build/llvm-sys-2d8b24c59a5937cf/out
  cargo:config_path=/usr/bin/llvm-config
  cargo:libdir=/usr/lib

  cargo:rustc-link-search=native=/usr/lib

  --- stderr
  thread 'main' panicked at 'Surprising failure from llvm-config: Custom { kind: NotFound, error: "llvm-config returned empty output" }', /home/rootster/.cargo/registry/src/github.com-1ecc6299db9ec823/llvm-sys-150.0.5/build.rs:203:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I know it's much to ask but maybe I've made some rookie mistake and someone can spot that. Thank you!

To Reproduce Please provide a simple sample of code which reproduces the issue on your machine.

Expected Behavior A clear and concise description of what you expected to happen.

LLVM Version (please complete the following information):

Desktop (please complete the following information):

Additional Context Add any other context about the problem here.

ASoldo commented 1 year ago

This issue was solved by healdove in gitter channel. Since I use Arch Linux LLVM was not complete and that's why I had this error.

in order to solve it, healdove provided me with this link ---> https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.0 i had to extract this file and put it somewhere safe like in my ~ location in llvm folder. then in my .zshrc I have exported usual variables for

export LLVM_SYS_150_PREFIX=~/llvm/clang+llvm-15.0.0-x86_64-linux-gnu-rhel-8.4

export LLVM_CONFIG_PATH=/usr/bin/llvm-config

and it worked. thank you healdove for quick help and explanations. gg