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
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.
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?
I'm getting the following error when I try to compile vrpn 7.33 on a Mac. It says that libusb was compiled for a different architecture than vrpn is being compiled:
Linking CXX executable client_and_server
ld: warning: ignoring file /usr/local/lib/libusb-1.0.dylib, file was built for i386 which is not the architecture being linked (x86_64): /usr/local/lib/libusb-1.0.dylib
Undefined symbols for architecture x86_64:
"_libusb_claim_interface", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_close", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_exit", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_init", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_open_device_with_vid_pid", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.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]: *** [server_src/client_and_server] Error 1
make[1]: *** [server_src/CMakeFiles/client_and_server.dir/all] Error 2
make: *** [all] Error 2
But when I recompile libusb changing the architecture to x86_64 I start getting the following error:
Linking CXX executable client_and_server
ld: warning: ignoring file /usr/local/lib/libusb-1.0.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libusb-1.0.dylib
Undefined symbols for architecture i386:
"_libusb_claim_interface", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_close", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_exit", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_init", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_open_device_with_vid_pid", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [server_src/client_and_server] Error 1
make[1]: *** [server_src/CMakeFiles/client_and_server.dir/all] Error 2
make: *** [all] Error 2
Notice how now the linker is searching for the original i386 architecture.
Why does vrpn complain in both cases?
vrpn is being compiled for multiple architectures at the same time. That is why a compiling libusb for a single architecture doesn't work.
The solution is to compile libusbfor the two architecutres at the same time using the following sequence of commands:
./configure
make CFLAGS="-arch x86_64 -arch i386" LDFLAGS="-arch x86_64 -arch i386"
sudo make install
If you want more information about compiling Universal binaries in Mac OS X check this link:
Compiling Your Code in OS X (Compiling for Multiple CPU Architectures)
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.