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

Dav*_*ani 7 haskell readline

我指的是c读取线库haskell readline库包装器.

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
Run Code Online (Sandbox Code Playgroud)

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

acf*_*zer 21

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

cabal install readline --extra-include-dirs=/opt/local/include \
--extra-lib-dirs=/opt/local/lib
Run Code Online (Sandbox Code Playgroud)

更新2x:在我的机器上通过Homebrew而不是MacPorts安装GNU Readline,看起来configureHaskell 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
Run Code Online (Sandbox Code Playgroud)

  • readline公式只是keg,因此我必须像这样添加keg的完整路径:`cabal install readline --extra-include-dirs =/usr/local/Cellar/readline/6.2.4/include/--extra -lib-dirs =/usr/local/Cellar/readline/6.2.4/lib/--configure-option = - with-readline-includes =/usr/local/Cellar/readline/6.2.4/include/ - -configure选项= - 与-readline的文库=的/ usr /本地/地窖/ readline的/ 6.2.4/LIB /` (9认同)
  • 谢谢,我得到了它的工作.我使用命令:`sudo port install readline + universal`来安装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`来安装haskell readline库. (3认同)