提问人:Jonathan Cast 提问时间:11/12/2023 更新时间:11/12/2023 访问量:35
阴谋集团没有在库中构建所有模块
Cabal not building all modules in library
问:
我有这个库gsdl.cabal文件:
cabal-version: 3.6
name: gsdl
version: 0.0
synopsis: Global Script source manipulation libraries
homepage: https://globalscript.org/
author: Jonathan Cast
copyright: © Jonathan Cast
maintainer: Jonathan Cast <[email protected]>
license-file: PSL
build-type: Simple
stability: alpha
extra-source-files: README, COPYRIGHT
library
build-depends: base
exposed-modules: GSDL.Core.AST, GSDL.Core.ReadFile
hs-source-dirs: hslib
以及此可执行的 gsac.cabal 文件:
cabal-version: 3.6
name: hsgsac
version: 0.0
synopsis: A compilation pass for converting Global Script Core code to String Code
author: Jonathan Cast
copyright: © Jonathan Cast
maintainer: Jonathan Cast <[email protected]>
license-file: PSL
build-type: Simple
stability: alpha
executable gsac
main-is: gsac.hs
build-depends: base, gsdl
我在库源目录中运行,输出如下:cabal sdist -o /home/jcast/globalscript/haskell-packages
Wrote tarball sdist to
/home/jcast/globalscript/haskell-packages/gsdl-0.0.tar.gz
然后我在可执行源目录中运行,输出如下:cabal build --config-file=/home/jcast/globalscript/etc/cabal
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
- gsdl-0.0 (lib) (requires build)
- hsgsac-0.0 (exe:gsac) (dependency rebuilt)
Configuring library for gsdl-0.0..
Preprocessing library for gsdl-0.0..
Building library for gsdl-0.0..
[1 of 1] Compiling GSDL.Core.ReadFile ( hslib/GSDL/Core/ReadFile.hs, dist/build/GSDL/Core/ReadFile.o, dist/build/GSDL/Core/ReadFile.dyn_o )
Installing library in /home/jcast/.cabal/store/ghc-9.0.2/incoming/new- 2347417/home/jcast/.cabal/store/ghc-9.0.2/gsdl-0.0-1a02d7c4962673481d14d20699037d04906a028286217d00fe9bce8aa1e51dcf/lib
Preprocessing executable 'gsac' for hsgsac-0.0..
Building executable 'gsac' for hsgsac-0.0..
[1 of 1] Compiling Main ( gsac.hs, /home/jcast/src/hsgsac/dist-newstyle/build/x86_64-linux/ghc-9.0.2/hsgsac-0.0/x/gsac/build/gsac/gsac-tmp/Main.o )
gsac.hs:3:1: error:
Could not find module ‘GSDL.Core.AST’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
3 | import GSDL.Core.AST (cgsFileCode)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
什么?它只是编译库中的一个模块。为什么?
/home/jcast/globalscript/etc/cabal
是:
repository hackage.haskell.org
url: http://hackage.haskell.org/
repository globalscript
url: file+noindex:///home/jcast/globalscript/haskell-packages
ReadFile.hs
是
module GSDL.Core.ReadFile (readCoreFile) where
readCoreFile = error "readCoreFile next"
doSomethingElse = error "doSomethingElse next"
AST.hs
是
module GSDL.Core.AST (readCoreFile) where
readCoreFile = error "readCoreFile next"
doSomething = error "doSomething next"
答:
-1赞
Noughtmare
11/12/2023
#1
这不是对你问题的直接回答,但如果你只想使用一个不在 Hackage 上的本地包,那么你可以使用 cabal.project 文件(旁边):gsac.cabal
packages: gsac.cabal, ../path/to/gsdl.cabal
请参阅有关指定本地包的文档:
https://cabal.readthedocs.io/en/stable/cabal-project.html#specifying-the-local-packages
如果你的包在 GitHub 或类似的远程版本控制上,你也可以在 cabal.project 文件中指定,例如:
source-repository-package
type: git
location: https://github.com/hvr/HsYAML.git
tag: e70cf0c171c9a586b62b3f75d72f1591e4e6aaa1
评论
0赞
Jonathan Cast
11/13/2023
为什么阴谋集团的开发者不直接构建一些有效的东西,而不是试图强迫每个人采用一种可能适合也可能不适合他们的单一方法?
评论