Haskell ghc编译/链接错误,不创建可执行文件。 (linux) [英] Haskell ghc compiling/linking error, not creating executable. (linux)

查看:458
本文介绍了Haskell ghc编译/链接错误,不创建可执行文件。 (linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在haskel中写了一个基本的hello world程序,并尝试使用:
ghc filename.hs。它生成.hi和.o文件,但没有可执行文件,并在链接器中显示
此错误:

I wrote a basic hello world program in haskel and tried to compile it with: ghc filename.hs. It produces .hi and .o files but no executable and displays this error in the linker:


marox @ IT-marox :〜/ Marox $ ghc tupel.hs

链接tupel ...

/ usr / bin / ld:--hash-size = 31:未知选项

/ usr / bin / ld:对使用信息使用--help选项

collect2:ld返回1退出状态

marox@IT-marox:~/Marox$ ghc tupel.hs
Linking tupel ...
/usr/bin/ld: --hash-size=31: unknown option
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

Googling没有返回任何有用的信息。

Googling didn't return any useful information.

我在ubuntu 12.04。

I am on ubuntu 12.04.

如何解决此问题?

推荐答案

您已安装 binutils-gold ?如果是,这是问题(因为黄金链接器不支持 - -hash-size AFAIK)。

Have you binutils-gold installed? If yes, this is the problem (since the gold linker does not support --hash-size AFAIK).

可能的解决方案:


  1. 删除金

  2. 您的 ld 可能会链接到 ld.gold ,因此将符号链接改为 ld.ld

  3. 告诉haskell编译器明确使用 -pgml 选项: ghc -pgml ld.ld tupel.hs

  4. 安装 ghc ,因为 ghc 的配置脚本会生成 ghc 它不会使用 - hash-size

  5. 根据您的版本 ghc ,您可以在 ghc 的设置文件中调整链接器设置 /usr/lib/ghc-your.ghc.version/settings

  1. remove gold
  2. your ld probably links to ld.gold, so change the symlink to ld.ld
  3. tell the haskell compiler explicitly which linker to use with the -pgml option: ghc -pgml ld.ld tupel.hs
  4. install ghc from source, since the configure script of ghc will then build ghc so that it won't use --hash-size
  5. Depending on your version of ghc, you can adjust the linker settings in ghc's setting file /usr/lib/ghc-your.ghc.version/settings

这篇关于Haskell ghc编译/链接错误,不创建可执行文件。 (linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆