【问题标题】:Haskell Platform / Cabal - Installation of package 'haskell-gi' fails while linking due to 'undefined references'Haskell Platform / Cabal - 由于“未定义的引用”,安装包“haskell-gi”在链接时失败
【发布时间】:2017-10-01 15:27:33
【问题描述】:

背景
目前,我正在从事一个处理计算机视觉的项目。

我用..
- Haskell 作为编程语言。
- GTK+ 用于创建 GUI。
- FFmpeg 从路径或网络摄像头读取和提取视频/帧。
- 一些边缘检测算法。

我想..
- 将视频(未修改的输入视频,以及修改后的输出视频)渲染到 GTK 库中的绘图区域小部件。

我的设置
- Windows 10 - 64 位
- MSYS2 / Mingw32
- Haskell 平台 (GHC 8.0.1)
- 阴谋集团 1.24.0.0
- ffmpeg-light-0.12.0
- gtk-0.14.6

问题
要使用 GTK 渲染视频,我需要为 GI 安装绑定,所以我尝试安装包 'haskell-gi' 但由于 未定义的引用,它在链接阶段失败.

示例
运行cabal install haskell-gi 后,我得到:

C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x19d8): undefined reference to `g_irepository_require'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x1f59): undefined reference to `g_typelib_symbol'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x26f3): undefined reference to `g_irepository_prepend_search_path'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x2bee): undefined reference to `g_base_info_gtype_get_type'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x2f2e): undefined reference to `g_irepository_find_by_name'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x42c7): undefined reference to `g_struct_info_get_field'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x460b): undefined reference to `g_struct_info_get_n_fields'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x4775): undefined reference to `g_struct_info_get_size'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x4aef): undefined reference to `g_union_info_get_field'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x4e33): undefined reference to `g_union_info_get_n_fields'
C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3\dist\build/libHShaskell-gi-0.20.3-4ylmwt0eEVy4Aeczi0KBpN.a(LibGIRepository.o):fake:(.text+0x4f9d): undefined reference to `g_union_info_get_size'
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
cabal: Leaving directory 'C:\Users\Roland\AppData\Local\Temp\cabal-tmp-1788\haskell-gi-0.20.3'
cabal: Error: some packages failed to install:
haskell-gi-0.20.3 failed during the building phase. The exception was:
ExitFailure 1

注意
这个未定义的引用是在 .c/.h 文件中定义的方法,这些文件是 GObjects 的 gobject-introspection 文件夹的一部分。

到目前为止我尝试了什么?
在安装 Gtk2Hs 和 ffmpeg-light 时,我遇到了类似的问题,但我能够摆脱 ..
- 下载开发源文件并将 --extra-include-dir 或 --extra-lib-dir 标签添加到 cabal 安装
- 将链接器标志 (pkg-config --libs gobject-introspection-1.0) 添加到 cabal 设置
- 下载丢失的库并将它们添加到 PATH
- 修改 .pc 文件(包配置的一部分)

上述选项均不适用于 'haskell-gi'。我也搜索了相关的东西,但也没有用。

问题
你们中有人知道如何克服这个问题吗?任何帮助表示赞赏。

【问题讨论】:

    标签: windows haskell gcc cabal gobject


    【解决方案1】:

    我不知道这些包在 Windows 上叫什么,但在 Ubuntu 上我必须分别安装 GTK 和 GI 的 C 库/头文件

    sudo apt install libgirepository1.0-dev 
    sudo apt install libgtk-3-dev
    

    因为cabal(或者在我的情况下,stack)没有为我安装这些(虽然我得到了different error messages)。

    你没有说你是否已经这样做了,但是 https://www.gtk.org/download/windows.php 说你应该这样做

    pacman -S mingw-w64-x86_64-gtk3 
    pacman -S mingw-w64-x86_64-toolchain base-devel 
    

    因为你已经有了 MSYS。

    如果您可以发布您的阴谋集团设置或链接到回购,这可能会有所帮助。

    (您可能还会发现 https://github.com/lettier/movie-monad 对您的项目很有用。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 2017-04-13
      • 2022-01-17
      相关资源
      最近更新 更多