【发布时间】:2011-11-13 01:53:22
【问题描述】:
我尝试使用ghc编译和链接简单程序,但在链接过程中失败:
import System (getArgs)
main = do
args <- getArgs
print args
我尝试编译
% ghc -c -O Main.hs
% ghc -o Main Main.o
ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
Undefined symbols for architecture i386:
"___stginit_haskell98zm1zi1zi0zi1_System_", referenced from:
___stginit_Main_ in Main.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
zsh: exit 1 ghc -o Main Main.o
但是,使用 --make 编译时:
% ghc --make Main.hs
一切正常(除了大量的 ld 警告)
更多关于环境的信息:
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.3
来自适用于 Mac OS X 10.6(英特尔,32 位 GHC)的 Haskell 平台
系统:Max OS X Lion 10.7.2
有什么想法吗?
(顺便说一句,我尝试安装 HP x64,但在安装过程中失败)
【问题讨论】: