Customize grocksdb build flags
masterYou can customize how grocksdb links to libraries using Go build tags. This is useful if you want to override the default flags (-lrocksdb -pthread -lstdc++ -ldl -lm -lzstd -llz4 -lz -lsnappy) or use a cleaner set of links.
Use clean links
Use -tags grocksdb_clean_link to reduce the base flags to -lrocksdb -pthread -lstdc++ -ldl. This allows you to manually specify only the additional libraries you need.
Ignore library build flags
Use -tags grocksdb_no_link to ignore the library's internal build flags entirely and build strictly based on the flags you provide in CGO_LDFLAGS.
# Build with a cleaner set of flags
CGO_LDFLAGS="-L/path/to/rocksdb -lzstd" go build -tags grocksdb_clean_link
# Build ignoring library flags and using fully custom flags
CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lzstd -llz4" go build -tags grocksdb_no_link