westerndigitalcorporation/zenfs

compile "zenfs/util" failed

chenzeshuo opened this issue · 2 comments

Hi, I meet a problem when compiling zenfs/util, the details display as follows:

g++ -std=c++17 -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_IOURING_PRESENT -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=1 -DZLIB -DBZIP2 -DLZ4 -DZSTD -DNUMA -DTBB -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT -march=native -DHAVE_UINT128_EXTENSION -DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE -isystem third-party/gtest-1.8.1/fused-src -I/usr/local/include  -g -o zenfs zenfs.cc -L/usr/local/lib -ldl -lrocksdb -lpthread -lrt -ldl -luring -lsnappy -lgflags -lz -lbz2 -llz4 -lzstd -lnuma -ltbb -u zenfs_filesystem_reg -ljemalloc -lzbd 
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zbd_open(bool, bool)':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:62: undefined reference to `rocksdb::ZonedBlockDevice::ZonedBlockDevice(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, rocksdb::ZbdBackendType, std::shared_ptr<rocksdb::Logger>, std::shared_ptr<rocksdb::ZenFSMetrics>)'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:64: undefined reference to `rocksdb::ZonedBlockDevice::Open(bool, bool)'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_mount(std::unique_ptr<rocksdb::ZonedBlockDevice, std::default_delete<rocksdb::ZonedBlockDevice> >&, std::unique_ptr<rocksdb::ZenFS, std::default_delete<rocksdb::ZenFS> >*, bool)':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:82: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:82: undefined reference to `rocksdb::ZenFS::ZenFS(rocksdb::ZonedBlockDevice*, std::shared_ptr<rocksdb::FileSystem>, std::shared_ptr<rocksdb::Logger>)'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:83: undefined reference to `rocksdb::ZenFS::Mount(bool)'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_mkfs()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:181: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:181: undefined reference to `rocksdb::ZenFS::ZenFS(rocksdb::ZonedBlockDevice*, std::shared_ptr<rocksdb::FileSystem>, std::shared_ptr<rocksdb::Logger>)'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:185: undefined reference to `rocksdb::ZenFS::MkFS(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int, bool)'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:193: undefined reference to `rocksdb::ZonedBlockDevice::GetFreeSpace()'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_df()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:268: undefined reference to `rocksdb::ZonedBlockDevice::GetUsedSpace()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:269: undefined reference to `rocksdb::ZonedBlockDevice::GetFreeSpace()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:270: undefined reference to `rocksdb::ZonedBlockDevice::GetReclaimableSpace()'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_lsuuid()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:286: undefined reference to `rocksdb::ListZenFileSystems(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, rocksdb::ZbdBackendType>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, rocksdb::ZbdBackendType> > > >&)'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_backup()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:512: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:515: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:525: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:532: undefined reference to `rocksdb::ZenFS::GetWriteLifeTimeHints[abi:cxx11]()'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_remove_directory()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:654: undefined reference to `rocksdb::ZenFS::DeleteDirRecursive(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rocksdb::IOOptions const&, rocksdb::IODebugContext*)'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_restore()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:690: undefined reference to `rocksdb::FileSystem::Default()'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::zenfs_tool_dump()':
/home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:751: undefined reference to `rocksdb::ZonedBlockDevice::EncodeJson(std::ostream&)'
/usr/bin/ld: /home/czs/ZNS/rocksdb/plugin/zenfs/util/zenfs.cc:753: undefined reference to `rocksdb::ZenFS::EncodeJson(std::ostream&)'
/usr/bin/ld: /tmp/ccY02m2r.o: in function `rocksdb::ZenFS::ReportSuperblock(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
/usr/local/include/rocksdb/plugin/zenfs/fs/fs_zenfs.h:292: undefined reference to `rocksdb::Superblock::GetReport(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:31: zenfs] Error 1

how should I solve this problem?

I resolved this issue by removing the rocksdb-related header files in /usr/local/include and then reinstalling.

Thanks for the update @chenzeshuo. Greatly appreciated.