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
[lib] Fix libzstd.pc for lib-mt builds #2659
Conversation
Hi @ericonr! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
It would seem something about this broke the mingw builds:
I will try to figure out what it was, would appreciate guidance. |
Ok, should be fixed now. |
Add the libzstd.pc target to the lib target in lib/Makefile, which makes it inherit LDFLAGS_DYNLIB from the lib-mt target. This allows us to add a Libs.private field to libzstd.pc which gets conditionally populated with '-pthread'. The 1.5.0 release notes mention that the static library isn't multi-threaded by default, due to concern for people building static binaries with libzstd: Now the dynamic library supports multi-threaded compression by default. Note that this property is not extended to the static library because doing so would have impacted the build script of existing client applications (requiring them to add -pthread to their recipe), thus potentially breaking their build. To get closer to being able to enable multi-threading for all library builds by default, this commit makes it so that any libzstd consumer using pkg-config gets the correct flags. We also fix the indentation of the rule for libzstd.pc and move it outside the if/endif block for install rules (which uses a list of OSs where the rules were validated), so the rule is available for all users of the 'lib*' targets.
Travis on aarch64 fails due to Travis: https://travis-ci.com/github/facebook/zstd/jobs/516610662
|
Thanks for this PR! Sorry it took so long for us to get to it. It looks like you're fundamentally doing three things:
The first looks correct and important. The last two are tricky since people may build zstd on platforms where a I'm going to merge this PR into a working branch and make a few fix-ups. I'll tag you when I put it up and if you can make sure it's still addressing your needs, that would be great. |
Fix Up #2659; Build libzstd.pc Whenever Building the Lib on Unix
Add the libzstd.pc target to the lib target in lib/Makefile, which makes
it inherit LDFLAGS_DYNLIB from the lib-mt target. This allows us to add
a Libs.private field to libzstd.pc which gets conditionally populated
with '-pthread'.
The 1.5.0 release notes mention that the static library isn't
multi-threaded by default, due to concern for people building static
binaries with libzstd:
Now the dynamic library supports multi-threaded compression by
default. Note that this property is not extended to the static
library because doing so would have impacted the build script of
existing client applications (requiring them to add -pthread to their
recipe), thus potentially breaking their build.
To get closer to being able to enable multi-threading for all library
builds by default, this commit makes it so that any libzstd consumer
using pkg-config gets the correct flags.