Mac OS X链接器

时间:2013-12-17 16:03:05

标签: c++ qt linker undefined symbols

所以我尝试为Mac OS X Mavericks编译其中一个山寨币(比特币副本)QT客户端,并在一段时间后丢失所有内容(boost,db48,miniupnpc,qt 4.8.5和qt creator 2.5.2)我可以编译代码但是当到达链接文件的阶段时,我得到一个“未定义的架构x86_64符号”错误。这是整个输出:

g++ -headerpad_max_install_names -fstack-protector -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o Bosscoin-Qt.app/Contents/MacOS/Bosscoin-Qt build/macdockiconhandler.o build/bitcoin.o build/bitcoingui.o build/transactiontablemodel.o build/addresstablemodel.o build/optionsdialog.o build/sendcoinsdialog.o build/addressbookpage.o build/signverifymessagedialog.o build/aboutdialog.o build/editaddressdialog.o build/bitcoinaddressvalidator.o build/version.o build/sync.o build/util.o build/netbase.o build/key.o build/script.o build/main.o build/init.o build/net.o build/irc.o build/checkpoints.o build/addrman.o build/db.o build/walletdb.o build/json_spirit_writer.o build/json_spirit_value.o build/json_spirit_reader.o build/clientmodel.o build/guiutil.o build/transactionrecord.o build/optionsmodel.o build/monitoreddatamapper.o build/transactiondesc.o build/transactiondescdialog.o build/bitcoinstrings.o build/bitcoinamountfield.o build/wallet.o build/keystore.o build/transactionfilterproxy.o build/transactionview.o build/walletmodel.o build/bitcoinrpc.o build/rpcdump.o build/rpcnet.o build/rpcrawtransaction.o build/overviewpage.o build/csvmodelwriter.o build/crypter.o build/sendcoinsentry.o build/qvalidatedlineedit.o build/bitcoinunits.o build/qvaluecombobox.o build/askpassphrasedialog.o build/protocol.o build/notificator.o build/qtipcserver.o build/rpcconsole.o build/scrypt.o build/miningpage.o build/noui.o build/moc_bitcoingui.o build/moc_transactiontablemodel.o build/moc_addresstablemodel.o build/moc_optionsdialog.o build/moc_sendcoinsdialog.o build/moc_addressbookpage.o build/moc_signverifymessagedialog.o build/moc_aboutdialog.o build/moc_editaddressdialog.o build/moc_bitcoinaddressvalidator.o build/moc_clientmodel.o build/moc_guiutil.o build/moc_optionsmodel.o build/moc_monitoreddatamapper.o build/moc_transactiondesc.o build/moc_transactiondescdialog.o build/moc_bitcoinamountfield.o build/moc_transactionfilterproxy.o build/moc_transactionview.o build/moc_walletmodel.o build/moc_overviewpage.o build/moc_csvmodelwriter.o build/moc_sendcoinsentry.o build/moc_qvalidatedlineedit.o build/moc_qvaluecombobox.o build/moc_askpassphrasedialog.o build/moc_notificator.o build/moc_miningpage.o build/moc_rpcconsole.o build/moc_macdockiconhandler.o build/qrc_bitcoin.o
-F/Library/Frameworks -L/Library/Frameworks -lminiupnpc -framework Foundation -framework ApplicationServices -framework AppKit -L/opt/local/lib -L/opt/local/lib/db48 -lssl -lcrypto -ldb_cxx-4.8 -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt -framework QtGui -framework QtCore 
 Undefined symbols for architecture x86_64:
 "boost::program_options::to_internal(std::string const&)", referenced from:
 boost::program_options::detail::basic_config_file_iterator<char>::getline(std::string&) in util.o
 "boost::program_options::detail::common_config_file_iterator::common_config_file_iterator(std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool)", referenced from:
 boost::program_options::detail::basic_config_file_iterator<char>::basic_config_file_iterator(std::istream&, std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool) in util.o
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)
 make: *** [Bosscoin-Qt.app/Contents/MacOS/Bosscoin-Qt] Error 1
 make: Leaving directory `/Users/kriegalex/dev/bosscoin/bosscoin-qt-build-desktop-Qt_4_8_5_in_PATH__System__Release'
 13:30:58: The process "/usr/bin/make" exited with code 2.
 Error while building/deploying project bosscoin-qt (target: Desktop)

我真的试图通过很多讨论提升和链接问题的线程,我尝试使用g ++或clang ++进行编译,如最流行的帖子所示,但似乎没有任何效果。

我真的很感激一些帮助。我想如果有人已经编译了Mac OS QT客户端,那么应该相当清楚是什么问题。

祝你好运

2 个答案:

答案 0 :(得分:1)

所以我找到了解决方案,现在它正在运行,但我不确定是哪一个解决了这个问题:

  • 从Homebrew(brew install qt)获取Qt,而不是从Macports或官方网站获取

  • 要求macports使用tag + universal

    安装boost和其他依赖项

    sudo port install boost +universal

  • 然后我只使用qmake和make编译(如所描述的那样)

我认为这是解决它的第二个解决方案,因为它编译了64位库。

谢谢bibi指出我的32/64位问题:)

答案 1 :(得分:0)

看起来你正在为64位构建,但有些库是32位 试着强制它在.pro

CONFIG+=x86