westerndigitalcorporation / zenfs

ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.
GNU General Public License v2.0
235 stars 86 forks source link

compiling error fatal error:xxx.h: No such file or directory #265

Closed ZhuWeiLin0 closed 1 year ago

ZhuWeiLin0 commented 1 year ago

I wrote a new head file selection.h and put it under /include selection.h only contains some Macro definition like #define XXX

when I do 'make' under /plugin/zenfs/util it reports:

root@zns-Z9PA-D8-Series:/home/rocksdb/plugin/zenfs/util# make
g++ -std=c++17 -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DGFLAGS=1 -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT -march=native -DHAVE_SSE42 -DHAVE_PCLMUL -DHAVE_UINT128_EXTENSION -I/usr/local/include -isystem third-party/gtest-1.8.1/fused-src -g -o zenfs zenfs.cc -L/usr/local/lib -ldl -lrocksdb -lpthread -lrt -ldl -lgflags 
zenfs.cc:25:10: fatal error: rocksdb/plugin/zenfs/fs/fs_zenfs.h: No such file or directory
   25 | #include <rocksdb/plugin/zenfs/fs/fs_zenfs.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:32: zenfs] Error 1

I followed #50 but it does not work.

here is what's inside /usr/local/include/rocksdb/

root@zns-Z9PA-D8-Series:/home/rocksdb/plugin/zenfs/util# ls /usr/local/include/rocksdb/
advanced_cache.h            compression_type.h         env_encryption.h      iterator.h          perf_level.h         sst_file_manager.h  table_reader_caller.h   utilities
advanced_options.h          concurrent_task_limiter.h  env.h                 ldb_tool.h          persistent_cache.h   sst_file_reader.h   threadpool.h            version.h
block_cache_trace_writer.h  configurable.h             experimental.h        listener.h          port_defs.h          sst_file_writer.h   thread_status.h         wal_filter.h
cache_bench_tool.h          convenience.h              file_checksum.h       memory_allocator.h  rate_limiter.h       sst_partitioner.h   trace_reader_writer.h   wide_columns.h
cache.h                     customizable.h             file_system.h         memtablerep.h       rocksdb_namespace.h  statistics.h        trace_record.h          write_batch_base.h
c.h                         data_structure.h           filter_policy.h       merge_operator.h    secondary_cache.h    stats_history.h     trace_record_result.h   write_batch.h
cleanable.h                 db_bench_tool.h            flush_block_policy.h  metadata.h          slice.h              status.h            transaction_log.h       write_buffer_manager.h
compaction_filter.h         db_dump_tool.h             functor_wrapper.h     mode_selection.h    slice_transform.h    system_clock.h      types.h
compaction_job_stats.h      db.h                       iostats_context.h     options.h           snapshot.h           table.h             unique_id.h
comparator.h                db_stress_tool.h           io_status.h           perf_context.h      sst_dump_tool.h      table_properties.h  universal_compaction.h

Any help is deeply Thanked!

ZhuWeiLin0 commented 1 year ago

I can see that there is no plugin folder in /usr/local/include/rocksdb/ can anyone tell why would this happen? and what's the purpose of folder /usr/local/include/rocksdb/ ?

ZhuWeiLin0 commented 1 year ago

I found that /usr/local/include/rocksdb/ is quite important. I install rocksdb and zenfs again and now I can see plugin folder in /usr/local/include/rocksdb/

But I got new problems For example, I wrote a new function in Class ZenFS() and I called this function in zenfs.cc However, it reports :

zenfs.cc:557:20: error: ‘class rocksdb::ZenFS’ has no member named ‘GetReadWriteHints’
  557 |   rwh_map = zenFS->GetReadWriteHints();
      |                    ^~~~~~~~~~~~~~~~~
make: *** [Makefile:31: zenfs] Error 1

I checked ‘class rocksdb::ZenFS’ in /usr/local/include/rocksdb/, there is no function I wrote. so I guess now my problem is why would this happen.

ZhuWeiLin0 commented 1 year ago

i directly repalced io_zenfs.h zbd_zenfs.h in /usr/local/include/rocksdb/plugin with what I wrote. now I get a more severe problem. when I run make under plugin/zenfs/util it reports:

g++ -std=c++17 -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DGFLAGS=1 -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT -march=native -DHAVE_SSE42 -DHAVE_PCLMUL -DHAVE_UINT128_EXTENSION -I/usr/local/include -isystem third-party/gtest-1.8.1/fused-src -g -o zenfs zenfs.cc -L/usr/local/lib -ldl -lrocksdb -lpthread -lrt -ldl -lgflags 
/usr/bin/ld: /tmp/ccbCakH5.o: in function `rocksdb::zbd_open(bool, bool)':
/home/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/rocksdb/plugin/zenfs/util/zenfs.cc:64: undefined reference to `rocksdb::ZonedBlockDevice::Open(bool, bool)'
/usr/bin/ld: /tmp/ccbCakH5.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/zwl/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/rocksdb/plugin/zenfs/util/zenfs.cc:83: undefined reference to `rocksdb::ZenFS::Mount(bool)'
/usr/bin/ld: /tmp/ccbCakH5.o: in function `rocksdb::zenfs_tool_mkfs()':
/home/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/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/rocksdb/plugin/zenfs/util/zenfs.cc:193: undefined reference to `rocksdb::ZonedBlockDevice::GetFreeSpace()'
/usr/bin/ld: /tmp/ccbCakH5.o: in function `rocksdb::zenfs_tool_df()':
/home/rocksdb/plugin/zenfs/util/zenfs.cc:268: undefined reference to `rocksdb::ZonedBlockDevice::GetUsedSpace()'
/usr/bin/ld: /home/rocksdb/plugin/zenfs/util/zenfs.cc:269: undefined reference to `rocksdb::ZonedBlockDevice::GetFreeSpace()'
/usr/bin/ld: /home/rocksdb/plugin/zenfs/util/zenfs.cc:270: undefined reference to `rocksdb::ZonedBlockDevice::GetReclaimableSpace()'
/usr/bin/ld: /tmp/ccbCakH5.o: in function `rocksdb::zenfs_tool_lsuuid()':
/home/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/ccbCakH5.o: in function `rocksdb::zenfs_tool_backup()':
/home/rocksdb/plugin/zenfs/util/zenfs.cc:554: undefined reference to `rocksdb::ZenFS::GetWriteLifeTimeHints[abi:cxx11]()'
/usr/bin/ld: /home/rocksdb/plugin/zenfs/util/zenfs.cc:557: undefined reference to `rocksdb::ZenFS::GetReadWriteHints[abi:cxx11]()'
/usr/bin/ld: /tmp/ccbCakH5.o: in function `rocksdb::zenfs_tool_remove_directory()':
/home/rocksdb/plugin/zenfs/util/zenfs.cc:680: 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/ccbCakH5.o: in function `rocksdb::zenfs_tool_dump()':
/home/rocksdb/plugin/zenfs/util/zenfs.cc:777: undefined reference to `rocksdb::ZonedBlockDevice::EncodeJson(std::ostream&)'
/usr/bin/ld: /home/rocksdb/plugin/zenfs/util/zenfs.cc:779: undefined reference to `rocksdb::ZenFS::EncodeJson(std::ostream&)'
/usr/bin/ld: /tmp/ccbCakH5.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:294: 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
ZhuWeiLin0 commented 1 year ago

I figured out ! I miss typed ROCKSDB_PLUGINS as PLUGINS_ROCKSDB.... stupid mistake