llvm-hs / llvm-hs/llvm-hs-examples

`stack exec basic` won't work after following llvm-hs installation

Open
#12 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
72
Forks
19
PR merge metrics
No merged PRs in 30d

Description

## What I wanted

Install LLVM-9 and test it.

## What I did

- Ran `brew install llvm-hs/llvm/llvm-9`

- Ran `stack exec basic`

- Ran `stack build`

## What I expected

- LLVM to be installed

- Example running

## What it did

- LLVM binaries installed under the name `llvm-...-9` instead of just `llvm-....`
- `stack exec basic` failed because it couldnt find the binary `basic`
- `stack build` failed with a compilation error

# Insight

Hi ! Sorry to bother, it's probably a mistake from my part but I don't find any documentation about this issue.

I followed llvm-hs install directions for mac OS (`brew install llvm-hs/llvm/llvm-9`). It installed a bunch of binaries such as `llvm-...-9`.

First of all, I don't have any `llvm-config` as you asked in the README. However, I do have a `llvm-config-9`. When I run it, it prints `9.0.0`. Is that an issue I should be aware of ? (if you feel that I asked on the wrong repository, don't bother with this issue).

Second of all, I ran `stack exec basic`. After a lot of installation, it printed me this error :

```
Executable named basic not found on path: ["/Users/skaas/tek3/llvm-hs-examples/.stack-work/install/x86_64-osx/d9d41a784075cf372862fbb26cc4c250326d7cca4e792a350578331a3c35bb78/8.6.5/bin","/Users/skaas/.stack/snapshots/x86_64-osx/d9d41a784075cf372862fbb26cc4c250326d7cca4e792a350578331a3c35bb78/8.6.5/bin","/Users/skaas/.stack/compiler-tools/x86_64-osx/ghc-8.6.5/bin","/Users/skaas/.sta
ck/programs/x86_64-osx/ghc-8.6.5/bin","/usr/local/bin","/Users/skaas/installer/flutter/bin","/usr/bin","/Users/skaas/installer/flutter/bin","/bin","/Users/skaas/installer/flutter/bin","/us
r/sbin","/Users/skaas/installer/flutter/bin","/sbin","/Users/skaas/installer/flutter/bin"]
```
I suppose I have to `stack build` even if it's now written in the README but when I do it, it gives me this error :

```
llvm-hs > [ 93 of 114] Compiling LLVM.Internal.OrcJIT.LinkingLayer
llvm-hs > [ 94 of 114] Compiling LLVM.OrcJIT.LinkingLayer
llvm-hs > [ 95 of 114] Compiling LLVM.Internal.Linking
llvm-hs > [ 96 of 114] Compiling LLVM.Linking
llvm-hs > [ 97 of 114] Compiling LLVM.Internal.Module
llvm-hs > [ 98 of 114] Compiling LLVM.Module
llvm-hs > [ 99 of 114] Compiling LLVM
llvm-hs > [100 of 114] Compiling LLVM.Internal.OrcJIT.CompileLayer
llvm-hs > [101 of 114] Compiling LLVM.OrcJIT.CompileLayer
llvm-hs > [102 of 114] Compiling LLVM.Internal.OrcJIT.IRTransformLayer
llvm-hs > [103 of 114] Compiling LLVM.Internal.OrcJIT.IRCompileLayer
llvm-hs > [104 of 114] Compiling LLVM.Internal.OrcJIT.CompileOnDemandLayer
llvm-hs > [105 of 114] Compiling LLVM.OrcJIT
llvm-hs > [106 of 114] Compiling LLVM.Internal.Analysis
llvm-hs > [107 of 114] Compiling LLVM.Analysis
llvm-hs > [108 of 114] Compiling LLVM.Internal.ExecutionEngine
llvm-hs > [109 of 114] Compiling LLVM.ExecutionEngine
llvm-hs > [110 of 114] Compiling LLVM.Threading
llvm-hs > [111 of 114] Compiling LLVM.Transforms
llvm-hs > [112 of 114] Compiling LLVM.Internal.FFI.PassManager
llvm-hs > [113 of 114] Compiling LLVM.Internal.PassManager
llvm-hs > [114 of 114] Compiling LLVM.PassManager
llvm-hs >
llvm-hs > /private/var/folders/qk/_jpn3vwx4674p04cbtgf3k4m0000gn/T/stack7306/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:69: error:
llvm-hs > error: non-constant-expression cannot be narrowed from type 'LLVMBool' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
llvm-hs > unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > ^~~~~~~
llvm-hs > |
llvm-hs > 159 | unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > | ^
llvm-hs >
llvm-hs > /private/var/folders/qk/_jpn3vwx4674p04cbtgf3k4m0000gn/T/stack7306/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:69: error:
llvm-hs > note: insert an explicit cast to silence this issue
llvm-hs > unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > ^~~~~~~
llvm-hs > static_cast( )
llvm-hs > |
llvm-hs > 159 | unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > | ^
llvm-hs >
llvm-hs > /private/var/folders/qk/_jpn3vwx4674p04cbtgf3k4m0000gn/T/stack7306/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:78: error:
llvm-hs > error: non-constant-expression cannot be narrowed from type 'LLVMBool' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
llvm-hs > unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > ^~~~~~
llvm-hs > |
llvm-hs > 159 | unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > | ^
llvm-hs >
llvm-hs > /private/var/folders/qk/_jpn3vwx4674p04cbtgf3k4m0000gn/T/stack7306/llvm-hs-9.0.0/src/LLVM/Internal/FFI/PassManagerC.cpp:159:78: error:
llvm-hs > note: insert an explicit cast to silence this issue
llvm-hs > unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > ^~~~~~
llvm-hs > static_cast( )
llvm-hs > |
llvm-hs > 159 | unwrap(PM)->add(createMemorySanitizerLegacyPassPass({trackOrigins, recover, kernel}));
llvm-hs > | ^
llvm-hs > 2 errors generated.
llvm-hs > `gcc' failed in phase `C Compiler'. (Exit code: 1)

-- While building package llvm-hs-9.0.0 using:
/private/var/folders/qk/_jpn3vwx4674p04cbtgf3k4m0000gn/T/stack7306/llvm-hs-9.0.0/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Progress 30/31
```

I never met this issue before and I don't understand where installation could have failed, I literally just ran `brew install`.

Do you have any idea of what could be wrong ? Should I post the issue on the llvm-hs repository ?

Thank for your attention.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README's macOS installation instructions and reproduce the reported `brew install` and `stack build` steps. Inspect the `LLVM/Internal/FFI/PassManagerC.cpp` location named in the compiler output and verify whether the `llvm-config-9` naming or the C++ narrowing errors causes the failure. Done means the installation and example workflow are either working or the README documents the required compatibility steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.