如何在Mac OSX上安装haskell readline库?

时间:2011-11-28 03:17:24

标签: haskell readline

我指的是haskell readline library wrapperc readline library

cabal install readline输出如下:

$ cabal install readline
Resolving dependencies...
Configuring readline-1.0.1.0...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for GNUreadline.framework... checking for readline... no
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for rl_readline_version... yes
checking for rl_begin_undo_group... no
configure: error: readline not found, so this package cannot be built
See `config.log' for more details.
cabal: Error: some packages failed to install:
readline-1.0.1.0 failed during the configure step. The exception was:
ExitFailure 1

我通过macports安装了c readline库(使用sudo port install readline),但在尝试安装haskell readline库时仍然遇到同样的错误。

3 个答案:

答案 0 :(得分:21)

如果您的MacPorts安装使用已安装文件的默认路径,请尝试指定查找C标头和库的位置:

cabal install readline --extra-include-dirs=/opt/local/include \
--extra-lib-dirs=/opt/local/lib

更新2x :在我的机器上通过Homebrew而不是MacPorts安装了GNU Readline,看起来Haskell configure库的readline脚本需要一些非标准的标志,以正确找到它的轴承。如果上述方法无效,请尝试以下方法:

cabal install readline --extra-include-dirs=/opt/local/include \
--extra-lib-dirs=/opt/local/lib \
--configure-option=--with-readline-includes=/opt/local/include \
--configure-option=--with-readline-libraries=/opt/local/lib

答案 1 :(得分:1)

我最后按照http://fp.okeefecreations.com/2010/08/installing-haskell-bindings-to-readline.html的说明操作,以便让我的自制软件安装readline。我必须做的唯一修改是调整路径中列出的readline的版本。

我知道这是一个类似于acfoltzer的解决方案,但我没有代表在那里添加评论或者我无法弄清楚如何发表评论。 :)

答案 2 :(得分:0)

如果您使用的是brew,则可以使用与上面非常相似的命令,并且您必须用系统上的那个版本替换我声明的版本,即7.0.5

cabal install readline --extra-include-dirs=/usr/local/Cellar/readline/7.0.5/include --extra-lib-dirs=/usr/local/Cellar/readline/7.0.5/lib --configure-option=--with-readline-includes=/usr/local/Cellar/readline/7.0.5/include --configure-option=--with-readline-libraries=/usr/local/Cellar/readline/7.0.5/lib