Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue, Boost libraries for monero build differs from this project #1

Closed
selsta opened this issue Sep 23, 2020 · 7 comments
Closed

Comments

@selsta
Copy link

selsta commented Sep 23, 2020

selsta@mbpR ~/d/m/build (develop)> cmake -DMONERO_SOURCE_DIR="/Users/selsta/dev/monero" -DMONERO_BUILD_DIR="/Users/selsta/dev/monero/build/Darwin/master/release/" ..
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
CMake Error at CMakeLists.txt:126 (message):
  Boost libraries for monero build differs from this project


-- Configuring incomplete, errors occurred!
See also "/Users/selsta/dev/monero-lws/build/CMakeFiles/CMakeOutput.log".
  • macOS 10.15.6
  • cmake version 3.18.3
  • boost: 1.73.0
@selsta
Copy link
Author

selsta commented Sep 23, 2020

-- Boost_THREAD_LIBRARY is Boost::thread
-- monero_Boost_THREAD_LIBRARY_RELEASE is /usr/local/lib/libboost_thread-mt.dylib

@selsta
Copy link
Author

selsta commented Sep 23, 2020

@iDunk5400 created a patch that solves this specific issue, the Boost_NO_BOOST_CMAKE part specifically.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 734b2ac..6bd2073 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,9 +120,12 @@ endif()
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)

+set(Boost_NO_BOOST_CMAKE ON)
 find_package(Boost 1.58 QUIET REQUIRED COMPONENTS chrono filesystem program_options regex serialization system thread)

 if (NOT (Boost_THREAD_LIBRARY STREQUAL monero_Boost_THREAD_LIBRARY_RELEASE))
+  message(STATUS "Found Boost_THREAD_LIBRARY: ${Boost_THREAD_LIBRARY}")
+  message(STATUS "Found monero_Boost_THREAD_LIBRARY_RELEASE: ${monero_Boost_THREAD_LIBRARY_RELEASE}")
   message(FATAL_ERROR "Boost libraries for monero build differs from this project")
 endif()

@@ -157,7 +160,7 @@ set_property(TARGET monero::libraries PROPERTY
 )
 set_property(TARGET monero::libraries PROPERTY
   INTERFACE_LINK_LIBRARIES
-    ${CMAKE_DL_LIBS}
+    ${IMPORTED_MONERO_LIBRARIES}
     ${Boost_CHRONO_LIBRARY}
     ${Boost_FILESYSTEM_LIBRARY}
     ${Boost_REGEX_LIBRARY}
@@ -169,7 +172,7 @@ set_property(TARGET monero::libraries PROPERTY
     ${monero_OPENSSL_SSL_LIBRARY}
     ${monero_SODIUM_LIBRARY}
     ${monero_UNBOUND_LIBRARIES}
-    ${IMPORTED_MONERO_LIBRARIES}
+    ${CMAKE_DL_LIBS}
 )

 set(LMDB_INCLUDE "${monero_LMDB_INCLUDE}")

@vtnerd
Copy link
Owner

vtnerd commented Sep 23, 2020

Someone else reported this privately - this fix makes sense. My development setup doesn't have Boost+CMake apparently.

@iDunk5400 do you want to issue a PR or do you have an email that I can use for attribution?

@iDunk5400
Copy link

I originally PRed the Boost cmake fix to Monero to solve issues in MSYS2, but later mooo also had issues on Linux.

Is it OK to PR this as is above in a single commit ? I switched places of those vars to fix linking issues on Ubuntu 18.04, lots of unresolved dependencies without it. I also added a couple of cmake status messages to make it obvious why the comparison failed.

@trasherdk
Copy link
Contributor

I just tried the above patch, but it failed (less noisy than without).
The system is:

  • Slackware64 14.2
  • gcc-5.5.0
  • boost-1.59.0
  • cmake-3.5.2

The cmake output:

-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /path/monero-lws/monero-lws-build

And the error:

/path/monero/monero-build/src/blockchain_db/libblockchain_db.a(db_lmdb.cpp.o): In function `boost::filesystem::unique_path(boost::filesystem::path const&)':
db_lmdb.cpp:(.text._ZN5boost10filesystem11unique_pathERKNS0_4pathE[_ZN5boost10filesystem11unique_pathERKNS0_4pathE]+0x33): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
src/CMakeFiles/monero-lws-daemon.dir/build.make:189: recipe for target 'src/monero-lws-daemon' failed
make[2]: *** [src/monero-lws-daemon] Error 1
CMakeFiles/Makefile2:142: recipe for target 'src/CMakeFiles/monero-lws-daemon.dir/all' failed
make[1]: *** [src/CMakeFiles/monero-lws-daemon.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

@vtnerd
Copy link
Owner

vtnerd commented Oct 6, 2020

Added the patch in commits 132fa51 and 81f889d .

@selsta selsta closed this as completed Oct 6, 2020
@trasherdk
Copy link
Contributor

Hmm. I guess the error I'm seeing has to do with something else.

[ 93%] Linking CXX executable monero-lws-daemon
/path/monero/monero-build/src/blockchain_db/libblockchain_db.a(db_lmdb.cpp.o): In function `boost::filesystem::unique_path(boost::filesystem::path const&)':
db_lmdb.cpp:(.text._ZN5boost10filesystem11unique_pathERKNS0_4pathE[_ZN5boost10filesystem11unique_pathERKNS0_4pathE]+0x33): undefined reference to `boost::filesystem::detail::unique_path(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants