hash-org / hashc

The Hash programming language compiler :zap:
https://hash-org.github.io/hashc/
MIT License
26 stars 2 forks source link

compiler: unable to build the compiler because of llvm #825

Open 0xMRTT opened 1 year ago

0xMRTT commented 1 year ago

BUILD Error (compiler)

❯ LLVM_SYS_15_PREFIX=/usr/include/llvm-c/ cargo run
   Compiling hash-intrinsics v0.1.0 (/home/user/hash-lang/compiler/hash-intrinsics)
   Compiling llvm-sys v150.0.3
   Compiling hash-token v0.1.0 (/home/user/hash-lang/compiler/hash-token)
   Compiling profiling-procmacros v1.0.7
error: failed to run custom build command for `llvm-sys v150.0.3`

Caused by:
  process didn't exit successfully: `/home/user/hash-lang/target/debug/build/llvm-sys-9d55976d6726d3bc/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LLVM_SYS_150_PREFIX
  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/user/hash-lang/target/debug/build/llvm-sys-6dd6474dadddf9d4/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/user/hash-lang/target/debug/build/llvm-sys-6dd6474dadddf9d4/out/libtargetwrappers.a" "/home/user/hash-lang/target/debug/build/llvm-sys-6dd6474dadddf9d4/out/wrappers/target.o"
  exit status: 0
  running: "ar" "s" "/home/user/hash-lang/target/debug/build/llvm-sys-6dd6474dadddf9d4/out/libtargetwrappers.a"
  exit status: 0
  cargo:rustc-link-lib=static=targetwrappers
  cargo:rustc-link-search=native=/home/user/hash-lang/target/debug/build/llvm-sys-6dd6474dadddf9d4/out
  cargo:config_path=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/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/llvm-sys-150.0.3/build.rs:203:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

And I ran llvm-config --version:

❯ llvm-config --version
15.0.7
feds01 commented 1 year ago

Hi! Thanks for the report.

Could you provide some additional information about your host system? this looks like an issue with llvm-sys crate which we rely on to hook up with LLVM.

0xMRTT commented 1 year ago

Arch Linux with llvm and llvm-libs installed. I think that the error is with inkwell and when I run llvm-config --system-libs, i get nothing. Which other informations should i provide ?

feds01 commented 1 year ago

I think there is an open issue on llvm-sys crate about compiling it on Arch-like systems: https://gitlab.com/taricorp/llvm-sys.rs/-/issues/42.

It also seems that there is work to fix this issue https://gitlab.com/taricorp/llvm-sys.rs/-/merge_requests/31, hopefully this will get merged soon and we will upgrade on our end.