I'm trying to build Tokumx on FreeBSD 10, but I'm stuck with the following error:
[ 27%] Building CXX object src/third_party/ft-index/portability/CMakeFiles/tokuportability_static_conv.dir/toku_crash.cc.o
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp: In function 'int mongo::pal::{anonymous}::addrtosymstr(void*, char*, int)':
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:71:9: error: 'Dl_info_t' was not declared in this scope
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:71:19: error: expected ';' before 'symbolInfo'
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:72:30: error: 'symbolInfo' was not declared in this scope
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:75:13: error: 'symbolInfo' was not declared in this scope
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:87:25: error: 'symbolInfo' was not declared in this scope
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp: In function 'int mongo::pal::backtrace_emulation(void**, int)':
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:106:57: error: 'walkcontext' was not declared in this scope
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp: In function 'int mongo::pal::{anonymous}::addrtosymstr(void*, char*, int)':
/home/tokumx/mongo/src/mongo/platform/backtrace.cpp:92:5: warning: control reaches end of non-void function [-Wreturn-type]
[ 27%] Building CXX object src/mongo/util/CMakeFiles/stacktrace.dir/stacktrace.cpp.o
[ 27%] Building CXX object src/third_party/ft-index/portability/CMakeFiles/tokuportability_static_conv.dir/toku_path.cc.o
gmake[2]: *** [src/mongo/platform/CMakeFiles/platform.dir/backtrace.cpp.o] Error 1
gmake[1]: *** [src/mongo/platform/CMakeFiles/platform.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 27%] Building CXX object src/mongo/util/CMakeFiles/stringutils.dir/base64.cpp.o
[ 27%] Building CXX object src/third_party/ft-index/portability/CMakeFiles/tokuportability_static_conv.dir/toku_pthread.cc.o
[ 28%] Building CXX object src/third_party/ft-index/portability/CMakeFiles/tokuportability_static_conv.dir/toku_time.cc.o
Linking CXX static library libtokuportability_static_conv.a
[ 28%] Built target tokuportability_static_conv
Linking CXX static library libstacktrace.a
[ 28%] Built target stacktrace
Linking CXX static library libstringutils.a
[ 28%] Built target stringutils
gmake: *** [all] Error 2
My cmake call looks like this:
CC=gcc47 CPP=cpp47 CXX=g++47 cmake --disable-warnings-as-errors -D CMAKE_BUILD_TYPE=Release -D TOKU_DEBUG_PARANOID=OFF -D USE_VALGRIND=OFF -D USE_BDB=OFF -D BUILD_TESTING=OFF -D TOKUMX_DISTNAME=1.5.0 ..
The option "--disable-warnings-as-errors" was mentioned in a mongodb issue, but I'm not sure whether the cmake call is the right place to put this option.
EDIT:
Compiling Mongodb 2.6.4 works, but surprisingly only the raw source and not the port with patches applied:
Install file: "build/freebsd/normal/mongo/mongod" as "mongod"
scons: done building targets.
[root#testbox /usr/ports/databases/mongodb/work/mongodb-src-r2.6.4]#
EDIT#2:
Meanwhile I made some progress and patched CMakeLists.txtand added the following compiler flags:
-lexecinfo -lpthread
-lexecinfo fixes the missing backtrace_symbols_fd issue in src/mongo/platform/backtrace.cpp
-lpthread fixes the pthread error in thrd_party/ft-fix
Now I'm stuck with the next error:
[ 52%] Building CXX object src/mongo/client/CMakeFiles/mongocommon_client.dir/model.cpp.o
/mnt/qno/mongo/src/mongo/client/model.cpp: In member function 'virtual bool mongo::Model::load(mongo::BSONObj&)':
/mnt/qno/mongo/src/mongo/client/model.cpp:27:17: error: 'getScopedDbConnection' is not a member of 'mongo::ScopedDbConnection'
/mnt/qno/mongo/src/mongo/client/model.cpp: In member function 'virtual void mongo::Model::remove(bool)':
/mnt/qno/mongo/src/mongo/client/model.cpp:44:17: error: 'getScopedDbConnection' is not a member of 'mongo::ScopedDbConnection'
/mnt/qno/mongo/src/mongo/client/model.cpp: In member function 'virtual void mongo::Model::save(bool)':
/mnt/qno/mongo/src/mongo/client/model.cpp:59:17: error: 'getScopedDbConnection' is not a member of 'mongo::ScopedDbConnection'
I can't find anything related on google.
Related
Because of some requirements, I need to install doxygen on ubuntu 12.04, but I ran into problems with cmake...
The error log as follow:
~/doxygen/build$ cmake ..
-- Found BISON: /usr/bin/bison (found version "2.7")
-- The javacc executable not found, using existing files
-- Configuring done
CMake Error in liblodepng/CMakeLists.txt:
Target "lodepng" requires the language dialect "CXX14" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
CMake Error in libmscgen/CMakeLists.txt:
Target "mscgen" requires the language dialect "CXX14" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
CMake Error in libversion/CMakeLists.txt:
Target "doxygen_version" requires the language dialect "CXX14" (with
compiler extensions), but CMake does not know the compile flags to use to
enable it.
.
.
.
.
.
.
-- Generating done
-- Build files have been written to: /home/nfore/doxygen/build
#albert The problem has been resolved by update GCC into gcc-6 g++-6.
But I ran into new problems as follow:
clang version is Ubuntu clang version 3.4-1ubuntu3~precise2 (tags/RELEASE_34/final) (based on LLVM 3.4)
~/build$ cmake ..
~/build$ make
Building CXX object src/CMakeFiles/doxymain.dir/context.cpp.o
In file included from /home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/context.h:20:0,
from /home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/context.cpp:19:
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:238:20: error: enclosing class of constexpr non-static member function ‘bool TemplateVariant::isValid() const’ is not a literal type
constexpr bool isValid() const { return m_variant.valid(); }
^~~~~~~
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:92:7: note: ‘TemplateVariant’ is not literal because:
class TemplateVariant
^~~~~~~~~~~~~~~
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:92:7: note: ‘TemplateVariant’ has a non-trivial destructor
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:240:20: error: enclosing class of constexpr non-static member function ‘bool TemplateVariant::isBool() const’ is not a literal type
constexpr bool isBool() const { return m_variant.is<bool>(); }
.
.
.
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:311:27: error: enclosing class of constexpr non-static member function ‘const char* TemplateVariant::typeAsString() const’ is not a literal type
constexpr const char *typeAsString() const
^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/doxymain.dir/context.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/doxymain.dir/all] Error 2
make: *** [all] Error 2
I want to setup qt-creator for developing legacy librealsense in ubuntu16.04. I want to use CMake. I have librealsense installed on my system and the header files are in the "/usr/local/include" and the "librealsense.so" file is in the "/usr/local/lib". so I've created a simple CPP project with CMakeLists.txt and main.cpp files. my files are as follow:
main.cpp file:
#include <iostream>
#include <librealsense/rs.hpp>
int main()
{
rs::context ctx;
std::cout << "Hello World!" << std::endl;
return 0;
}
CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
project(realsense_r200)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_library(librealsense REQUIRED)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${librealsense_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${librealsense_INCLUDE_DIR})
there are two problems:
find_library(), can't find the librealsense and in the CMake cache list, in front of librealsense, I get NOT_FOUND.
to solve the first problem I added the "librealsense.so" path manually in the cache list. so I have no errors in the generation of make files. but how can I set it up to find the path automatically?
when I try to build my project I have undefined reference errors to some methods as below:
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs_apply_depth_control_preset(rs_device*, int)':
main.cpp:(.text+0x61d): undefined reference to `rs_set_device_options'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs_apply_ivcam_preset(rs_device*, rs_ivcam_preset)':
main.cpp:(.text+0x734): undefined reference to `rs_reset_device_options_to_default'
main.cpp:(.text+0x7d1): undefined reference to `rs_set_device_options'
main.cpp:(.text+0x869): undefined reference to `rs_set_device_options'
main.cpp:(.text+0x8ba): undefined reference to `rs_set_device_options'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::error::error(rs_error*)':
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x2a): undefined reference to `rs_get_error_message'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x74): undefined reference to `rs_get_failed_function'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x9b): undefined reference to `rs_get_failed_function'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x102): undefined reference to `rs_get_failed_args'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x129): undefined reference to `rs_get_failed_args'
main.cpp:(.text._ZN2rs5errorC2EP8rs_error[_ZN2rs5errorC5EP8rs_error]+0x190): undefined reference to `rs_free_error'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::context::context()':
main.cpp:(.text._ZN2rs7contextC2Ev[_ZN2rs7contextC5Ev]+0x30): undefined reference to `rs_create_context'
CMakeFiles/realsense_r200.dir/main.cpp.o: In function `rs::context::~context()':
main.cpp:(.text._ZN2rs7contextD2Ev[_ZN2rs7contextD5Ev]+0x1c): undefined reference to `rs_delete_context'
CMakeFiles/realsense_r200.dir/build.make:94: recipe for target 'realsense_r200' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/realsense_r200.dir/all' failed
Makefile:83: recipe for target 'all' failed
collect2: error: ld returned 1 exit status
make[2]: *** [realsense_r200] Error 1
make[1]: *** [CMakeFiles/realsense_r200.dir/all] Error 2
make: *** [all] Error 2
18:32:02: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project realsense_r200 (kit: Desktop)
When executing step "CMake Build"
as you see in the CMakeLists.txt file I've linked the "librealsense.so" file to the executable, why I get these errors and how can I solve it?
thanks for your help!!!
#
Edited Part
I changed my cmake file as below:
new CMake file:
cmake_minimum_required(VERSION 2.8)
project(realsense_r200)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_library(REALSENSE librealsense)
find_package(Threads)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${REALSENSE} ${CMAKE_THREAD_LIBS_INIT})
the undefined errors have gone, but I have new errors as below:
/usr/local/lib/librealsense.so: undefined reference to `std::thread::_State::~_State()#GLIBCXX_3.4.22'
/usr/local/lib/librealsense.so: undefined reference to `typeinfo for std::thread::_State#GLIBCXX_3.4.22'CMakeFiles/realsense_r200.dir/build.make:95: recipe for target 'realsense_r200' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/realsense_r200.dir/all' failed
Makefile:83: recipe for target 'all' failed
/usr/local/lib/librealsense.so: undefined reference to `std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)())#GLIBCXX_3.4.22'
collect2: error: ld returned 1 exit status
make[2]: *** [realsense_r200] Error 1
make[1]: *** [CMakeFiles/realsense_r200.dir/all] Error 2
make: *** [all] Error 2
23:35:55: The process "/usr/bin/cmake" exited with code 2.
Error while building/deploying project realsense_r200 (kit: Desktop)
When executing step "CMake Build"
I cross compiled libuv successfully and I'm trying to cross compile libwebsockets but I get the following error in make for arm with a buildroot toolchain.
Please advise.
libwebsockets
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=~/buildroot/output/host/share/buildroot/toolchainfile.cmake \
-DLWS_LIBUV_INCLUDE_DIRS=/tmp/cross/include \
-DLWS_ZLIB_LIBRARIES=/tmp/cross/lib/libuv.so
make
[ 31%] Building C object CMakeFiles/websockets_shared.dir/lib/roles/http/server/server.c.o
[ 32%] Building C object CMakeFiles/websockets_shared.dir/lib/roles/http/server/lws-spa.c.o
[ 33%] Building C object CMakeFiles/websockets_shared.dir/lib/event-libs/poll/poll.c.o
[ 33%] Building C object CMakeFiles/websockets_shared.dir/lib/event-libs/libuv/libuv.c.o
~/libwebsockets/lib/event-libs/libuv/libuv.c: In function ‘elops_destroy_context1_uv’:
~/libwebsockets/lib/event-libs/libuv/libuv.c:526:7: error: ‘m’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (m)
^
cc1: all warnings being treated as errors
CMakeFiles/websockets_shared.dir/build.make:1166: recipe for target 'CMakeFiles/websockets_shared.dir/lib/event-libs/libuv/libuv.c.o' failed
make[2]: *** [CMakeFiles/websockets_shared.dir/lib/event-libs/libuv/libuv.c.o] Error 1
CMakeFiles/Makefile2:363: recipe for target 'CMakeFiles/websockets_shared.dir/all' failed
make[1]: *** [CMakeFiles/websockets_shared.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
Why are you building libwebsockets manually, instead of using the libwebsockets package that we have in Buildroot ?
Unable to build C++ file with PostgreSQL in CLion 1.2 EAP.
CMake file:
cmake_minimum_required(VERSION 3.3)
project(PostgreSQLTest)
find_package(PostgreSQL REQUIRED)
set(PostgreSQL_INCLUDE_DIRS, "C:\\Program Files\\PostgreSQL\\9.4\\include")
include_directories (${PostgreSQL_INCLUDE_DIRS})
set(SOURCES main.cpp)
add_executable(PostgreSQLTest ${SOURCES})
set(PostgreSQL_LIBRARIES, "C:\\Program Files\\PostgreSQL\\9.4\\lib")
target_link_libraries(PostgreSQLTest ${PostgreSQL_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
CMakeLists.txt
main.cpp)
Build messages:
"C:\Program Files (x86)\JetBrains\CLion 142.4859.12\bin\cmake\bin\cmake.exe" --build C:\Users\darin\.CLion12\system\cmake\generated\f846c544\f846c544\Debug --target PostgreSQLTest -- -j 8
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/darin/.CLion12/system/cmake/generated/f846c544/f846c544/Debug
[ 50%] Linking CXX executable PostgreSQLTest.exe
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -llibpq
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [PostgreSQLTest.exe] Error 1
CMakeFiles\PostgreSQLTest.dir\build.make:96: recipe for target 'PostgreSQLTest.exe' failed
mingw32-make.exe[2]: *** [CMakeFiles/PostgreSQLTest.dir/all] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/PostgreSQLTest.dir/all' failed
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/PostgreSQLTest.dir/rule' failed
Makefile:117: recipe for target 'PostgreSQLTest' failed
mingw32-make.exe[1]: *** [CMakeFiles/PostgreSQLTest.dir/rule] Error 2
mingw32-make.exe: *** [PostgreSQLTest] Error 2
Does anyone have experience with this build?
EDIT AFTER APPLYING CHANGES FROM COMMENT 2015-09-21
cmake_minimum_required(VERSION 3.3)
project(PostgreSQLTest)
set(PostgreSQL_ROOT, "C:\\Program Files\\PostgreSQL\\9.4")
find_package(PostgreSQL REQUIRED)
set(SOURCES main.cpp)
add_executable(PostgreSQLTest ${SOURCES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
CMakeLists.txt
main.cpp)
Errors:
"C:\Program Files (x86)\JetBrains\CLion 142.4859.12\bin\cmake\bin\cmake.exe" --build C:\Users\darin\.CLion12\system\cmake\generated\f846c544\f846c544\Debug --target PostgreSQLTest -- -j 8
[ 50%] Building CXX object CMakeFiles/PostgreSQLTest.dir/main.cpp.obj
C:\Users\darin\ClionProjects\PostgreSQLTest\main.cpp:2:22: fatal error: libpq-fe.h: No such file or directory
#include "libpq-fe.h"
^
compilation terminated.
mingw32-make.exe[3]: *** [CMakeFiles/PostgreSQLTest.dir/main.cpp.obj] Error 1
CMakeFiles\PostgreSQLTest.dir\build.make:61: recipe for target 'CMakeFiles/PostgreSQLTest.dir/main.cpp.obj' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/PostgreSQLTest.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/PostgreSQLTest.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/PostgreSQLTest.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/PostgreSQLTest.dir/rule] Error 2
Makefile:117: recipe for target 'PostgreSQLTest' failed
mingw32-make.exe: *** [PostgreSQLTest] Error 2
I have confirmed that libpq-fh.h does exist in C:\Program Files\PostgreSQL\9.4\include, so there must still be something incorrect in my Cmake file that's preventing the building.
Am I missing a target_link_libraries() that's required to build?
EDIT 2 AFTER APPLYING RECOMMENDED CHANGES
cmake_minimum_required(VERSION 3.3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project(PostgreSQLTest)
set(PostgreSQL_ROOT "C:\\Program Files\\PostgreSQL\\9.4")
find_package(PostgreSQL REQUIRED)
set(SOURCES main.cpp)
add_executable(PostgreSQLTest ${SOURCES})
set(PostgreSQL_LIBRARIES "C:\\Program Files\\PostgreSQL\\9.4\\lib")
target_link_libraries(PostgreSQLTest ${PostgreSQL_LIBRARIES})
set(SOURCE_FILES
CMakeLists.txt
main.cpp)
ERRORS:
"C:\Program Files (x86)\JetBrains\CLion 142.4859.12\bin\cmake\bin\cmake.exe" --build C:\Users\darin\.CLion12\system\cmake\generated\f846c544\f846c544\Debug --target all -- -j 8
[ 50%] Building CXX object CMakeFiles/PostgreSQLTest.dir/main.cpp.obj
C:\Users\darin\ClionProjects\PostgreSQLTest\main.cpp:2:22: fatal error: libpq-fe.h: No such file or directory
#include "libpq-fe.h"
^
compilation terminated.
mingw32-make.exe[2]: *** [CMakeFiles/PostgreSQLTest.dir/main.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/PostgreSQLTest.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
CMakeFiles\PostgreSQLTest.dir\build.make:61: recipe for target 'CMakeFiles/PostgreSQLTest.dir/main.cpp.obj' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/PostgreSQLTest.dir/all' failed
Makefile:82: recipe for target 'all' failed
I made the recommended changes, tried several different orders for the compilation, and it's still failing.
Any ideas?
EDITS TO MAKE AFTER COMMENT ON 2015-10-05
cmake_minimum_required(VERSION 3.3)
project(PostgreSQLTest)
# For *modify* CMAKE_CXX_FLAGS, this should come after project() call.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Next line is not required, without it given path will be checked too.
#set(PostgreSQL_ROOT "C:\\Program Files (x86)\\PostgreSQL\\9.4")
#set(PostgreSQL ROOT "C:\\MinGW\\compiledLibs\\psql\\postgresql-9.6devel\\tmp_install\\usr\\local\\pgsql")
set(PostgreSQL ROOT "C:\\MinGW\\msys\\1.0\\local\\pgsql")
find_package(PostgreSQL REQUIRED)
message("PostgreSQL_LIBRARY_DIRS: ${PostgreSQL_LIBRARY_DIRS}")
# Now variables PostgreSQL_INCLUDE_DIRS, PostgreSQL_LIBRARIES are set. Just use them.
include_directories (${PostgreSQL_INCLUDE_DIRS})
link_directories(${PostgreSQL_LIBRARY_DIRS})
set(SOURCES main.cpp)
add_executable(PostgreSQLTest ${SOURCES})
target_link_libraries(PostgreSQLTest ${PostgreSQL_LIBRARIES})
set(SOURCE_FILES
CMakeLists.txt
main.cpp)
I don't find anything that indicates the posgres library used.
"C:\Program Files (x86)\JetBrains\CLion 142.4859.12\bin\cmake\bin\cmake.exe" --build C:\Users\darin\.CLion12\system\cmake\generated\f846c544\f846c544\Debug --target all -- -j 8
[ 50%] Building CXX object CMakeFiles/PostgreSQLTest.dir/main.cpp.obj
[100%] Linking CXX executable PostgreSQLTest.exe
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z9CloseConnP7pg_conn':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:9: undefined reference to `PQfinish'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z9ConnectDBv':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:19: undefined reference to `PQconnectdb'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:22: undefined reference to `PQstatus'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z19CreateEmployeeTableP7pg_conn':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:39: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:41: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:44: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:51: undefined reference to `PQclear'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z17InsertEmployeeRecP7pg_connPKcS2_':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:66: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:68: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:71: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:78: undefined reference to `PQclear'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z16FetchEmployeeRecP7pg_conn':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:88: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:90: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:93: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:98: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:101: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:102: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:105: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:110: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:112: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:114: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:117: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:122: undefined reference to `PQnfields'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:128: undefined reference to `PQfname'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:135: undefined reference to `PQgetvalue'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:132: undefined reference to `PQntuples'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:139: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:142: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:143: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:146: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:149: undefined reference to `PQclear'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z20RemoveAllEmployeeRecP7pg_conn':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:156: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:158: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:161: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:168: undefined reference to `PQclear'
CMakeFiles\PostgreSQLTest.dir/objects.a(main.cpp.obj): In function `Z17DropEmployeeTableP7pg_conn':
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:175: undefined reference to `PQexec'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:177: undefined reference to `PQresultStatus'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:180: undefined reference to `PQclear'
C:/Users/darin/ClionProjects/PostgreSQLTest/main.cpp:187: undefined reference to `PQclear'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\PostgreSQLTest.dir\build.make:96: recipe for target 'PostgreSQLTest.exe' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/PostgreSQLTest.dir/all' failed
Makefile:82: recipe for target 'all' failed
mingw32-make.exe[2]: *** [PostgreSQLTest.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/PostgreSQLTest.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
Correct CMakeLists.txt:
cmake_minimum_required(VERSION 3.3)
project(PostgreSQLTest)
# For *modify* CMAKE_CXX_FLAGS, this should come after project() call.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Next line is not required, without it given path will be checked too.
set(PostgreSQL_ROOT "C:\\Program Files\\PostgreSQL\\9.4")
find_package(PostgreSQL REQUIRED)
# Now variables PostgreSQL_INCLUDE_DIRS, PostgreSQL_LIBRARIES, PostgreSQL_LIBRARY_DIRS are set. Just use them.
include_directories (${PostgreSQL_INCLUDE_DIRS})
link_directories(${PostgreSQL_LIBRARY_DIRS})
set(SOURCES main.cpp)
add_executable(PostgreSQLTest ${SOURCES})
target_link_libraries(PostgreSQLTest ${PostgreSQL_LIBRARIES})
set(SOURCE_FILES
CMakeLists.txt
main.cpp)
Main(but not solely) purpose of find_package(PostgreSQL) call is to set variables PostgreSQL_INCLUDE_DIRS, PostgreSQL_LIBRARIES, PostgreSQL_LIBRARY_DIRS (and some others). No needs to set these variables manually afterwards, just use them.
just use this, tested on mac.
cmake_minimum_required(VERSION 3.6)
project(postgres)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_custom_target(postgres COMMAND make -C ${postgres_SOURCE_DIR})
cmake done
I tried to install Orion context Broker on Ubuntu 14.04 with Alien but when I do contextBroker start it says:
contextBroker: error while loading shared libraries: libboost_thread-mt.so.5: cannot open shared object file: No such file or directory
I couldn't find where is the error then I tried to install with all the dependencies from the instructions in Git, but when I try to do the make it makes an error:
[ 26%] Building CXX object src/lib/serviceRoutines/CMakeFiles/serviceRoutines.dir/exitTreat.cpp.o
In file included from /home/sistemas/fiware-orion-develop/src/lib/serviceRoutines/exitTreat.cpp:32:0:
/home/sistemas/fiware-orion-develop/src/lib/mongoBackend/MongoGlobal.h:30:35: fatal error: mongo/client/dbclient.h: No existe el archivo o el directorio
#include "mongo/client/dbclient.h"
I have the mongo's driver installed, how can I solve this?
Finally I compile a new driver from https://github.com/mongodb/mongo-cxx-driver/releases and it continues compiling until:
*
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp: In function ‘void recoverOnTimeIntervalThread(std::string, mongo::BSONObj&)’:
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:532:40: error: ‘class mongo::OID’ has no member named ‘str’
std::string subId = idField.OID().str();
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp: In function ‘void destroyOnTimeIntervalThread(std::string, mongo::BSONObj&)’:
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:583:40: error: ‘class mongo::OID’ has no member named ‘str’
std::string subId = idField.OID().str();
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp: In function ‘void releaseTriggeredSubscriptions(std::map<std::basic_string<char>, TriggeredSubscription*>&)’:
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:17: error: ‘string’ was not declared in this scope
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:17: note: suggested alternative:
In file included from /usr/include/c++/4.9/iosfwd:39:0,
from /usr/include/boost/smart_ptr/shared_ptr.hpp:49,
from /usr/include/boost/shared_ptr.hpp:17,
from /usr/include/mongo/client/dbclient_rs.h:20,
from /usr/include/mongo/client/dbclient.h:59,
from /home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:27:
/usr/include/c++/4.9/bits/stringfwd.h:62:33: note: ‘std::string’
typedef basic_string<char> string;
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:47: error: template argument 1 is invalid
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:47: error: template argument 3 is invalid
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:47: error: template argument 4 is invalid
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:59: error: invalid type in declaration before ‘it’
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:59: error: expected ‘;’ before ‘it’
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:59: error: ‘it’ was not declared in this scope
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:94: error: expected ‘)’ before ‘;’ token
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:50: error: unused variable ‘iterator’ [-Werror=unused-variable]
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
^
/home/sistemas/fiware-orion/src/lib/mongoBackend/MongoGlobal.cpp:1911:98: error: ‘it’ was not declared in this scope
for (std::map<string, TriggeredSubscription*>::iterator it = subs.begin(); it != subs.end(); ++it)
^
cc1plus: all warnings being treated as errors
make[3]: *** [src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/MongoGlobal.cpp.o] Error 1
make[3]: se sale del directorio «/home/sistemas/fiware-orion/BUILD_RELEASE»
make[2]: *** [src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/all] Error 2
make[2]: *** Se espera a que terminen otras tareas....
[ 88%] Building CXX object src/lib/xmlParse/CMakeFiles/xmlParse.dir/xmlRegisterProviderRequest.cpp.o
*
Is a problem in a file of Orion Context Broker?
I think that it could be a problem with de mongo's driver again but I try to install another one older and it doesn't work. I also think it can be a problem with de -mt libraries that doesn't exist in boost anymore, but nothing that I try until now works.
I've installed Orion CB using Ubuntu 14.04 LTS as host. I've also found some problems with libboost_thread-mt.so libraries. Solved this way:
Get & install packages
boost-thread-1.41.0-25.el6.x86_64.rpm
boost-system-1.41.0-25.el6.x86_64.rpm
boost-filesystem-1.41.0-25.el6.x86_64.rpm
and install them using alien. Then, the libraries were installed in “/usr/lib64” folder. To correct this (and CB is able to locate them): create a .conf file within “/etc/ld.so.conf.d/”, add a line (“/usr/lib64”) within and save it and quit and reload your configuration by calling (“sudo ldconfig”)
Hope this helps
So, here we have two questions in one. Let's start with the first one, about shared library not found:
Ask the broker where the library should be, using "ldd $(which contextBroker) | grep boost_thread).
After running this command, make sure the library is there. If it is not, but you have it elsewhere, you should be able to use the env var LD_LIBRARY_PATH to point to the directory where the library is found.
Now, for the second question, the mongo driver includes are not found. In my machine, I have them in /usr/local/include/mongo => I'm ok with the -I/usr/local/include directive to the compiler.
If you have your mongo driver installed elsewhere, you might need to add another 'include-directory' for the compilation. This would be done in the top-level CMakeLists.txt (I guess using 'include_directories' - I'm far from a cmake expert :-)).
When building, to see detailed information, compile like this:
% CPU_COUNT=1 VERBOSE=1 make install
Post the info again here unless you manage to solve your problems.