symbol conflicts with the ceph common

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Internally, we have a program using librados C++ api to periodiclly check ceph's cluster status and send alerts to our internal system.
The little program is written using c++, and linked with librados and our base c++ library. The program works well with K version, but it core dumped with L version. Here is the minmum code to reproduce:

#include <iostream>
#include <rados/librados.hpp>

// Thread class from our base library
class Thread {
public:
    Thread() {
    }

};

int main() {
    Thread t;
    librados::Rados cluster;

    int error_code = cluster.init2("client.admin", "ceph", /* flags = */0);

    // ... code omitted

    return 0;
}

# g++ -I/path/to/ceph/src/include ./test.cpp  -L/path/to/ceph/build/lib -lrados
# export LD_LIBRARY_PATH=/path/to/ceph/build/lib
# ./a.out

Here is backtrace for the coredump:

ceph/src/log/Log.cc: In function 'void ceph::logging::Log::start()' thread 7f839ed72180 time 2018-07-30 14:55:58.340036
ceph/src/log/Log.cc: 509: FAILED assert(!is_started())
 ceph version 14.0.0-1698-gcecbf3e (cecbf3e5dda2dc132367d6d5d74b1b384846c31a) nautilus (dev)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x14e) [0x7f83951305ce]
 2: (()+0x2e8787) [0x7f8395130787]
 3: (ceph::logging::Log::stop()+0) [0x7f839534b130]
 4: (CephContext::CephContext(unsigned int, code_environment_t, int)+0x1bd7) [0x7f839513f677]
 5: (common_preinit(CephInitParameters const&, code_environment_t, int)+0x4e) [0x7f83951677be]
 6: (()+0x884aa) [0x7f839e9c54aa]
 7: (rados_create2()+0xa8) [0x7f839e9c5888]
 8: ./a.out() [0x400be4]
 9: (__libc_start_main()+0xf5) [0x7f839dd02b35]
 10: ./a.out() [0x400af9]
Aborted

The reason for the core dump is the Thread::Thread in our base c++ library conflicts with librados from ceph's common Thread https://github.com/ceph/ceph/blob/master/src/common/Thread.h#L41
Both of them are in global namespace.

Maybe we'd better put https://github.com/ceph/ceph/blob/master/src/common in ceph or rados namespace.  Or build librados using -Wl,-Bsymbolic -Wl,-Bsymbolic-functions  flag.

Best wishes,
Yao Zongyou

[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux