Compilation Issues

Local compilation, unable to start on other machines

  • First, please confirm that you use the command PORTABLE=1 make static_lib to compile rocksdb.
  • Then use the ldd command to check if the dependent libraries are installed on the machine. After installing the missing libraries, execute the ldconfig command.

ZSTD_versionNumber undefined

There are two ways to solve this problem:

  • Add the specified library to CGO_LDFLAGS to compile, for example: CGO_LDFLAGS="-L/usr/local/lib -lrocksdb -lzstd". This method requires that the zstd library is also installed on other deployment machines.
  • Delete the script that automatically detects whether the zstd library is installed. The file location is an example: rockdb-5.9.2/build_tools/build_detect_platform. Delete the following content:
    # Test whether zstd library is installed
        $CXX $CFLAGS $COMMON_FLAGS -x c++ - -o /dev/null 2>/dev/null  <<EOF
          #include <zstd.h>
          int main() {}
    EOF
        if [ "$?" = 0 ]; then
            COMMON_FLAGS="$COMMON_FLAGS -DZSTD"
            PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lzstd"
            JAVA_LDFLAGS="$JAVA_LDFLAGS -lzstd"
        fi
    

Rocksdb compilation issue

When compiling the erasure coding subsystem, an error message is displayed: fatal error: rocksdb/c.h: no such file or directory...

  • First, confirm whether the file pointed to by the error message exists in the .deps/include/rocksdb directory.
  • If it exists, try source env.sh and try again. If the file does not exist or the error still occurs, you can delete all the rocksdb-related files in the .deps directory and then recompile.
Edit on GitHub