知道如何在 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)

最佳答案

在 VMWARE Fusion 中使用 Ubuntu 12(32 位版本)解决了问题。

见下图:)

关于haskell - 在 Mac 上编译 Haskell School of Expression 时出现问题,已知在什么平台上可编译/可运行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22824126/

10-12 13:56
查看更多