Libdirutils.so.0.1.0: undefined reference to `cb::to_string[abi:cxx11](cb::const_char_buffer)'


#1

I am trying to build the latest Couchbase source (master) on Ubuntu16.04 with ppc64le platform.
At the build level its failing with below error :

  [ 10%] Linking CXX executable platform-dirutils-test
../../libdirutils.so.0.1.0: undefined reference to `cb::to_string[abi:cxx11](cb::const_char_buffer)'
../../libdirutils.so.0.1.0: undefined reference to `cb::io::MemoryMappedFile::~MemoryMappedFile()'
../../libdirutils.so.0.1.0: undefined reference to `cb::io::MemoryMappedFile::MemoryMappedFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cb::io::MemoryMappedFile::Mode const&)'
collect2: error: ld returned 1 exit status
platform/tests/dirutils/CMakeFiles/platform-dirutils-test.dir/build.make:89: recipe for target 'platform/tests/dirutils/platform-dirutils-test' failed
make[2]: *** [platform/tests/dirutils/platform-dirutils-test] Error 1
CMakeFiles/Makefile2:5019: recipe for target 'platform/tests/dirutils/CMakeFiles/platform-dirutils-test.dir/all' failed
make[1]: *** [platform/tests/dirutils/CMakeFiles/platform-dirutils-test.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Can someone please help me understand the issue and provide some pointers around it?

Thanks,
Sandip Giri


#2

I’m completely unfamiliar with the PowerPC platform, but I will mention that internally we build on Linux using gcc 7.3.0 - what compiler are you using? gcc 5.3.1 that comes with Ubuntu 16.04 will likely not work.


#3

Thanks for your reply @ceej!
I was using gcc5.4.0 compiler.
As per your suggestion, I have installed gcc7.3.0 and tried the build again. However I am still getting the same error.

Thanks,
Sandip


#4

I’m afraid that’s the only suggestion I’ve got. The “platform” package, as its name suggests, is where we keep platform-dependent logic, so it stands to reason that it would be the first to fail when trying to build on a new architecture. Since we’ve never attempted building on PowerPC, I can’t say I’m surprised to see it fail… but I can’t do much more than wish you luck.


#5

Hi @ceej,

I’m looking into the issue , if I make any progress will share the details here.

Thanks,
Sandip


#6

Hi,

The issue got resolved.
I had to add “src/memorymap.cc” file for ppc64le under LIST(APPEND PLATFORM_FILES in platform/CMakeLists.txt.

Now the build has been proceeded , however its failing at different point with the below error , same issue has observed on x86 as well :

[  1%] Built target phosphor
[  2%] Built target platform_so
[  2%] Built target gmock
[  2%] Built target gtest
[  2%] Built target platform
[  2%] Built target memory_test
[  2%] Built target trace_buffer_test
[  2%] Built target export_test
[  2%] Built target chunk_lock_test
[  2%] Built target string_utils_test
[  3%] Built target category_registry_test
[  3%] Built target trace_event_test
[  3%] Built target trace_log_test
[  4%] Built target trace_config_test
[  4%] Built target trace_argument_test
[  5%] Built target threaded_test
[  6%] Built target memory_usage_test
[  7%] Built target macro_test
[  7%] Built target dirutils
[  7%] Built target JSON_checker
[  7%] Built target breakpad_wrapper
[  8%] Built target benchmark
[  8%] Built target platform-compression-bench
[  8%] Built target cbcompress
[  8%] Built target gtest_main
[  9%] Built target platform-compression-test
[  9%] Built target cbsocket
[  9%] Built target platform-atomic_duration-test
[  9%] Built target platform-non_negative_counter-test
[  9%] Built target platform-relaxed_atomic-test
[  9%] Built target platform-backtrace-test
[  9%] Built target platform-base64-test-bench
[  9%] Built target platform-base64-test
[  9%] Built target bitset-test
[  9%] Built target platform-checked-snprintf-test
[  9%] Built target platform-corestore-test
[  9%] Built target platform-crc32c-bench
[  9%] Built target platform-crc32c-sw_hw-test
[  9%] Built target platform-crc32c-test
[ 10%] Built target platform-dirutils-test-library
[ 10%] Built target platform-dirutils-test
[ 10%] Built target platform-gettimeofday-test
[ 10%] Built target platform-getopt-test
[ 10%] Built target platform-histogram-test
[ 11%] Built target platform-n-byte-integer-test
[ 11%] Built target platform-interrupt-test
[ 11%] Built target platform-json-checker-bench
[ 11%] Built target platform-json-checker-test
[ 11%] Built target platform-memorymap-test
[ 11%] Built target platform-mktemp-test
[ 11%] Built target platform_pipe_benchmark
[ 11%] Built target platform_pipe_test
[ 11%] Built target platform-processclock-test
[ 11%] Built target platform-random-test
[ 11%] Built target ring-buffer-test
[ 11%] Built target sized-buffer-test
[ 11%] Built target platform-strings-test
[ 11%] Built target platform-sysinfo-test
[ 11%] Built target platform-thread-test
[ 11%] Built target platform-timers-test
[ 13%] Built target platform-timeutils-test
[ 13%] Built target platform-uuid-test
[ 13%] Built target subjson
[ 13%] Built target bench
[ 14%] Built target subjson-test
[ 14%] Built target couchstore_test_fileops
[ 16%] Built target couchstore
[ 16%] Built target couch_view_group_cleanup
[ 16%] Built target couch_view_index_updater
[ 16%] Built target couch_compact
[ 16%] Built target couch_view_file_merger
[ 16%] Built target couch_view_index_builder
[ 16%] Built target couch_dbck
[ 16%] Built target couchstore_file-deduper-test
[ 19%] Built target couchstore_testapp
[ 19%] Built target couchstore_wrapped_fileops_test_framework
[ 19%] Built target memcached_logger
[ 19%] Built target hdr_histogram_static
[ 19%] Built target engine_utilities
[ 20%] Built target mcd_util
[ 21%] Built target mcbp
[ 22%] Built target ep-engine_collections
[ 23%] Built target xattr
[ 26%] Built target couch_dbdump
[ 26%] Built target couch_create
[ 26%] Built target couchstore_wrapped_fileops_test
[ 26%] Built target couchstore_file-merger-test
[ 27%] Built target couchstore_file-sorter-test
[ 28%] Built target couchstore_mapreduce-builtin-test
[ 28%] Built target couch_dbinfo
[ 28%] Built target couchstore_mapreduce-reduce-test
[ 28%] Built target couchstore_mapreduce-map-test
[ 28%] Built target couchstore_gtest
[ 29%] Built target couch_view_group_compactor
[ 31%] Built target couchstore_internal_gtest
[ 31%] Built target dbdiff
[ 31%] Built target FDB_TOOLS_UTILS
[ 33%] Built target FDB_TOOLS_CORE
[ 36%] Built target forestdb
[ 36%] Built target forestdb_hexamine
[ 36%] Built target forestdb_dump
[ 36%] Built target TEST_STAT_AGG
[ 38%] Built target filemgr_test
[ 39%] Built target atomic_test
[ 40%] Built target btreeblock_test
[ 41%] Built target btree_kv_test
[ 42%] Built target bcache_test
[ 43%] Built target hash_test
[ 44%] Built target docio_test
[ 45%] Built target hbtrie_test
[ 45%] Built target btree_str_kv_test
[ 45%] Built target iterator_functional_test
[ 45%] Built target staleblock_test
[ 45%] Built target compact_functional_test
[ 45%] Built target fdb_functional_test
[ 45%] Built target mvcc_functional_test
[ 46%] Built target fdb_extended_test
[ 46%] Built target big_concurrency_test
[ 46%] Built target big_compaction_test
[ 46%] Built target multi_kv_functional_test
[ 47%] Built target FDB_TOOLS_CCORE
[ 48%] Built target disk_sim_test
[ 48%] Built target fdb_anomaly_test
[ 48%] Built target e2etest
[ 48%] Built target fdb_microbench
[ 50%] Built target usecase_test
[ 50%] Built target memory_tracking
[ 50%] Built target cbcrypto
[ 50%] Built target cbcrypto_test
[ 51%] Built target cbsasl
[ 51%] Built target cbsasl_password_database_test
[ 51%] Built target cbsasl_pwconv_test
[ 52%] Built target cbsasl_strcmp_test
[ 52%] Built target cbsasl_client_server_test
[ 52%] Built target cbsasl_server_test
[ 52%] Built target mcd_time
[ 52%] Built target memcached_timestamp_test
[ 52%] Built target memcached_rbac
[ 52%] Built target memcached_rbac_test
[ 53%] Built target mcbp_magic_test
[ 53%] Built target mcbp_feature_test
[ 53%] Built target mcbp_status_test
[ 53%] Built target mcbp_dump_parser_test
[ 53%] Built target mcbp_request_test
[ 53%] Built target mcbp_packet_printer
[ 53%] Built target mcbp_opcode_test
[ 53%] Built target mcbp_sla_test
[ 53%] Built target mcbp_framebuilder_test
[ 53%] Built target mcd_tracing
[ 53%] Built target mc_client_connection
[ 53%] Built target mc_program_utils
[ 53%] Built target memcached-hostutils-test
[ 53%] Built target engine_testapp
[ 53%] Built target mcctl
[ 53%] Built target mclogsplit
[ 53%] Built target mcstat
[ 54%] Built target mctimings
[ 54%] Built target mctrace
[ 54%] Built target utilities_testapp
[ 55%] Built target crash_engine
[ 55%] Built target default_engine
[ 55%] Built target ep-engine_atomic_ptr_test
[ 55%] Built target genconfig
[ 55%] Built target gencode
[ 55%] Building CXX object kv_engine/engines/ep/CMakeFiles/ep_objs.dir/src/checkpoint.cc.o
In file included from /usr/include/c++/5/list:63:0,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint_types.h:19,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.h:23,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:26:
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'class std::__cxx11::_List_base<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >':
/usr/include/c++/5/bits/stl_list.h:507:11:   required from 'class std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >'
/root/couchbase/kv_engine/engines/ep/src/checkpoint_iterator.h:39:56:   required from 'class CheckpointIterator<std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > > >'
/root/couchbase/kv_engine/engines/ep/src/checkpoint.h:73:24:   required from here
/usr/include/c++/5/bits/stl_list.h:315:9: error: no class template named 'rebind' in 'class MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >'
         _Node_alloc_type;
         ^
/usr/include/c++/5/bits/stl_list.h:317:60: error: no class template named 'rebind' in 'class MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >'
       typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
                                                            ^
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'class std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >':
/root/couchbase/kv_engine/engines/ep/src/checkpoint_iterator.h:39:56:   required from 'class CheckpointIterator<std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > > >'
/root/couchbase/kv_engine/engines/ep/src/checkpoint.h:73:24:   required from here
/usr/include/c++/5/bits/stl_list.h:540:20: error: no members matching 'std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >::_Base {aka std::__cxx11::_List_base<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >}::_M_get_Tp_allocator' in 'std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >::_Base {aka class std::__cxx11::_List_base<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >}'
       using _Base::_M_get_Tp_allocator;
                    ^
/usr/include/c++/5/bits/stl_list.h:541:20: error: no members matching 'std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >::_Base {aka std::__cxx11::_List_base<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >}::_M_get_Node_allocator' in 'std::__cxx11::list<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >::_Base {aka class std::__cxx11::_List_base<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >, MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > > >}'
       using _Base::_M_get_Node_allocator;
                    ^
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'std::__cxx11::_List_base<_Tp, _Alloc>::allocator_type std::__cxx11::_List_base<_Tp, _Alloc>::get_allocator() const [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::_List_base<_Tp, _Alloc>::allocator_type = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]':
/usr/include/c++/5/bits/stl_list.h:823:36:   required from 'std::__cxx11::list<_Tp, _Alloc>::allocator_type std::__cxx11::list<_Tp, _Alloc>::get_allocator() const [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::allocator_type = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]'
/root/couchbase/kv_engine/engines/ep/src/checkpoint.h:459:54:   required from here
/usr/include/c++/5/bits/stl_list.h:415:52: error: '_M_get_Node_allocator' was not declared in this scope
       { return allocator_type(_M_get_Node_allocator()); }
                                                    ^
In file included from /usr/include/c++/5/list:64:0,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint_types.h:19,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.h:23,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:26:
/usr/include/c++/5/bits/list.tcc: In instantiation of 'void std::__cxx11::_List_base<_Tp, _Alloc>::_M_clear() [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]':
/usr/include/c++/5/bits/stl_list.h:446:17:   required from 'std::__cxx11::_List_base<_Tp, _Alloc>::~_List_base() [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]'
/usr/include/c++/5/bits/stl_list.h:507:11:   required from here
/usr/include/c++/5/bits/list.tcc:75:25: error: '_M_get_Node_allocator' was not declared in this scope
    _M_get_Node_allocator().destroy(__tmp);
                         ^
In file included from /usr/include/c++/5/list:63:0,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint_types.h:19,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.h:23,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:26:
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'void std::__cxx11::list<_Tp, _Alloc>::_M_erase(std::__cxx11::list<_Tp, _Alloc>::iterator) [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::iterator = std::_List_iterator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]':
/usr/include/c++/5/bits/list.tcc:156:15:   required from 'std::__cxx11::list<_Tp, _Alloc>::iterator std::__cxx11::list<_Tp, _Alloc>::erase(std::__cxx11::list<_Tp, _Alloc>::const_iterator) [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::iterator = std::_List_iterator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::const_iterator = std::_List_const_iterator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]'
/root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:222:58:   required from here
/usr/include/c++/5/bits/stl_list.h:1777:30: error: '_M_get_Node_allocator' was not declared in this scope
         _M_get_Node_allocator().destroy(__n);
                              ^
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'std::__cxx11::list<_Tp, _Alloc>::_Node* std::__cxx11::list<_Tp, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >&}; _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::_Node = std::_List_node<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]':
/usr/include/c++/5/bits/stl_list.h:1763:32:   required from 'void std::__cxx11::list<_Tp, _Alloc>::_M_insert(std::__cxx11::list<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >&}; _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::iterator = std::_List_iterator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >]'
/usr/include/c++/5/bits/stl_list.h:1089:9:   required from 'void std::__cxx11::list<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >; _Alloc = MemoryTrackingAllocator<SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> > >; std::__cxx11::list<_Tp, _Alloc>::value_type = SingleThreadedRCPtr<Item, Item*, std::default_delete<Item> >]'
/root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:291:25:   required from here
/usr/include/c++/5/bits/stl_list.h:574:29: error: '_M_get_Node_allocator' was not declared in this scope
        _M_get_Node_allocator().construct(__p,
                             ^
In file included from /root/couchbase/third_party/spdlog/include/spdlog/fmt/fmt.h:20:0,
                 from /root/couchbase/third_party/spdlog/include/spdlog/common.h:50,
                 from /root/couchbase/third_party/spdlog/include/spdlog/logger.h:21,
                 from /root/couchbase/kv_engine/engines/ep/src/bucket_logger.h:20,
                 from /root/couchbase/kv_engine/engines/ep/src/checkpoint.cc:25:
/root/couchbase/third_party/spdlog/include/spdlog/fmt/bundled/core.h: In member function 'void fmt::v5::internal::arg_map<Context>::push_back(fmt::v5::internal::value<Context>) [with Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>]':
/root/couchbase/third_party/spdlog/include/spdlog/fmt/bundled/core.h:953:10: note: the ABI of passing aggregates with 16-byte alignment has changed in GCC 5
     void push_back(value<Context> val)
          ^
kv_engine/engines/ep/CMakeFiles/ep_objs.dir/build.make:192: recipe for target 'kv_engine/engines/ep/CMakeFiles/ep_objs.dir/src/checkpoint.cc.o' failed
make[2]: *** [kv_engine/engines/ep/CMakeFiles/ep_objs.dir/src/checkpoint.cc.o] Error 1
CMakeFiles/Makefile2:11509: recipe for target 'kv_engine/engines/ep/CMakeFiles/ep_objs.dir/all' failed
make[1]: *** [kv_engine/engines/ep/CMakeFiles/ep_objs.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Any inputs will help to investigate further…
Thanks in advance !


#7

The issue got resolved after upgrading gcc and g++ to 7.4.
Currently it’s failing at 70% with new error :

[ 70%] Built target ep-engine_sizes
[ 70%] Building Python venv management using Python
CMake Error at /root/couchbase/tlm/cmake/Modules/py-venv.cmake:6 (MESSAGE):
  Error running /root/build/tlm/python.install/miniconda3-4.5.4/bin/python
  -m;venv;/root/build/kv_engine/engines/ep/management/pyvenv!
Call Stack (most recent call first):
  /root/couchbase/tlm/cmake/Modules/py-venv.cmake:11 (exec)
  /root/couchbase/tlm/cmake/Modules/py-venv.cmake:26 (python)

kv_engine/engines/ep/management/CMakeFiles/management-venv.dir/build.make:60: recipe for target 'kv_engine/engines/ep/management/pyvenv/created' failed
make[2]: *** [kv_engine/engines/ep/management/pyvenv/created] Error 1
CMakeFiles/Makefile2:12328: recipe for target 'kv_engine/engines/ep/management/CMakeFiles/management-venv.dir/all' failed
make[1]: *** [kv_engine/engines/ep/management/CMakeFiles/management-venv.dir/all] Error 2
Makefile:162: recipe for target 'all' failed

Looking into this.