我在Arch,ghc 8.2.1和cabal 2.0上有最新的软件包,尝试使用cabal构建ncurses软件包:
$ cabal configure
Resolving dependencies...
Configuring ncurses-0.2.16...
$ cabal build
Preprocessing library for ncurses-0.2.16..
Building library for ncurses-0.2.16..
<no location info>: error:
module ‘UI.NCurses’ cannot be found locally
所述模块是我正在尝试构建的包的一部分,其源文件位于lib目录中。似乎在cabal文件中指定了所有内容,但为什么它无法找到它?
我尝试使用runhaskell构建它,但是遇到了同样的错误。
部分文件:
extra-source-files:
cbits/hsncurses-shim.c
cbits/hsncurses-shim.h
cbits/mavericks-c2hs-workaround.h
source-repository head
type: git
location: https://john-millikin.com/code/haskell-ncurses/
source-repository this
type: git
location: https://john-millikin.com/code/haskell-ncurses/
tag: haskell-ncurses_0.2.16
-- Do not use default to using pkg-config to find ncurses libraries, because
-- the .pc files are missing or broken in many installations.
flag use-pkgconfig
default: False
manual: True
description:
Use pkg-config to set linker and include flags.
flag force-narrow-library
default: False
manual: True
description:
Force including and linking against ncurses instead of ncursesw. This is
only useful on systems that have the ncursesw package installed
incorrectly. On most systems this will cause compile- or run-time errors.
library
hs-source-dirs: lib
ghc-options: -Wall -O2
include-dirs: cbits
build-depends:
base >= 4.6 && < 5.0
, containers >= 0.2
, text >= 0.7
, transformers >= 0.2
build-tools:
c2hs >= 0.15
if flag(use-pkgconfig)
if flag(force-narrow-library)
cc-options: -DHSNCURSES_NARROW_HEADER
pkgconfig-depends: ncurses, panel
else
pkgconfig-depends: ncursesw, panelw
else
-- MacOS has a version of ncurses where the narrow- and wide-character
-- builds have been merged into a single header/dylib.
--
-- Explicitly linking against libpthread.so fixes a build problem on
-- platforms where the linker doesn't automatically follow dependencies.
if os(darwin) || os(freebsd) || flag(force-narrow-library)
cc-options: -DHSNCURSES_NARROW_HEADER
if os(darwin) || flag(force-narrow-library)
extra-libraries: panel ncurses pthread
else
extra-libraries: panelw ncursesw pthread
c-sources: cbits/hsncurses-shim.c
exposed-modules:
UI.NCurses
UI.NCurses.Panel
other-modules:
UI.NCurses.Enums
UI.NCurses.Compat
UI.NCurses.Types
答案 0 :(得分:1)
我遇到了同样的问题。尽管安装了c2hs
并且在PATH
中,我依赖的库仍然无法使用相同的错误消息进行安装。
我的解决方案是在我想要构建的项目中运行cabal clean
并使用cabal configure
重新配置它。
我怀疑在之前的构建过程中有一个hickup,让cabal认为c2hs
正常运行,在这种情况下没有。