gpt4 book ai didi

haskell - 当 cabal 构建软件包时, "legacy fallback"是什么意思?

转载 作者:行者123 更新时间:2023-12-04 11:52:34 29 4
gpt4 key购买 nike

使用 cabal 时要构建一个 Haskell 包,它似乎将一些包标记为 legacy fallback :

$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- appar-0.1.8 (lib:appar) (requires build)
- auto-update-0.1.6 (lib) (requires build)
- base-compat-0.11.2 (lib) (requires build)
...
Building base-orphans-0.8.4 (lib)
Building appar-0.1.8 (all, legacy fallback)
Downloaded memory-0.16.0
Downloading cryptonite-0.29
Installing base-orphans-0.8.4 (lib)
Downloaded cryptonite-0.29
Downloading some-1.0.3
...
您可以看到,对于某些库,它们被专门标记为 (lib) ,但其他库标记为 (all, legacy fallback) .
这些有什么区别? legacy fallback 是什么意思意思是?

我正在使用 cabal-install版本 3.4.0.0:
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library

最佳答案

我深入研究了源代码。错误消息来自 here :

    dispname = case elabPkgOrComp pkg of
ElabPackage _ -> prettyShow pkgid
++ " (all, legacy fallback)"
ElabComponent comp -> prettyShow pkgid
++ " (" ++ maybe "custom" prettyShow (compComponentName comp) ++ ")"
于是我开始寻找 ElabPackage 的地方被构造。我找到了 this :
    elaborateSolverToPackage
...
where
...
elab1 = elab0 {
elabUnitId = newSimpleUnitId pkgInstalledId,
elabComponentId = pkgInstalledId,
elabLinkedInstantiatedWith = Map.empty,
elabPkgOrComp = ElabPackage $ ElaboratedPackage {..},
elabModuleShape = modShape
}
这又被使用 here :
    elaborateSolverToComponents mapDep spkg@(SolverPackage _ _ _ deps0 exe_deps0)
= case mkComponentsGraph (elabEnabledSpec elab0) pd of
Right g -> do
...
let not_per_component_reasons = why_not_per_component src_comps
if null not_per_component_reasons
then return comps
else do checkPerPackageOk comps not_per_component_reasons
return [elaborateSolverToPackage spkg g $
comps ++ maybeToList setupComponent]
现在 why_not_per_component非常有趣,因为该函数决定了何时使用遗留后备。它被定义为 here :
        -- You are eligible to per-component build if this list is empty
why_not_per_component g
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
在下面的代码中,我们可以看到它可能是由以下原因引起的:
  • 构建类型为自定义或配置
  • cabal 版本小于 1.8
  • 没有可构建的组件
  • 你通过了--disable-per-component旗帜。
  • 计划覆盖已启用

  • 所以对于 appar库是因为 cabal 版本是 1.6,低于 1.8,见 https://github.com/kazu-yamamoto/appar/blob/v0.1.8/appar.cabal#L10 .

    关于haskell - 当 cabal 构建软件包时, "legacy fallback"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68173444/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com