OpenAtomFoundation / pikiwidb

a high-performance, large-capacity, multi-tenant, data-persistent, strong data consistency based on raft, Redis-compatible elastic KV data storage system based on RocksDB
BSD 3-Clause "New" or "Revised" License
165 stars 56 forks source link

fix: bug when installing braft #334

Closed mirthfulLee closed 1 month ago

mirthfulLee commented 1 month ago

Fix the small bug when installing braft. #224 Meanwhile, add GIT_SHALLOW to speed up the git clone process.

longfar-ncy commented 1 month ago

如果直接把 INSTALL 那一行去掉,能否编译成功?

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


If I directly remove the INSTALL line, will the compilation be successful?

mirthfulLee commented 1 month ago

去掉INSTALL那行编译, 会有报错:

[100%] Linking CXX static library ../output/lib/libbraft.a
[100%] Built target braft-static
[ 89%] Performing install step for 'extern_braft'
[ 91%] Built target OBJ_LIB
[ 93%] Built target braft-static
[ 95%] Linking CXX shared library ../output/lib/libbraft.dylib
[ 97%] Building CXX object tools/CMakeFiles/braft_cli.dir/braft_cli.cpp.o
Undefined symbols for architecture arm64:
  "GetStackTrace(void**, int, int)", referenced from:
      butil::debug::EnableInProcessStackDumping() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::EnableInProcessStackDumping() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [output/lib/libbraft.dylib] Error 1
make[4]: *** [src/CMakeFiles/braft-shared.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
[100%] Linking CXX executable output/bin/braft_cli
Undefined symbols for architecture arm64:
  "GetStackTrace(void**, int, int)", referenced from:
      butil::debug::EnableInProcessStackDumping() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::EnableInProcessStackDumping() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      butil::debug::StackTrace::StackTrace() in libbrpc.a[29](stack_trace_posix.cc.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *** [tools/output/bin/braft_cli] Error 1
make[4]: *** [tools/CMakeFiles/braft_cli.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [third-party/braft/src/extern_braft-stamp/extern_braft-install] Error 2
make[1]: *** [CMakeFiles/extern_braft.dir/all] Error 2
make: *** [all] Error 2
 pikiwidb compile fail
mirthfulLee commented 1 month ago

我测试构建了braft, 发现是braft在Mac上的动态库构建有问题, 不过刚好动态库是最后一步, 其他内容(头文件和静态库的构建)都是正常的. 使用INSTALL_COMMAND进行复制时, 其实忽略了动态库, 只是刚好不影响最终PikiwiDB的构建.

如果不使用INSTALL_COMMAND, 则必须先要解决动态库构建失败的问题, 如更新braft版本.

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


I tested building braft and found that there was a problem with the dynamic library construction of braft on Mac, but the dynamic library happened to be the last step, and other contents (the construction of header files and static libraries) were normal. When using INSTALL_COMMAND to copy , in fact, the dynamic library is ignored, but it just does not affect the final construction of PikiwiDB.

If you do not use INSTALL_COMMAND, you must first solve the problem of dynamic library build failure, such as updating the draft version.