-
Notifications
You must be signed in to change notification settings - Fork 102
Add support for building zstd binding against an external libzstd library #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
64661b6 to
53cdb61
Compare
evanj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good, but we should get @Viq111 to take a look.
I also wonder if this package should be renaming all the zstd symbols by default, to allow it to be linked along side other versions of zstd? I think we would still want the option to use an external version, but this might reduce the number of places where people would need this option? (clearly that would be another thing to do in a future change, not here)
bd5a21c to
b931fd9
Compare
|
When I was working on the PR, I got stuck because Debian Buster (10), on which golang Docker image was based on, had relatively old libzstd, and some of the .go files used new functions that weren't present. I couldn't find an easy way to make CI tests pass. I suppose you circumvented this issue by waiting until golang images started to base on Debian Bullseye (11)? If so, does it mean that |
532c5e1 to
5962e6a
Compare
|
Here is what I observed in the following situation: I observed that the calls to confluent-kafka-go using zstd actually ended up running the In order to avoid this situation to silently happen, we could make passing a build tag mandatory by failing the compilation intentionally if none of the |
Viq111
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good to me, I just added some small comments
zstd.h
Outdated
| } | ||
| #endif | ||
| #else /* USE_EXTERNAL_ZSTD */ | ||
| #undef ZSTD_STATIC_LINKING_ONLY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit hacky to define ZSTD_STATIC_LINKING_ONLY in the Go file and then unset in the C file. Is there a way to just have the switch in external_zstd.go ? (i.e: an else that sets it)
(I don't remember if we need to define & import zstd.h in each go file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we actually need to define ZSTD_STATIC_LINKING_ONLY? It appears that library is building fine when that's not defined.
63f8910 to
4b2486c
Compare
This utility enclose all zstd source code inside a ifndef USE_EXTERNAL_ZSTD.
Validate CI against go 1.16 and 1.17
ce570f0 to
5063218
Compare
5063218 to
443dd38
Compare
Turns out this is not used
443dd38 to
0c4231e
Compare
@WGH- I added version constraint with preprocessor macros in the external_libzstd.go file here |
Viq111
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Maybe one last thing (that doesn't necessitate another review). Could you add the go build -tags external_libzstd as a section in the README ? That way it's discoverable for users without needing to read the code
bbe7f2a to
1a7f3d7
Compare
This is heavily inspired by the following PR from @WGH-
Add the
external_libzstdtag to be used when we want to build the binding against an externally providedzstd library. If the tag is defined, the go build system will look for zstd pkg-config package to gather
build arguments.
Added CI jobs to run tests and benchmarks with latest go version.