Eos: Ran into issue when building with MacOS10.12. Any ideas?

Created on 9 Mar 2018  路  7Comments  路  Source: EOSIO/eos

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
EOS_LIBBSONCXX
linked by target "db_plugin" in directory /Users/hyperbola/Documents/eos/plugins/db_plugin
EOS_LIBMONGOCXX
linked by target "db_plugin" in directory /Users/hyperbola/Documents/eos/plugins/db_plugin

Most helpful comment

I've ported recent changes in plugins/db_plugin/CMakeLists.txt (which is currently plugins/mongo_db_plugin/CMakeLists.txt) from master branch to fix this.

diff --git a/plugins/db_plugin/CMakeLists.txt b/plugins/db_plugin/CMakeLists.txt
index 73a6fe4f..bd536713 100644
--- a/plugins/db_plugin/CMakeLists.txt
+++ b/plugins/db_plugin/CMakeLists.txt
@@ -20,14 +20,22 @@ if (libmongoc-1.0_FOUND)

     find_package(libbsoncxx REQUIRED)
     message(STATUS "Found bsoncxx headers: ${LIBBSONCXX_INCLUDE_DIRS}")
-    find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
-                 PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+    if((LIBBSONCXX_VERSION_MAJOR LESS 3) OR ((LIBBSONCXX_VERSION_MAJOR EQUAL 3) AND (LIBBSONCXX_VERSION_MINOR LESS 2)))
+        find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
+          PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+      else()
+        set(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES})
+    endif()
     message(STATUS "Found bsoncxx library: ${EOS_LIBBSONCXX}")

     find_package(libmongocxx REQUIRED)
     message(STATUS "Found mongocxx headers: ${LIBMONGOCXX_INCLUDE_DIRS}")
-    find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
-                 PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+    if((LIBMONGOCXX_VERSION_MAJOR LESS 3) OR ((LIBMONGOCXX_VERSION_MAJOR EQUAL 3) AND (LIBMONGOCXX_VERSION_MINOR LESS 2)))
+        find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
+          PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+      else()
+        set(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES})
+    endif()
     message(STATUS "Found mongocxx library: ${EOS_LIBMONGOCXX}")

     add_definitions(-DMONGODB)

All 7 comments

I've ported recent changes in plugins/db_plugin/CMakeLists.txt (which is currently plugins/mongo_db_plugin/CMakeLists.txt) from master branch to fix this.

diff --git a/plugins/db_plugin/CMakeLists.txt b/plugins/db_plugin/CMakeLists.txt
index 73a6fe4f..bd536713 100644
--- a/plugins/db_plugin/CMakeLists.txt
+++ b/plugins/db_plugin/CMakeLists.txt
@@ -20,14 +20,22 @@ if (libmongoc-1.0_FOUND)

     find_package(libbsoncxx REQUIRED)
     message(STATUS "Found bsoncxx headers: ${LIBBSONCXX_INCLUDE_DIRS}")
-    find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
-                 PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+    if((LIBBSONCXX_VERSION_MAJOR LESS 3) OR ((LIBBSONCXX_VERSION_MAJOR EQUAL 3) AND (LIBBSONCXX_VERSION_MINOR LESS 2)))
+        find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
+          PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+      else()
+        set(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES})
+    endif()
     message(STATUS "Found bsoncxx library: ${EOS_LIBBSONCXX}")

     find_package(libmongocxx REQUIRED)
     message(STATUS "Found mongocxx headers: ${LIBMONGOCXX_INCLUDE_DIRS}")
-    find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
-                 PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+    if((LIBMONGOCXX_VERSION_MAJOR LESS 3) OR ((LIBMONGOCXX_VERSION_MAJOR EQUAL 3) AND (LIBMONGOCXX_VERSION_MINOR LESS 2)))
+        find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
+          PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
+      else()
+        set(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES})
+    endif()
     message(STATUS "Found mongocxx library: ${EOS_LIBMONGOCXX}")

     add_definitions(-DMONGODB)

@blackbeam Thanks a lot! I will follow your way and try it.

@blackbeam Where did you merge these changes to? I'm having this same issue when building DAWN-2018-02-14 on Ubuntu 16.04. Thanks!

Into my local copy of the eos source code (file plugins/db_plugin/CMakeLists.txt as stated in the diff posted above).

@blackbeam Do I need to build again after making changes to CMakeLists.txt?

@SonikaManandhar. As far as I can see build of DAWN-2018-02-14 won't start without it if your mongo driver version >= 3.2 (see c166966). So if you experienced this error, then you need to apply this changes and restart build.

@blackbeam Thank you for the response.
I was able to make it work after rebuilding and making few more changes in the file paths.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IvanYakimov picture IvanYakimov  路  3Comments

congnghebitcoin picture congnghebitcoin  路  3Comments

hadramidah picture hadramidah  路  3Comments

chanwitkepha picture chanwitkepha  路  3Comments

xiaomaogy picture xiaomaogy  路  3Comments