sharedstructures
sharedstructures copied to clipboard
Compliation errror due to reference and linking problems
I get the compliation errror:
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(LogarithmicAllocator.cc.o): in function
sharedstructures::LogarithmicAllocator::verify() const':
/home/ilja/sharedstructures/src/LogarithmicAllocator.cc:514: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /home/ilja/sharedstructures/src/LogarithmicAllocator.cc:519: undefined reference to
string_printf[abi:cxx11](char const*, ...)'
/usr/bin/ld: /home/ilja/sharedstructures/src/LogarithmicAllocator.cc:523: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /home/ilja/sharedstructures/src/LogarithmicAllocator.cc:531: undefined reference to
string_printf[abi:cxx11](char const*, ...)'
/usr/bin/ld: /home/ilja/sharedstructures/src/LogarithmicAllocator.cc:540: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(LogarithmicAllocator.cc.o):/home/ilja/sharedstructures/src/LogarithmicAllocator.cc:545: more undefined references to
string_printf[abi:cxx11](char const*, ...)' follow
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::open_segment(char const*, int, unsigned int, bool)': /home/ilja/sharedstructures/src/Pool.cc:20: undefined reference to
shm_open'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::unlink_segment(char const*, bool)': /home/ilja/sharedstructures/src/Pool.cc:28: undefined reference to
shm_unlink'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::Pool::Pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, bool)': /home/ilja/sharedstructures/src/Pool.cc:34: undefined reference to
scoped_fd::scoped_fd()'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:45: undefined reference to scoped_fd::operator=(int)' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:46: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:47: undefined reference to scoped_fd::operator=(int)' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:48: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:49: undefined reference to cannot_open_file::cannot_open_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:53: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:53: undefined reference to fstat(int)' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:59: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:69: undefined reference to scoped_fd::operator int() const' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:72: undefined reference to
string_for_errorabi:cxx11'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:75: undefined reference to scoped_fd::operator int() const' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:34: undefined reference to
scoped_fd::~scoped_fd()'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::Pool::~Pool()': /home/ilja/sharedstructures/src/Pool.cc:86: undefined reference to
scoped_fd::~scoped_fd()'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::Pool::expand(unsigned long)': /home/ilja/sharedstructures/src/Pool.cc:108: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:109: undefined reference to string_for_error[abi:cxx11](int)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function
sharedstructures::Pool::check_size_and_remap() const':
/home/ilja/sharedstructures/src/Pool.cc:120: undefined reference to scoped_fd::operator int() const' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:120: undefined reference to
fstat(int)'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:126: undefined reference to scoped_fd::operator int() const' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:129: undefined reference to
string_for_errorabi:cxx11'
/usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:130: undefined reference to scoped_fd::operator int() const' /usr/bin/ld: /home/ilja/sharedstructures/src/Pool.cc:131: undefined reference to
string_printf[abi:cxx11](char const*, ...)'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::Pool::map_and_call(unsigned long, unsigned long, std::function<void (void*, unsigned long)>)': /home/ilja/sharedstructures/src/Pool.cc:148: undefined reference to
scoped_fd::operator int() const'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(Pool.cc.o): in function sharedstructures::Pool::delete_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)': /home/ilja/sharedstructures/src/Pool.cc:166: undefined reference to
string_for_errorabi:cxx11'
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(PrefixTree.cc.o): in function sharedstructures::PrefixTree::LookupResult::str[abi:cxx11]() const': /home/ilja/sharedstructures/src/PrefixTree.cc:107: undefined reference to
string_printf[abi:cxx11](char const*, ...)'
/usr/bin/ld: /home/ilja/sharedstructures/src/PrefixTree.cc:109: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /home/ilja/sharedstructures/src/PrefixTree.cc:111: undefined reference to
string_printf[abi:cxx11](char const*, ...)'
/usr/bin/ld: /home/ilja/sharedstructures/src/PrefixTree.cc:113: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(PrefixTree.cc.o): in function
sharedstructures::PrefixTree::get_structure_for_contents[abi:cxx11](unsigned long) const':
/home/ilja/sharedstructures/src/PrefixTree.cc:1447: undefined reference to string_printf[abi:cxx11](char const*, ...)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(PrefixTree.cc.o):/home/ilja/sharedstructures/src/PrefixTree.cc:1456: more undefined references to
string_printf[abi:cxx11](char const*, ...)' follow
/usr/bin/ld: /usr/local/lib/libsharedstructures.a(ProcessLock.cc.o): in function sharedstructures::this_process_token()': /home/ilja/sharedstructures/src/ProcessLock.cc:63: undefined reference to
getpid_cached()'
/usr/bin/ld: /usr[ 3%] Built target sensor_msgs_generate_messages_eus
/local/lib/libsharedstructures.a(ProcessLock.cc.o): in function sharedstructures::process_for_token_is_running(int)': /home/ilja/sharedstructures/src/ProcessLock.cc:89: undefined reference to
pid_exists(int)'
/usr/bin/ld: /home/ilja/sharedstructures/src/ProcessLock.cc:92: undefined reference to pid_is_zombie(int)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(ProcessLock.cc.o): in function
sharedstructures::futex_wait(std::atomicstring_for_error[abi:cxx11](int)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(ProcessLock.cc.o): in function
sharedstructures::futex_wake(std::atomicstring_for_error[abi:cxx11](int)' /usr/bin/ld: /usr/local/lib/libsharedstructures.a(ProcessLock.cc.o): in function
sharedstructures::wait_for_reader_drain(sharedstructures::ProcessReadWriteLock, bool)':
/home/ilja/sharedstructures/src/ProcessLock.cc:242: undefined reference to getpid_cached()' collect2: error: ld returned 1 exit status make[2]: *** [01_gpr/mmcl_cpp_particle_weight/CMakeFiles/example_sharedmemory_node.dir/build.make:107: /home/ilja/01_lobabo_ego_ws/ros1/devel/lib/mmcl_cpp_particle_weight/example_sharedmemory_node] Error 1 make[1]: *** [CMakeFiles/Makefile2:7672: 01_gpr/mmcl_cpp_particle_weight/CMakeFiles/example_sharedmemory_node.dir/all] Error 2
Question
How do I solve this :)
In cmakelists I do actually everything right:
find_library(ARRAY_LIBRARY sharedstructures PATHS /usr/lib /usr/local/lib)
include_directories( include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} /home/ilja/sharedstructures/src /home/ilja/sharedstructures )
target_link_libraries(example_sharedmemory_node ${catkin_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${RT_LIBRARY} /usr/local/lib/libsharedstructures.a ${ARRAY_LIBRARY} )
Maybe you can gfive me a hint, because this lib is perfectly suited for my problem. Thanks a lot.
sharedstructures depends on phosg, and it looks like the phosg dependency didn't get included in your project. Try adding phosg to your target_link_libraries.