travis haskell 构建失败并出现链接错误

travis haskell builds failing with linking error

一段时间以来,我的小 haskell 应用程序的 travis builds 失败并出现神秘的 link 错误:

$ cabal configure --enable-tests && cabal build && cabal test
Resolving dependencies...
[1 of 1] Compiling Main             ( Setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
/usr/lib/ghc/unix-2.5.1.0/libHSunix-2.5.1.0.a(execvpe.o): In function `pPrPr_disableITimers':
(.text+0x320): multiple definition of `pPrPr_disableITimers'
/home/travis/.cabal/lib/x86_64-linux-ghc-7.4.1/unix-2.7.1.0/libHSunix-2.7.1.0.a(ghcrts.o):ghcrts.c:(.text+0x0): first defined here
collect2: ld returned 1 exit status
The command "cabal configure --enable-tests && cabal build && cabal test" exited with 1.
Done. Your build exited with 1.

构建在我的机器上运行良好。我可以在我的 .travis.yml 文件中调整什么来解决那里的问题吗?

根据我的经验,这通常是由于依赖关系树中有多个版本的库,cabal configure 允许,而 cabal install 不允许。我在你的构建日志中没有看到这方面的证据,但理论上它可能正在发生。您可以尝试将 cabal configure 更改为 cabal install,看看会发生什么。

所以,首先我使用的是旧版 travis 系统,我想我需要继续使用新系统。但我认为那需要更彻底的配置。其次在遗留系统上,不支持 ghc 7.10:whosebug.com/questions/29516932/… 我已经配置了 7.10 但没有意识到它不起作用,并且由于 travis 不识别 ghc 版本,它只是把我最大,7.4。所以我现在恢复到 7.8,错误现在不同了,也更容易理解了。 因此,由于我的错误配置,导致出现奇怪错误的根本原因是回退到相对古老的 ghc 7.4。