简体   繁体   English

GHC cabal install hamlet 失败并出现一个模糊的错误

[英]GHC cabal install hamlet fails with an obscure error

I am trying to install a Hamlet on a webfaction shared server so I can compile and run my web application there.我正在尝试在 webfaction 共享服务器上安装一个 Hamlet,这样我就可以在那里编译和运行我的 web 应用程序。 I am using Yesod to develop the application.我正在使用 Yesod 开发应用程序。

I managed to compile GHC 7 from source and bootstrapped cabal install.我设法从源代码编译 GHC 7 并引导 cabal 安装。 Next I did cabal install hamlet and expected it to work.接下来我做了cabal install hamlet并希望它能够工作。 No luck!没运气!

I get the following strange error message from cabal/GHC.我从 cabal/GHC 收到以下奇怪的错误消息。 Could anyone help me out?谁能帮帮我?

$ cabal install hamlet                       Resolving dependencies...
Configuring hamlet-0.8.2...
Preprocessing library hamlet-0.8.2...
Building hamlet-0.8.2...
[ 1 of 14] Compiling Text.MkSizeType  ( Text/MkSizeType.hs, dist/build/Text/MkSizeType.o )
[ 2 of 14] Compiling Text.Shakespeare ( Text/Shakespeare.hs, dist/build/Text/Shakespeare.o )
[ 3 of 14] Compiling Text.Hamlet.Parse ( Text/Hamlet/Parse.hs, dist/build/Text/Hamlet/Parse.o )

Text/Hamlet/Parse.hs:113:13:
    Warning: A do-notation statement discarded a result of type String.
         Suppress this warning by saying "_ <- ($) try string "!--"",
         or by using the flag -fno-warn-unused-do-bind
[ 4 of 14] Compiling Text.Hamlet.Quasi ( Text/Hamlet/Quasi.hs, dist/build/Text/Hamlet/Quasi.o )
[ 5 of 14] Compiling Text.Css         ( Text/Css.hs, dist/build/Text/Css.o )
[ 6 of 14] Compiling Text.Cassius     ( Text/Cassius.hs, dist/build/Text/Cassius.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package pretty-1.0.1.2 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Loading package unix-2.4.2.0 ... linking ... done.
Loading package directory-1.1.0.0 ... linking ... done.
Loading package process-1.0.1.5 ... linking ... done.
Loading package bytestring-0.9.1.10 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package parsec-3.1.1 ... linking ... done.
Loading package failure-0.1.0.1 ... linking ... done.
Loading package deepseq-1.1.0.2 ... linking ... done.
Loading package text-0.11.0.8 ... linking ... done.
Loading package blaze-builder-0.3.0.1 ... linking ... done.
Loading package blaze-html-0.4.1.1 ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
ghc: mmap 36864 bytes at (nil): Operation not permitted
ghc: Try specifying an address with +RTS -xm<addr> -RTS
cabal: Error: some packages failed to install:
hamlet-0.8.2 failed during the building phase. The exception was:
ExitFailure 1

Okay I seem to have solved the problem and am noting it here in the hope that it helps others.好的,我似乎已经解决了这个问题,并在这里注意到它,希望它可以帮助其他人。

The problem is that webfaction does not allow you to execute files stored in /tmp.问题是 webfaction 不允许您执行存储在 /tmp 中的文件。 The error message from cabal is very decidedly confusing.来自 cabal 的错误消息非常令人困惑。

The fix is to set the environment variable to a directory in your homepath (where no such restriction applies) before running cabal install.修复方法是在运行 cabal install 之前将环境变量设置为主路径中的目录(没有此类限制)。 I simply created an alias -我只是创建了一个别名 -

alias cabalinstall='export TMPDIR=~/tmp; cabal install'

This makes sure that the tmpdir is set correctly before trying to install any cabal package.这可以确保在尝试安装任何 cabal package 之前正确设置 tmpdir。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM