-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix zlibWrapper build #4021
Fix zlibWrapper build #4021
Conversation
Just after a clone I'm getting this: ~/zstd/zlibWrapper$ cc -c zstd_zlibwrapper.o gz*.c -lz -lzstd -DSTDC gzwrite.c: In function ‘gz_write’: gzwrite.c:226:43: error: ‘z_uInt’ undeclared (first use in this function); did you mean ‘uInt’? 226 | state.state->strm.avail_in = (z_uInt)n; | ^~~~~~ | uInt gzwrite.c:226:43: note: each undeclared identifier is reported only once for each function it appears in gzwrite.c:226:50: error: expected ‘;’ before ‘n’ 226 | state.state->strm.avail_in = (z_uInt)n; | ^ | ; z_uInt is never used directly, zconf.h redefines uInt to z_uInt under the condition that Z_PREFIX is set. All examples use uInt, and the type of avail_in is also uInt. In this commit I modify the cast to refer to the same type as the type of lvalue. Arguably, the real fix here is to handle possible overflows, but that's beyond the scope of this commit.
Hi @pstef! 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@meta.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Simple enough. I wonder though why we did not observe this error in CI ? edit : |
I guess I'm right for the wrong reasons, probably. I was almost ready to blame Fedora Rawhide or gcc-14, each of which is a development version at this time. But I also tested gcc-14 under Debian Testing and it doesn't produce the error, so it has to be either Rawhide's "fault" or maybe I did something weird to my system. I'll try to use gcc -H or -M and see if I can figure it out. But at this point I stand by the conclusion that the cast should be modified as proposed here. |
On my system, files So for the zlibWrapper example to be more portable, it should point people to invoke their compiler more or less like this: And with -I., the -DSTDC doesn't seem required anymore. |
@Cyan4973 I was preparing an update to the README file, adding just the On the other hand, the instructions never say one should copy the files, only that they are not provided by this repository. So maybe instead of adding |
I think the initial idea was that |
Just after a clone I'm getting this:
z_uInt is never used directly, zconf.h redefines uInt to z_uInt under the condition that Z_PREFIX is set. All examples use uInt, and the type of avail_in is also uInt.
In this commit I modify the cast to refer to the same type as the type of lvalue.
Arguably, the real fix here is to handle possible overflows, but that's beyond the scope of this commit.