Author Topic: build errors  (Read 5020 times)

0 Members and 1 Guest are viewing this topic.

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
It worked!  Rock on!

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
That doesn't help... my target_link_libraries already has ${CMAKE_DL_LIBS} ... it still fails because -ldl needs to be last in the c++ command line (see my previous post)

try this:
Code: [Select]
diff Bitshares/CMakeLists.txt

--target_link_libraries(bshare fc upnpc-static leveldb ${BDB_LIBRARIES} ${ZLIB_LIBRARIES})
++target_link_libraries(bshare fc upnpc-static leveldb ${BDB_LIBRARIES} ${ZLIB_LIBRARIES}  ${CMAKE_DL_LIBS})

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
That doesn't help... my target_link_libraries already has ${CMAKE_DL_LIBS} ... it still fails because -ldl needs to be last in the c++ command line (see my previous post)

Offline alt

  • Hero Member
  • *****
  • Posts: 2821
    • View Profile
  • BitShares: baozi
I add it at fc/CMakeLists.txt
Code: [Select]
-target_link_libraries( fc easylzma_static ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} )
+target_link_libraries( fc easylzma_static ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} )
 

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
Here is the command I ran manually which succeeded:

/usr/bin/c++   -O2 -g -DNDEBUG    CMakeFiles/bts_wallet.dir/main.cpp.o CMakeFiles/bts_wallet.dir/chain_connection.cpp.o  -o bts_wallet -rdynamic ../libbshare.a -lrt -lreadline -ldl ../fc/libfc.a ../fc/vendor/easylzma/src/libeasylzma_static.a -Wl,-Bstatic -lboost_thread-mt -lboost_date_time-mt -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_signals-mt -lboost_serialization-mt -lboost_chrono-mt -lboost_unit_test_framework-mt -lboost_context-mt -lboost_coroutine -lssl -lcrypto ../vendor/miniupnp/miniupnpc/libminiupnpc.a ../vendor/leveldb-1.12.0/libleveldb.a -Wl,-Bdynamic -lpthread -ldb_cxx -lz -ldl

Note that there is an "-ldl" early in the command (presumably from the ${CMAKE_DL_LIBS} in CMakeLists.txt) and that I had to add "-ldl" again at the end.

Need to get this to happen using only CMakeLists.txt

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
I already figured out to try that and it didn't work.  (It turns out dl was already there anyway because of ${CMAKE_DL_LIBS} so me adding dl just caused it to appear twice)

I ran: make VERBOSE=1 to find out the command that was failing and if I manually run that /usr/bin/c++ command, adding -ldl at the very end, it succeeds.  So how can we get CMakeLists.txt put dl at the very end of the /usr/bin/c++ command?

Offline bytemaster

OK, I finally got past it by using pthread (not ${pthread})

Now I have a new error:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x11): undefined reference to `dlopen'

Add "dl" after pthread.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
OK... I had previously added pthread to several CMakeLists.txt files but I wanted to narrow it down, so I removed them all and added them back one by one.

It turns out the only change needed to get past the "undefined reference to `pthread_once'" error was to add the line:

    target_link_libraries( leveldb pthread )

to the end of "BitShares/vendor/leveldb-1.12.0/CMakeLists.txt"

(Previously there was no target_link_libraries at all in that file)

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
OK, I finally got past it by using pthread (not ${pthread})

Now I have a new error:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x11): undefined reference to `dlopen'

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
I tried both beginning and ending and i'm still getting the same problem.

I also ran: make VERBOSE=1 to capture the command that caused the errors:

/usr/bin/c++   -O2 -g -DNDEBUG    CMakeFiles/bts_server.dir/server.cpp.o CMakeFiles/bts_server.dir/chain_connection.cpp.o CMakeFiles/bts_server.dir/chain_server.cpp.o  -o bts_server -rdynamic ../libbshare.a -lrt -ldl ../fc/libfc.a ../fc/vendor/easylzma/src/libeasylzma_static.a -Wl,-Bstatic -lboost_thread-mt -lboost_date_time-mt -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_signals-mt -lboost_serialization-mt -lboost_chrono-mt -lboost_unit_test_framework-mt -lboost_context-mt -lboost_coroutine -lssl -lcrypto ../vendor/miniupnp/miniupnpc/libminiupnpc.a ../vendor/leveldb-1.12.0/libleveldb.a -Wl,-Bdynamic -ldb_cxx -lz

but the command doesn't even have -lpthread in it, so it doesn't seem like my changing the CMakeLists.txt  had any effect.  I even tried adding -lpthread to the command manually (both at the beginning and end) and that didn't help... still the same error

Offline bytemaster

bts_server and bts_wallet

Link order matters in linux... try putting it at the beginning and end of the lib list.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
bts_server and bts_wallet

Offline bytemaster

I tried both pthread and ${pthread} and got the same problem each time.

Which executable are you attempting to build?
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline HardFork

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
I tried both pthread and ${pthread} and got the same problem each time.

Offline bytemaster

Inside /bts_wallet/CMakeLists.txt (or whichever app you are building), you need to add pthread as an argument to target_link_libraries().

Don't just add pthread, use ${pthread} which is conditionally set on Linux.... submit a pull request and I will merge it.
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.