On Wed, May 30, 2018 at 10:42 AM, Jialin Liu <jalnliu@xxxxxxx> wrote: > Hi, > I'm trying to use the libradosstriper api, but having some trouble in > linking to lradosstriper. I copied only the `required' libraries from an > pre-installed ceph (10.2.10), and put them under my local directory > /rados_install/lib and rados_install/include, on a linux machine. > > /rados_install/lib: >> >> libboost_date_time.so.1.53.0 libboost_system.so.1.53.0 >> libboost_filesystem-mt.so.1.53.0 libboost_thread-mt.so.1.53.0 >> libboost_filesystem.so.1.53.0 libcephfs.so.1.0.0 >> libboost_iostreams-mt.so.1.53.0 >> libboost_iostreams.so.1.53.0 >> libboost_random-mt.so.1.53.0 librados.so.2.0.0 >> libboost_regex.so.1.53.0 librados_tp.so.2.0.0 >> libboost_system-mt.so.1.53.0 libradosstriper.so.1.0.0 >> libcephfs.so librados.so libradosstriper.so > > > /rados_install/include: >> >> |-- rados >> | |-- buffer.h -> ../buffer.h >> | |-- buffer_fwd.h -> ../buffer_fwd.h >> | |-- crc32c.h -> ../crc32c.h >> | |-- inline_memory.h -> ../inline_memory.h >> | |-- librados.h >> | |-- librados.hpp >> | |-- librgw.h >> | |-- memory.h -> ../memory.h >> | |-- objclass.h >> | |-- page.h -> ../page.h >> | |-- rados_types.h >> | |-- rados_types.hpp >> | `-- rgw_file.h >> `-- radosstriper >> |-- libradosstriper.h >> `-- libradosstriper.hpp > > > The test code is simple, as attached, and I compiled it with dynamic > linking: >> >> cc -L/rados_install/lib -I/rados_install/include -o librados_test >> librados_test.c -lrados -lradosstriper > > > But got the following message, can anyone plz advise? > >> >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::ptr::ptr(ceph::buffer::ptr&&)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::ptr::operator=(ceph::buffer::ptr&&)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `librados::IoCtx::remove(std::string const&, int)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::list::iterator::iterator(ceph::buffer::list*, unsigned int)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::list::is_provided_buffer(char const*) const' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::list::append(ceph::buffer::ptr&&)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::list::iterator::iterator(ceph::buffer::list*, unsigned int, >> std::_List_iterator<ceph::buffer::ptr>, unsigned int)' >> /rados_install/lib/libradosstriper.so: undefined reference to >> `ceph::buffer::list::list(ceph::buffer::list&&)' Try doing the following in your lib directory. $ nm -A -C *.so|grep is_provided_buffer libceph-common.so:0000000000223df0 T ceph::buffer::list::is_provided_buffer(char const*) const librados.so:00000000000bfef0 T ceph::buffer::list::is_provided_buffer(char const*) const libradosstriper.so: U ceph::buffer::list::is_provided_buffer(char const*) const 'ldd librados.so' shows it links to libceph-common.so so I suspect you may need that library. Don't forget that you need to tell the linker where to find these libraries at runtime so you will need to pass something like '-Wl,-rpath=/rados_install/lib' to the compiler so it finds the correct versions of the libraries (you can check which ones it will find with 'ldd librados_test'. HTH > > > Best, > Jialin > NERSC > > _______________________________________________ > ceph-users mailing list > ceph-users@xxxxxxxxxxxxxx > http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com > -- Cheers, Brad _______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com