I’m following the manual here: ROS Manual Page When I try to make the program:
make -j8
I’m getting the following error:
Linking CXX shared library ../devel/lib/librospack.dylib
Linking CXX shared library ../devel/lib/librosconsole.dylib
Undefined symbols for architecture x86_64:
"boost::filesystem3::path::wchar_t_codecvt_facet()", referenced from:
boost::filesystem3::path::codecvt() in rospack.cpp.o
Undefined symbols for architecture x86_64:
"boost::this_thread::get_id()", referenced from:
ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...) in rosconsole.cpp.o
ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, std::basic_stringstream<char, std::char_traits, std::allocator > const&, char const*, int, char const*) in rosconsole.cpp.o
ros::console::ThreadToken::getString(log4cxx::helpers::ObjectPtrT const&) in rosconsole.cpp.o
ld: symbol(s) not found for architecture x86_64
"boost::filesystem3::path::m_erase_redundant_separator(unsigned long)", referenced from:
boost::filesystem3::path& boost::filesystem3::path::append(std::string const&, std::codecvt<wchar_t, char, __mbstate_t> const&) in rospack.cpp.o
"boost::filesystem3::path::m_append_separator_if_needed()", referenced from:
boost::filesystem3::path& boost::filesystem3::path::append(std::string const&, std::codecvt<wchar_t, char, __mbstate_t> const&) in rospack.cpp.o
"boost::filesystem3::path::operator/=(boost::filesystem3::path const&)", referenced from:
rospack::Rosstackage::exports_dry_package(rospack::Stackage*, std::string const&, std::string const&, std::vector<std::string, std::allocator >&) in rospack.cpp.o
boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&) in rospack.cpp.o
"boost::filesystem3::detail::current_path(boost::system::error_code*)", referenced from:
boost::filesystem3::current_path() in rospack.cpp.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [devel/lib/librosconsole.dylib] Error 1
"boost::filesystem3::detail::dir_itr_close(void*&, void*&)", referenced from:
make[1]: *** [rosconsole/CMakeFiles/rosconsole.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
boost::filesystem3::detail::dir_itr_imp::~dir_itr_imp() in rospack.cpp.o
"boost::filesystem3::detail::create_directory(boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
boost::filesystem3::create_directory(boost::filesystem3::path const&) in rospack.cpp.o
"boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_iterator&, boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
boost::filesystem3::directory_iterator::directory_iterator(boost::filesystem3::path const&) in rospack.cpp.o
"boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)", referenced from:
boost::filesystem3::directory_iterator::increment() in rospack.cpp.o
"boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
boost::filesystem3::is_directory(boost::filesystem3::path const&) in rospack.cpp.o
boost::filesystem3::is_regular_file(boost::filesystem3::path const&) in rospack.cpp.o
boost::filesystem3::exists(boost::filesystem3::path const&) in rospack.cpp.o
"boost::filesystem3::path::parent_path() const", referenced from:
rospack::Rosstackage::inStackage(std::string&) in rospack.cpp.o
"boost::filesystem3::path::filename() const", referenced from:
rospack::Rosstackage::isStackage(std::string const&) in rospack.cpp.o
rospack::Rosstackage::crawlDetail(std::string const&, bool, int, bool, std::vector<rospack::DirectoryCrawlRecord*, std::allocator<rospack::DirectoryCrawlRecord*> >&, boost::unordered_set<std::string, boost::hash, std::equal_to, std::allocator >&) in rospack.cpp.o
rospack::Rosstackage::inStackage(std::string&) in rospack.cpp.o
rospack::Rosstackage::addStackage(std::string const&) in rospack.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]: *** [devel/lib/librospack.dylib] Error 1
make[1]: *** [rospack/CMakeFiles/rospack.dir/all] Error 2
make: *** [all] Error 2
The problem is when linking the following libraries: rospack and rosconsole To compile and link the libraries, the ROS package is using:
CMake
Cmake is a tool for helping software compilation. It creates the Makefiles necessary for compiling. To achieve that, it’s necessary to create files that will inform the dependencies and whatnot into the packages being built. These files containing the information of how to compile and what is necessary to compile these files are CMakeLists.txt. There is a command to include external libraries called find_package. The problem seems to be that when finding the package, CMake is including a newer version of the library that I need (in my case boost). To include a specific version of a library, you can write the following:
find_package(<library_name> <version_number> EXACT)
In my case I wrote:
find_package(boost 1.47 EXACT)
Then when I tried to build the packages running:
make VERBOSE=1
It said that the library installed was not the one required, it was a new one in /usr/local/. So I installed an older version of the library with homebrew. Using the following commands:
$ brew versions boost
$ git checkout 57665ff /usr/local/Library/Formula/boost.rb
$ brew install boost
$ git checkout master
EDIT #1: It seems that this is a known issue.
EDIT #2: Running gdb with the program appears to show the probable problem that is causing the program to present the malloc issue. GDB is a tool to debug running code, allowing to see what is going on “inside” the program. I ran the following code:
$ gdb rospack
which outputs the following message:
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v2/src/v2_operations.o" - no debug information available for "v2_operations.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v2/src/v2_path.o" - no debug information available for "v2_path.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v2/src/v2_portability.o" - no debug information available for "v2_portability.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/operations.o" - no debug information available for "operations.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/path.o" - no debug information available for "path.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/portability.o" - no debug information available for "portability.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/codecvt_error_category.o" - no debug information available for "codecvt_error_category.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/path_traits.o" - no debug information available for "path_traits.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/unique_path.o" - no debug information available for "unique_path.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/filesystem/build/darwin-4.2.1/release/threading-multi/v3/src/utf8_codecvt_facet.o" - no debug information available for "utf8_codecvt_facet.cpp".
.
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/cmdline.o" - no debug information available for "cmdline.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/config_file.o" - no debug information available for "config_file.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/options_description.o" - no debug information available for "options_description.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/parsers.o" - no debug information available for "parsers.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/variables_map.o" - no debug information available for "variables_map.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/value_semantic.o" - no debug information available for "value_semantic.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/positional_options.o" - no debug information available for "positional_options.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/utf8_codecvt_facet.o" - no debug information available for "utf8_codecvt_facet.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/convert.o" - no debug information available for "convert.cpp".
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/program_options/build/darwin-4.2.1/release/threading-multi/split.o" - no debug information available for "split.cpp".
.
warning: Could not find object file "/private/tmp/boost-HXkH/boost_1_47_0/bin.v2/libs/system/build/darwin-4.2.1/release/threading-multi/error_code.o" - no debug information available for "error_code.cpp".