知道如何在Mac OS(Maverick)上编译下面编译的代码吗?我按照here的说明进行操作。其他(非图形)部分代码似乎在GHCi中工作。
如果我尝试从GHCi运行main3book
,它会因分段错误而崩溃。也许我可以在某种虚拟机中运行它(在VMWARE,32位Windows XP下)?
最好知道在哪个平台上可以运行本书中的示例,因此如果有人设法最近运行这些示例,那么请让我知道如何。
编辑:在这个discussion中,他们提到了Ubuntu的工作原理。我只是希望我不是互联网上唯一一个试图让这些旧例子运行的人。
bash-3.2$ cat MyGraphics.hs
import SimpleGraphics
main = main3book
bash-3.2$ ghc MyGraphics
[3 of 3] Compiling Main ( MyGraphics.hs, MyGraphics.o )
Linking MyGraphics ...
Undefined symbols for architecture x86_64:
"_IOCreatePlugInInterfaceForService", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOIteratorNext", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOMasterPort", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IORegistryEntryCreateCFProperties", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOServiceGetMatchingServices", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
"_IOServiceMatching", referenced from:
__glfwInitJoysticks in libHSGLFW-0.5.2.0.a(cocoa_joystick.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:4)
VMWARE Fusion中的Ubuntu 12(32位版本)解决了问题。
见下图:)