undefined reference to `boost::filesystem::detail::copy_file - boost

I am trying to install Nova and HoneyD on a CentOS 7 machine but i have found myself with a problem.
The problem is that after I use the command make i get the following errors:
Config.cpp:(.text+0xa2d6): undefined reference to `boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::copy_option, boost::system::error_code*)'
../../NovaLibrary/Release//libNovaLibrary.a(NovaUtil.o): In function `Nova::RecursiveDirectoryCopy(boost::filesystem::path const&, boost::filesystem::path const&, bool)':
NovaUtil.cpp:(.text+0x25a4): undefined reference to `boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::copy_option, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
make[2]: *** [novad] Error 1
make[2]: Leaving directory `/usr/share/Nova/Novad/Release'
make[1]: *** [novad-release] Error 2
make[1]: Leaving directory `/usr/share/Nova'
make: *** [release] Error 2
How could i fix this problem?

I found the solution to my own question.
The solution is to edit the file Config.cpp and substitute the line:
#include <boost/filesystem.hpp>
For the following:
#define BOOST_NO_CXX11_SCOPED_ENUMS
#include <boost/filesystem.hpp>
#undef BOOST_NO_CXX11_SCOPED_ENUMS
After I did that i stopped getting the error.

Related

Failed to compile opengauss

I failed to compile opengauss. The error messages are showed following.
[ 97%] Built target ecpg_compat
make[2]: *** [src/bin/pg_basebackup/gs_basebackup] Error 1
make[1]: *** [src/bin/pg_basebackup/CMakeFiles/gs_basebackup.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 97%] Built target pq_ce
CMakeFiles/gs_ctl.dir/backup.cpp.o: In function `BaseBackup(char const*, unsigned int)':
/home/data/database/openGauss-server/src/bin/pg_ctl/backup.cpp:1430: undefined reference to `GetMotCheckpointDir(char const*)'
/home/data/database/openGauss-server/src/bin/pg_ctl/backup.cpp:1431: undefined reference to `FetchMotCheckpoint(char const*, pg_conn*, char const*, bool, char, int)'
CMakeFiles/gs_ctl.dir/pg_ctl.cpp.o: In function `do_incremental_build(unsigned int)':
/home/data/database/openGauss-server/src/bin/pg_ctl/pg_ctl.cpp:4457: undefined reference to `GetMotCheckpointDir(char const*)'
/home/data/database/openGauss-server/src/bin/pg_ctl/pg_ctl.cpp:4458: undefined reference to `FetchMotCheckpoint(char const*, pg_conn*, char const*, bool, char, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/bin/pg_ctl/gs_ctl] Error 1
make[1]: *** [src/bin/pg_ctl/CMakeFiles/gs_ctl.dir/all] Error 2
I downloaded the source code of openGauss-server from https://github.com/opengauss-mirror/openGauss-server and the third party library from https://github.com/opengauss-mirror/openGauss-third_party and compiled according to this instruction https://github.com/opengauss-mirror/openGauss-server/blob/master/README.en.md
Did I miss anything?
There is one build option named as "enable_mot". You can disable it and pass building.
Meanwhile, I'd like to suggest using configure/make to complete the build as readme shows.

Unable to compile library, symbol not found when running make

I am trying to compile a library, MultiNest. I am on Mac OS Catalina, 10.15.6. The instructions to do so are
git clone https://github.com/JohannesBuchner/MultiNest
cd MultiNest/build
cmake ..
make
I get this error when running make:
Undefined symbols for architecture x86_64:
"___nested_MOD_nestrun", referenced from:
_run in eggbox.c.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/eggboxC] Error 1
make[1]: *** [src/example_eggbox_C/CMakeFiles/eggboxC.dir/all] Error 2
make: *** [all] Error 2

rocksdb build failed in Clion at MacOS

My environment:
macOS 10.14
Clion 2018.1.2
gcc-8.2
I want to use Clion to try the rocksdb. I add a new CMakeLists.txt file at examples directory.
CMakeLists.txt:
add_subdirectory(examples)
examples/CMakeLists.txt:
add_executable(s_test simple_example.cc)
target_link_libraries(s_test ${LIBS})
But when I build the s_test executable, I get the error as follows.
Linking CXX shared library librocksdb.dylib
Undefined symbols for architecture x86_64:
"google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)", referenced from:
__static_initialization_and_destruction_0(int, int) in db_bench_tool.cc.o
__static_initialization_and_destruction_0(int, int) in trace_analyzer_tool.cc.o
"google::SetUsageMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
rocksdb::db_bench_tool(int, char**) in db_bench_tool.cc.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[3]: *** [librocksdb.5.17.0.dylib] Error 1
make[2]: *** [CMakeFiles/rocksdb-shared.dir/all] Error 2
make[1]: *** [examples/CMakeFiles/s_test.dir/rule] Error 2
And I already installed the gflags previously.
ls /usr/local/lib | grep gflags
libgflags.2.2.1.dylib
libgflags.2.2.dylib
libgflags.dylib
libgflags_nothreads.2.2.1.dylib
libgflags_nothreads.2.2.dylib
libgflags_nothreads.dylib
How to solve it? Thank you!
You will need to pull down the gflags package from git hub. I also use CLION.
So, this is the procedure I followed to pull down rocksdb and gflags:
~> cd CLionProjects
~/CLionProjects> git clone git#github.com:facebook/rocksdb.git
~/CLionProjects> cd rocksdb
~/CLionProjects/rocksdb> git clone git#github.com:gflags/gflags.git
I then created gflagss.cmake at
~/CLionProjects/rocksdb/cmake/modules
with the following content:
# - Find GFLAGS
set(GFLAGS_ROOT_DIR ./gflags/cmake-build-debug)
find_path(GFLAGS_INCLUDE_DIR
NAMES bzlib.h
HINTS ${GFLAGS_ROOT_DIR}/include)
find_library(GFLAGS_LIBRARIES
NAMES gflags
HINTS ${GFLAGS_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(bzip2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
mark_as_advanced(
GFLAGS_LIBRARIES
GFLAGS_INCLUDE_DIR)
I then opened the gflags folder in CLion and built glfags.
I then opened a separate CLion window/folder for rocksdb and built that.

C++ Boost filesystem library compilation error

I am new to c++ and I am using CLion on a Mac. I would like to use the boost 1.65.0 filesystem library. When I add the following import statement the console app doesn't compile.
#include <boost/filesystem.hpp>
I get the following error:
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init.2 in main.cpp.o
"boost::system::generic_category()", referenced from:
boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in main.cpp.o
boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in main.cpp.o
___cxx_global_var_init in main.cpp.o
___cxx_global_var_init.1 in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [sandbox] Error 1
make[2]: *** [CMakeFiles/sandbox.dir/all] Error 2
make[1]: *** [CMakeFiles/sandbox.dir/rule] Error 2
make: *** [sandbox] Error 2
CMake file:
cmake_minimum_required(VERSION 3.8)
project(sandbox)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES src/main.cpp)
find_package(Boost)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIR})
endif()
add_executable(sandbox ${SOURCE_FILES})
target_link_libraries (sandbox ${Boost_LIBRARIES})
Other libraries such as the boost string library works fine. But I cant use the filesystem library. Any idea what I am doing wrong?

Trying build OpenNI samples with CMakeLists.txt but getting error

I have mad my own CMakeLists.txt file to build OpenNI samples. I successfully build NiSimpleViewer. But when try with NiUserTracker I get this error:
35 warnings generated.
Linking CXX executable main
ld: warning: path '/usr/lib/libOpenNI.dylib' following -L not a directory
Undefined symbols for architecture x86_64:
"DrawDepthMap(xn::DepthMetaData const&, xn::SceneMetaData const&)", referenced from:
glutDisplay() in main.cpp.o
"MyPoseInProgress(xn::PoseDetectionCapability&, char const*, unsigned int, XnPoseDetectionStatus, void*)", referenced from:
_main in main.cpp.o
"MyCalibrationInProgress(xn::SkeletonCapability&, unsigned int, XnCalibrationStatus, void*)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
This is the CMakeLists I use. Plese tell me what's wrong with it?
http://pastebin.com/SMYjjU35
The contents of folder outside build/ are
CMakeLists.txt Libs build opengles.cpp
GL SceneDrawer.cpp glh opengles.h
GLES SceneDrawer.h main.cpp
I guess, it's because of this line:
link_directories(${OPENNI_LIBRARY})
The link_directories() command sets path where libraries should be searched for, so you need something like ${OPENNI_LIBRARY_DIRS} there.

Resources