Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
program compiles, but won't link [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1543

PostPosted: Thu Jul 24, 2014 3:59 am    Post subject: program compiles, but won't link [solved] Reply with quote

Code:

qmake "USE_UPNP=-"
make


The programs fails at the linking stage:

Code:


[...]

build/moc_rpcconsole.cpp:1:0: note: this is the location of the previous definition
/usr/bin/moc -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild src/qt/macnotificationhandler.h -o build/moc_macnotificationhandler.cpp
g++ -c -pipe -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild -o build/moc_macnotificationhandler.o build/moc_macnotificationhandler.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
build/moc_macnotificationhandler.cpp:1:0: note: this is the location of the previous definition
/usr/bin/moc -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild src/qt/splashscreen.h -o build/moc_splashscreen.cpp
g++ -c -pipe -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild -o build/moc_splashscreen.o build/moc_splashscreen.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
build/moc_splashscreen.cpp:1:0: note: this is the location of the previous definition
/usr/bin/rcc -name bitcoin src/qt/bitcoin.qrc -o qrc_bitcoin.cpp
g++ -c -pipe -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild -o build/qrc_bitcoin.o qrc_bitcoin.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
qrc_bitcoin.cpp:1:0: note: this is the location of the previous definition
g++ -fstack-protector-all -Wl,-O1 -o darkcoin-qt build/bitcoin.o build/bitcoingui.o build/transactiontablemodel.o build/addresstablemodel.o build/optionsdialog.o build/sendcoinsdialog.o build/coincontroldialog.o build/coincontroltreewidget.o build/addressbookpage.o build/signverifymessagedialog.o build/aboutdialog.o build/editaddressdialog.o build/bitcoinaddressvalidator.o build/alert.o build/version.o build/sync.o build/util.o build/hash.o build/netbase.o build/key.o build/script.o build/main.o build/init.o build/net.o build/bloom.o build/checkpoints.o build/addrman.o build/db.o build/walletdb.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/walletview.o build/walletstack.o build/walletframe.o build/bitcoinrpc.o build/rpcdump.o build/rpcnet.o build/rpcmining.o build/rpcwallet.o build/rpcdarksend.o build/rpcblockchain.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/paymentserver.o build/rpcconsole.o build/noui.o build/leveldb.o build/txdb.o build/splashscreen.o build/blake.o build/bmw.o build/groestl.o build/jh.o build/keccak.o build/skein.o build/luffa.o build/cubehash.o build/shavite.o build/echo.o build/simd.o build/checkpointsync.o build/moc_bitcoingui.o build/moc_transactiontablemodel.o build/moc_addresstablemodel.o build/moc_optionsdialog.o build/moc_sendcoinsdialog.o build/moc_coincontroldialog.o build/moc_coincontroltreewidget.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_walletview.o build/moc_walletstack.o build/moc_walletframe.o build/moc_overviewpage.o build/moc_csvmodelwriter.o build/moc_sendcoinsentry.o build/moc_qvalidatedlineedit.o build/moc_bitcoinunits.o build/moc_qvaluecombobox.o build/moc_askpassphrasedialog.o build/moc_notificator.o build/moc_paymentserver.o build/moc_rpcconsole.o build/moc_macnotificationhandler.o build/moc_splashscreen.o build/qrc_bitcoin.o    -L/usr/lib64/qt4 /var/tmp/portage/darkcoin/darkcoin-master/src/leveldb/libleveldb.a /var/tmp/portage/darkcoin/darkcoin-master/src/leveldb/libmemenv.a -lrt -lssl -lcrypto -ldb_cxx -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lQtGui -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lEGL -lQtNetwork -lQtCore -lgthread-2.0 -lglib-2.0 -lpthread
build/main.o: In function `boost::this_thread::sleep_for(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&)':
main.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x5a): undefined reference to `boost::chrono::system_clock::now()'
main.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0x62): undefined reference to `boost::chrono::steady_clock::now()'
main.cpp:(.text._ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE[_ZN5boost11this_thread9sleep_forERKNS_6chrono8durationIlNS_5ratioILl1ELl1000000000EEEEE]+0xa8): undefined reference to `boost::chrono::steady_clock::now()'
build/init.o: In function `DetectShutdownThread(boost::thread_group*)':
init.cpp:(.text+0x123f): undefined reference to `boost::chrono::system_clock::now()'
init.cpp:(.text+0x124c): undefined reference to `boost::chrono::steady_clock::now()'
init.cpp:(.text+0x1416): undefined reference to `boost::chrono::steady_clock::now()'
build/db.o: In function `CDB::Rewrite(std::string const&, char const*)':
db.cpp:(.text+0x2974): undefined reference to `boost::chrono::system_clock::now()'
db.cpp:(.text+0x297c): undefined reference to `boost::chrono::steady_clock::now()'
db.cpp:(.text+0x2b58): undefined reference to `boost::chrono::steady_clock::now()'
build/walletdb.o: In function `ThreadFlushWalletDB(std::string const&)':
walletdb.cpp:(.text+0x1b35): undefined reference to `boost::chrono::system_clock::now()'
walletdb.cpp:(.text+0x1b3d): undefined reference to `boost::chrono::steady_clock::now()'
walletdb.cpp:(.text+0x1c46): undefined reference to `boost::chrono::steady_clock::now()'
collect2: error: ld returned 1 exit status
make: *** [darkcoin-qt] Error 1


I tried searching, and found two possible solutions, neither of which worked. The first suggested adding -lrt to the Makefile, but it is already there. The second (I believe this was targeted specifically at gentoo) suggested trying:

Code:

make "BOOST_LIB_SUFFIX=-mt"


Does anyone have any idea what is happening?


Last edited by curmudgeon on Thu Jul 24, 2014 9:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Jul 24, 2014 4:39 pm    Post subject: Re: program compiles, but won't link Reply with quote

curmudgeon wrote:
I tried searching, and found two possible solutions, neither of which worked. The first suggested adding -lrt to the Makefile, but it is already there. The second (I believe this was targeted specifically at gentoo) suggested trying:
Code:

make "BOOST_LIB_SUFFIX=-mt"

Does anyone have any idea what is happening?

Undefined references just mean it can't find some symbol it's looking for, when it comes to final link; they should be provided by some library named in the command-line, if they're not libc symbols.

Checking output from:
Code:
qlist boost|grep -F '.so'
there are indeed some -mt suffixed libs, so I imagine the above may work for you, or you may need to mangle specific names in the worst case. I don't know boost very well, so someone else can give us the background, though I do seem to recall this being discussed on the dev mailing-list a year or two ago.

If you want more help with toolchain issues, I suggest ##workingset on IRC:chat.freenode.net.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1543

PostPosted: Thu Jul 24, 2014 9:54 pm    Post subject: Reply with quote

Found and answer on another forum (from the developer of the software).

I needed to add this to the LIBS line in the Makefile (never would have figured that out by myself):

Code:

-lboost_chrono


Thanks for your reply.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum