【问题标题】:Haskell ghc, linking error when trying to compile a program using ghc and EuterpeaHaskell ghc,尝试使用 ghc 和 Euterpea 编译程序时出现链接错误
【发布时间】:2015-07-11 19:34:39
【问题描述】:

我正在查看计算音乐开发库 Euterpea,我正在尝试编译以下基本程序:

import Euterpea

    t251 :: Music Pitch
    t251 = let dMinor = d 4 wn :=: f 4 wn :=: a 4 wn
               gMajor = g 4 wn :=: b 4 wn :=: d 5 wn
               cMajor = c 4 bn :=: e 4 bn :=: g 4 bn
           in dMinor :+: gMajor :+: cMajor

    main = play t251

该程序在 ghci 中运行良好,但是当我尝试使用 ghc test.hs 编译它时,我收到以下错误消息:

链接测试 ... /usr/bin/ld: /home/fayong/.cabal/lib/PortMidi-0.1.3/ghc-7.6.3/libHSPortMidi-0.1.3.a(ptlinux.o): 对符号“pthread_create@@GLIBC_2.2.5”的未定义引用 //lib/x86_64-linux-gnu/libpthread.so.0:添加符号时出错:DSO 命令行 collect2 中缺失:错误:ld 返回 1 个退出状态

这似乎是一个链接错误,但我不知道如何解决它。我尝试将-lpthread 作为选项传递,但它也不起作用。

我通过 caballinux mint 17

上安装了 Euterpea

【问题讨论】:

  • 我遇到了同样的问题,在 Manjaro 3.17.8-1 上使用来自 cabal 的 Euterpea-1.0.0。我可以在 ghci 中“玩”,但不能通过 ghc。

标签: haskell linker cabal linux-mint euterpea


【解决方案1】:

我遇到了同样的错误,并通过使用“-thread”选项运行 ghc 来修复它。我认为这与该剧最近的更新有关,但我将不得不进一步研究。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-31
    • 2021-03-04
    • 1970-01-01
    • 2012-10-14
    • 2012-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多