【问题标题】:Getting same error when building bitcoind on Mac OS X在 Mac OS X 上构建 bitcoind 时出现相同的错误
【发布时间】:2015-10-26 09:16:37
【问题描述】:

所以我在为 OS X 构建 bitcoind 的文档中:https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md 并且每次尝试构建时都会遇到相同的错误。以下是我采取的步骤:

brew install autoconf automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt5

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin

./autogen.sh
./configure --with-gui=qt5
make

这是我得到的错误:

OBJCXXLD qt/bitcoin-qt
clang: error: unknown argument: '-framework QtNetwork'
clang: error: unknown argument: '-framework QtWidgets'
clang: error: unknown argument: '-framework QtGui'
clang: error: unknown argument: '-framework QtCore'
clang: error: unknown argument: '-framework QtDBus'
clang: error: unknown argument: '-framework QtCore'
make[2]: *** [qt/bitcoin-qt] Error 1
make[1]: *** [check-recursive] Error 1
make: *** [check-recursive] Error 1

我已经用谷歌搜索了一天多。我在这里手动下载了开源 Qt:http://www.qt.io/download-open-source/,我通过 brew 等安装了 qt 和 qt5。我对 C/C++ 和编译代码不太熟悉,不知道下一步该尝试什么。提前致谢

【问题讨论】:

    标签: c++ macos qt bitcoin bitcoind


    【解决方案1】:

    首先尝试构建一个非 GUI 的 bitcoind:

    make clean
    ./configure --without-gui
    make
    

    【讨论】:

      【解决方案2】:

      我遇到了同样的错误...我通过手动编辑 MakeFile

      解决了这个问题

      问题出在下面的QT_DBUS_LIBS, QT_LIBS and QT_TEST_LIBS 定义中...-F flag and -framework 是导致问题的原因。

      QT_DBUS_LIBS = -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtDBus -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtCore 
      QT_LIBS = -F/usr/local/Cellar/qt5/5.5.0/lib/QtNetwork -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtWidgets -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtGui -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtCore  -framework Foundation -framework ApplicationServices -framework AppKit
      QT_TEST_LIBS = -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtTest -F/usr/local/Cellar/qt5/5.5.0/lib -framework\ QtCore 
      

      将这些库名称替换为对库的直接引用...您必须首先找到您的 Qt 库路径,我的路径是 /usr/local/Cellar/qt5/5.5.0/lib

      QT_DBUS_LIBS = /usr/local/Cellar/qt5/5.5.0/lib/QtDBus.framework/QtDBus /usr/local/Cellar/qt5/5.5.0/lib/QtCore.framework/QtCore
      QT_LIBS = /usr/local/Cellar/qt5/5.5.0/lib/QtNetwork.framework/QtNetwork /usr/local/Cellar/qt5/5.5.0/lib/QtWidgets.framework/QtWidgets /usr/local/Cellar/qt5/5.5.0/lib/QtGui.framework/QtGui /usr/local/Cellar/qt5/5.5.0/lib/QtCore.framework/QtCore  -framework Foundation -framework ApplicationServices -framework AppKit
      QT_TEST_LIBS = /usr/local/Cellar/qt5/5.5.0/lib/QtTest.framework/QtTest /usr/local/Cellar/qt5/5.5.0/lib/QtCore.framework/QtCore
      

      修改后

      make clean
      make
      

      效果很好!

      从 src\qt 目录运行bitcoin-qt,这是比特币核心的 GUI 版本

      玩得开心!请记住,如果您再次运行 configure,这些更改将被覆盖。

      【讨论】:

        【解决方案3】:

        我通过对 Makefile 和 src/Makefile 进行更改(需要在每个 ./configure 后重做)来传递此错误

        1:去掉几个'-framework Qtxxxx's,因为它们与同一行中的'-F path/to/qt/'有点多余。

        2:用 '-F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library 将其余的 '-framework' 替换为一些基本的 Apple 库/框架'

        但毕竟,我仍然放弃了 qt gui,因为我遇到了下面链接中的确切问题,似乎自制软件中的 qt5 不适用于 x64,我懒得在这里跟随黑客

        https://github.com/bitcoin/bitcoin/issues/5728

        【讨论】:

          【解决方案4】:

          我有同样的问题,并通过切换回 qt4 并在没有 GUI 的情况下编译来解决它:

          brew install autoconf automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt4
          
          git clone https://github.com/bitcoin/bitcoin.git
          cd bitcoin
          
          ./autogen.sh
          ./configure
          make
          

          【讨论】: