繁体   English   中英

OS X 10.9(Mavericks)上的HaXml安装问题

[英]HaXml installation issues on OS X 10.9 (Mavericks)

我在系统上安装HaXml时遇到问题。

我已经安装了Haskell平台并使用了以下链接中提供的clang-wrapper补丁: http//www.haskell.org/platform/mac.html

当我尝试运行cabal install HaXml我收到以下错误。 我已经通过做一些研究尝试了所有的东西,但仍然没有运气来解决这个问题。 我甚至尝试单独安装此链接http://hackage.haskell.org/package/HaXml上的依赖项,然后尝试安装该程序包但仍然没有运气。 我在终端中收到以下错误消息:

Resolving dependencies...
Configuring HaXml-1.24...

/var/folders/m0/w93djnj57fv4wynyrjf4lgxc0000gn/T/23529.c:1:12:
     warning: control reaches end of non-void function [-Wreturn-type]
int foo() {}
           ^
1 warning generated.
Building HaXml-1.24...
Preprocessing library HaXml-1.24...
[ 1 of 42] Compiling Text.XML.HaXml.Xtract.Lex ( src/Text/XML/HaXml/Xtract/Lex.hs, dist/build/Text/XML/HaXml/Xtract/Lex.o )
[ 2 of 42] Compiling Text.XML.HaXml.DtdToHaskell.TypeDef ( src/Text/XML/HaXml/DtdToHaskell/TypeDef.hs, dist/build/Text/XML/HaXml/DtdToHaskell/TypeDef.o )
[ 3 of 42] Compiling Text.XML.HaXml.DtdToHaskell.Instance ( src/Text/XML/HaXml/DtdToHaskell/Instance.hs, dist/build/Text/XML/HaXml/DtdToHaskell/Instance.o )
[ 4 of 42] Compiling Text.XML.HaXml.Posn ( src/Text/XML/HaXml/Posn.hs, dist/build/Text/XML/HaXml/Posn.o )
[ 5 of 42] Compiling Text.XML.HaXml.Lex ( src/Text/XML/HaXml/Lex.hs, dist/build/Text/XML/HaXml/Lex.o )
[ 6 of 42] Compiling Text.XML.HaXml.Types ( src/Text/XML/HaXml/Types.hs, dist/build/Text/XML/HaXml/Types.o )
[ 7 of 42] Compiling Text.XML.HaXml.Namespaces ( src/Text/XML/HaXml/Namespaces.hs, dist/build/Text/XML/HaXml/Namespaces.o )
[ 8 of 42] Compiling Text.XML.HaXml.Schema.XSDTypeModel ( src/Text/XML/HaXml/Schema/XSDTypeModel.hs, dist/build/Text/XML/HaXml/Schema/XSDTypeModel.o )

src/Text/XML/HaXml/Schema/XSDTypeModel.hs:305:19: Warning:
    Fields of `Schema' not initialised: schema_elementFormDefault,
                                        schema_attributeFormDefault, schema_finalDefault,
                                        schema_blockDefault, schema_targetNamespace, schema_version,
                                        schema_namespaces
    In the expression: Schema {schema_items = []}
    In an equation for `mempty': mempty = Schema {schema_items = []}
    In the instance declaration for `Monoid Schema'
[ 9 of 42] Compiling Text.XML.HaXml.Schema.PrimitiveTypes ( src/Text/XML/HaXml/Schema/PrimitiveTypes.hs, dist/build/Text/XML/HaXml/Schema/PrimitiveTypes.o )
[10 of 42] Compiling Text.XML.HaXml.Verbatim ( src/Text/XML/HaXml/Verbatim.hs, dist/build/Text/XML/HaXml/Verbatim.o )
[11 of 42] Compiling Text.XML.HaXml.Combinators ( src/Text/XML/HaXml/Combinators.hs, dist/build/Text/XML/HaXml/Combinators.o )
[12 of 42] Compiling Text.XML.HaXml.Parse ( src/Text/XML/HaXml/Parse.hs, dist/build/Text/XML/HaXml/Parse.o )
[13 of 42] Compiling Text.XML.HaXml.Pretty ( src/Text/XML/HaXml/Pretty.hs, dist/build/Text/XML/HaXml/Pretty.o )
[14 of 42] Compiling Text.XML.HaXml.Html.Generate ( src/Text/XML/HaXml/Html/Generate.hs, dist/build/Text/XML/HaXml/Html/Generate.o )
[15 of 42] Compiling Text.XML.HaXml.Html.Parse ( src/Text/XML/HaXml/Html/Parse.hs, dist/build/Text/XML/HaXml/Html/Parse.o )
[16 of 42] Compiling Text.XML.HaXml.Wrappers ( src/Text/XML/HaXml/Wrappers.hs, dist/build/Text/XML/HaXml/Wrappers.o )

src/Text/XML/HaXml/Wrappers.hs:34:36:
    Couldn't match type `[Char]' with `b0 -> c0'
    Expected type: b0 -> c0
      Actual type: String
    In the return type of a call of `show'
    Probable cause: `show' is applied to too many arguments
    In the first argument of `(.)', namely `show 1'
    In the second argument of `(++)', namely `show 1 . 24'

src/Text/XML/HaXml/Wrappers.hs:34:36:
    Couldn't match expected type `[Char]' with actual type `a0 -> c0'
    In the second argument of `(++)', namely `show 1 . 24'
    In the second argument of `($)', namely
      `"part of HaXml-" ++ show 1 . 24'
    In a stmt of a 'do' block:
      putStrLn $ "part of HaXml-" ++ show 1 . 24
Failed to install HaXml-1.24
cabal: Error: some packages failed to install:
HaXml-1.24 failed during the building phase. The exception was:
ExitFailure 1

救命!

我知道问题是什么,但不知道一个很好的解决方案。

问题出在src / Text / XML / HaXml / Wrappers.hs文件中。 (仅供参考,您可以通过键入“cabal unpack”轻松查看cabal中的源代码,然后cd进入新创建的目录)。 如果查看该文件,它将使用ghc语言扩展在实际编译之前将c样式预处理添加到构建中。 在这种情况下,它用于将构建的版本号插入源....这是行:

putStrLn $ "part of HaXml-"++show MAJOR.MINOR

如果您然后浏览源代码,您可以看到添加“MAJOR”和“MINOR”宏的位置

> grep -r MAJOR *
HaXmL.cabal: cpp-options: -DMAJOR=1 -DMINOR=24

这个机制在我的Linux机器上运行良好.... Wrappers.hs中的行扩展为

putStrLn $ "part of HaXml-"++show 1.24

通过上面显示的错误消息,Mac上的扩展实际上正在变为

putStrLn $ "part of HaXml-"++show 1 . 24

差异很微妙,但它有很大的影响。 由于有额外的空格,而不是将版本号解析为Float,而不是“。” 已成为中缀组合运算符,并期望“1”和“24”成为函数组成!

这可能是构建过程中的一个错误....

我目前无法访问Mac进一步调试(就像我之前提到的,这是在我的Linux机器上编译的),但你确实有以下选项。

  1. 您可以向HaXmL人员提交但报告,并等待他们解决(我可能会自己做,如果我今天晚些时候感到有动力)。 显然,这可能需要一些时间。

  2. 如果您有这个选项,请在另一个操作系统上工作。

  3. 如果您只是想要开始运行,请进行一些小修复并自行构建。

这比听起来容易。 只需执行以下操作:

> cabal unpack HaXmL
> cd HaXmL-1.24

现在编辑src / Text / XML / HaXml / Wrappers.hs并直接将版本号放入(即 - 将“MAJOR.MINOR”更改为“1.24”)(也是src / Text / XML / HaXml.hs)。 继续打字

> cabal configure
> cabal build
> cabal install

(最后三行可以替换为最后一行“cabal安装”,但由于您正在调试,我认为通过单独键入每个行更容易隔离问题)。

如果这样做,你应该有一个工作版本的HaXmL。 当然,从长远来看,这不是一个很好的解决方案(即你必须在每次升级时都重复这个),但有时候这是快速前进的唯一方法。

暂无
暂无

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

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