You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if you want to use rocksdb with compression libraries, you need to set the CGO_LDFLAGS environment variable. Since the order of linker args matters, you need to also specify -lrocksdb or -l:librocksdb.a as part of that, or else linking will fail due to missing compression symbols. At the end of the day, we're left with a situation where you can sometimes rely on cgo comments and build tags to specify linker args, and sometimes not. #167 and #174 removed the compression libraries from the cgo comments because they were unconditional and thus would cause linker failures if you weren't using them.
I'm proposing to add the linker args for compression back into the relevant files, but with tags to make them only used conditionally. So for example go build -t static,z,snappy would use the static linker args and also add the linker args -l:libz.a -l:libsnappy.a using cgo comments like #cgo snappy LDFLAGS: -l:libsnappy.a. These could be put into the proper order in the files, which would allow users of the library to use whatever features they want by only specifying build tags and not needing to set CGO_LDFLAGS at all.
I'd be willing to put up a PR with these changes if that idea sounds good to everyone.
The text was updated successfully, but these errors were encountered:
Currently, if you want to use rocksdb with compression libraries, you need to set the
CGO_LDFLAGS
environment variable. Since the order of linker args matters, you need to also specify-lrocksdb
or-l:librocksdb.a
as part of that, or else linking will fail due to missing compression symbols. At the end of the day, we're left with a situation where you can sometimes rely on cgo comments and build tags to specify linker args, and sometimes not. #167 and #174 removed the compression libraries from the cgo comments because they were unconditional and thus would cause linker failures if you weren't using them.I'm proposing to add the linker args for compression back into the relevant files, but with tags to make them only used conditionally. So for example
go build -t static,z,snappy
would use the static linker args and also add the linker args-l:libz.a -l:libsnappy.a
using cgo comments like#cgo snappy LDFLAGS: -l:libsnappy.a
. These could be put into the proper order in the files, which would allow users of the library to use whatever features they want by only specifying build tags and not needing to setCGO_LDFLAGS
at all.I'd be willing to put up a PR with these changes if that idea sounds good to everyone.
The text was updated successfully, but these errors were encountered: