j8r / dockerfiles

Repository for my dockerfiles
https://hub.docker.com/u/jrei
ISC License
123 stars 46 forks source link

LLVM Error #7

Closed iambudi closed 4 years ago

iambudi commented 4 years ago

Got this error when compiling.

Status: Downloaded newer image for jrei/crystal-alpine:latest Showing last frame. Use --error-trace for full trace.

In /usr/lib/crystal/core/llvm/lib_llvm.cr:4:19

4 | `[ -n "$LLVM_CONFIG" ] && command -v "$LLVM_CONFIG" || \ ^ Error: error executing command: [ -n "$LLVM_CONFIG" ] && command -v "$LLVM_CONFIG" || command -v llvm-config-8 || command -v llvm-config-8.0 || command -v llvm-config80 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 8.0) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-7 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 7.1) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-7.0 || command -v llvm-config70 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 7.0) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-6.0 || command -v llvm-config60 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 6.0) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-5.0 || command -v llvm-config50 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 5.0) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-4.0 || command -v llvm-config40 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 4.0) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-3.9 || command -v llvm-config39 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.9) command -v llvm-config;; ) false;; esac)) || command -v llvm-config-3.8 || command -v llvm-config38 || (command -v llvm-config > /dev/null && (case "$(llvm-config --version)" in 3.8) command -v llvm-config;; ) false;; esac)) || command -v llvm-config

              , got exit status 127
iambudi commented 4 years ago

I forgot to mention, i used docker file version latest and 0.31.1

j8r commented 4 years ago

When compiling the compiler? LLVM_CONFIG has to be exported, export LLVM_CONFIG=llvm8-config. Will be fixed with https://github.com/crystal-lang/crystal/pull/8605

j8r commented 4 years ago

I will switch to LLVM9, which seems to be supported in Crystal and has the llvm-config command.

waghanza commented 4 years ago

Hi @j8r,

The actual version of llvm used in crystal is 5.0.2, even llvm9 package is installed

Sending build context to Docker daemon  7.168kB
Step 1/1 : FROM jrei/crystal-alpine:0.31.1
 ---> 5ff611c7a7bd
Successfully built 5ff611c7a7bd
Successfully tagged test:latest
/ # crystal -v
Crystal 0.31.1 (2019-12-04)

LLVM: 5.0.2
Default target: x86_64-alpine-linux-musl
j8r commented 4 years ago

Yes, it's normal, see https://gitlab.alpinelinux.org/alpine/aports/issues/11017. What crystal --version show is the LLVM version used to compile the compiler. When your Crystal program is compiled, it will use LLVM9. The main use case was to have llvm-config. I can optimize the image to use LLVM5, and remove LLVM9, to avoid having both llvm5-libs and llvm9-libs versions.