You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS下stack ghci出现不兼容GHC选项问题求助

Why You're Seeing Unresolvable Warnings with stack ghci on High Sierra

Hey there! Let's dig into why you're hitting those stubborn warnings when running stack ghci with your setup—MacBook High Sierra, Stack 1.6.3, and the default project using lts-10.5. These issues are pretty common with older Stack/resolver combos on that OS, so here are the most likely culprits:

Common Causes

  • Stack-resolver compatibility quirks
    Stack 1.6.3 is a relatively old release (circa 2018), and while it technically supports lts-10.5 (which uses GHC 8.2.2), there are small bugs in dependency resolution and system library handling that can trigger warnings. High Sierra's system libraries (like libc) have subtle differences from what the precompiled GHC binaries in Stack 1.6.3 were built against, leading to load-time warnings.

  • Deprecated dependencies in the default template
    The lts-10.5 default project template relies on some packages or functions that were already marked as deprecated by that point. For example, certain utilities in the base library or older versions of helper packages like mtl might have known deprecation warnings that Stack surfaces during the build/ghci launch.

  • High Sierra's security restrictions
    System Integrity Protection (SIP) on High Sierra can interfere with how Stack loads shared libraries from its local cache. This might lead to warnings about missing or incompatible libraries, even though the dependencies are technically installed.

  • Corrupted Stack cache
    Over time, your local Stack cache (~/.stack) can get corrupted—maybe from interrupted downloads or version mismatches. This causes Stack to misresolve dependencies, resulting in unexpected warnings.

Fixes to Try

  • Upgrade Stack (if possible)
    Even a small upgrade to a newer Stack version (like 1.9.x or early 2.x releases, which still support lts-10.5) can patch those compatibility bugs. Run stack upgrade if your current version supports it, or grab a compatible binary and replace your existing installation.

  • Get verbose logs to pinpoint the issue
    Run stack ghci --verbose to see exactly which package or step is triggering the warning. This will help you narrow down whether it's a deprecation, library load issue, or something else.

  • Clean and rebuild the cache
    Wipe out the corrupted cache with these steps:

    stack clean --full
    rm -rf ~/.stack/indices ~/.stack/packages
    stack build
    stack ghci
    

    This forces Stack to re-download all dependencies from scratch, which often resolves cache-related warnings.

  • Switch to a more compatible resolver
    If upgrading Stack isn't an option, try a resolver that's a better match for Stack 1.6.3. lts-9.x (e.g., lts-9.21, which uses GHC 8.0.2) was released around the same time as Stack 1.6.3 and has fewer compatibility hiccups. Edit your project's stack.yaml to change the resolver line, then rebuild.

内容的提问来源于stack exchange,提问作者Arkady Rost

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:58:00