7

我已经安装了 LLVM/opt-3.2 和llvm-3.2.0.2,我刚刚从 Ubuntu 包中安装了 GHC 7.6.2。但是,当我尝试使用 -fllvm -v3 编译 ghc 时,出现错误:

*** CodeGen:
*** LlVM CodeGen:
Error (figuring out LLVM version): fd:10: hGetLine: end of file

<no location info>:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM
*** LLVM Optimiser:
'opt-3.0' '/tmp/ghc17812_0/ghc17812_0.ll' '-o' '/tmp/ghc17812_0/ghc17812_0.bc' '-mem2reg' '--enable-tbaa=true'
*** Deleting temp files:
...
ghc: could not execute: opt-3.0

opt在我的路径中,但版本是 3.2,而不是 3.0。如果不是 hackage llvm 包使 GHC 寻找正确版本的 opt,它是什么?

4

2 回答 2

6

只是想评论这仍然是一件事。OSX 使用说明:

> brew tap homebrew/dupes
> brew install homebrew/versions/llvm34

并在我的.bashrc:

alias ghc-llvm="ghc -O2 -fllvm -pgmlo opt-3.4 -pgmlc llc-3.4"

确保你得到llvm34不是 llvm35. 我还发现你真的想用 LLVM 传递 -O2 。没有它非常慢。

于 2014-12-02T21:51:23.330 回答
5

似乎有两个相关的 ghc-trac:

在后面的跟踪中,用户提到了选项“-pgmlo”和“-pgmlc”,可以在此处找到。

通过将“-pgmlo opt -pgmlc llc”添加到 GHC 选项列表中,我能够解决我的问题。

作为替代方案,您可以编辑/usr/lib/ghc/settings并确保它具有以下几行:

("LLVM llc command", "llc"),
("LLVM opt command", "opt")

我仍然想知道为什么 GHC 默认会尝试查找 opt-3.0。

于 2013-10-13T15:30:27.453 回答