Skip to content
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

zlibWrapper build failure - error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’ #3216

Closed
orbea opened this issue Jul 27, 2022 · 1 comment · Fixed by #3217
Labels
build release-blocking Must be done by the release

Comments

@orbea
Copy link
Contributor

orbea commented Jul 27, 2022

Describe the bug
The zlibWrapper build fails when the OF macro is not defined.

$ make -j1
cc -O3   -DXXH_NAMESPACE=ZSTD_ -I. -I../programs -I../lib -I../lib/common -I.   -c -o fitblk.o examples/fitblk.c
cc -O3   -DXXH_NAMESPACE=ZSTD_ -I. -I../programs -I../lib -I../lib/common -I.   -c -o zstd_zlibwrapper.o zstd_zlibwrapper.c
zstd_zlibwrapper.c:104:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  104 | ZEXTERN const char * ZEXPORT z_zlibVersion OF((void)) { return zlibVersion();  }
      |                                            ^~
zstd_zlibwrapper.c:263:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  263 | ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level,
      |                                    ^~
zstd_zlibwrapper.c:290:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  290 | ZEXTERN int ZEXPORT z_deflateInit2_ OF((z_streamp strm, int level, int method,
      |                                     ^~
zstd_zlibwrapper.c:322:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  322 | ZEXTERN int ZEXPORT z_deflateReset OF((z_streamp strm))
      |                                    ^~
zstd_zlibwrapper.c:337:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  337 | ZEXTERN int ZEXPORT z_deflateSetDictionary OF((z_streamp strm,
      |                                            ^~
zstd_zlibwrapper.c:362:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  362 | ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush))
      |                               ^~
zstd_zlibwrapper.c:468:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  468 | ZEXTERN int ZEXPORT z_deflateEnd OF((z_streamp strm))
      |                                  ^~
zstd_zlibwrapper.c:486:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  486 | ZEXTERN uLong ZEXPORT z_deflateBound OF((z_streamp strm,
      |                                      ^~
zstd_zlibwrapper.c:496:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  496 | ZEXTERN int ZEXPORT z_deflateParams OF((z_streamp strm,
      |                                     ^~
zstd_zlibwrapper.c:597:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  597 | ZEXTERN int ZEXPORT z_inflateInit_ OF((z_streamp strm,
      |                                    ^~
zstd_zlibwrapper.c:626:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  626 | ZEXTERN int ZEXPORT z_inflateInit2_ OF((z_streamp strm, int  windowBits,
      |                                     ^~
zstd_zlibwrapper.c:663:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  663 | ZEXTERN int ZEXPORT z_inflateReset OF((z_streamp strm))
      |                                    ^~
zstd_zlibwrapper.c:681:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  681 | ZEXTERN int ZEXPORT z_inflateReset2 OF((z_streamp strm,
      |                                     ^~
zstd_zlibwrapper.c:699:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  699 | ZEXTERN int ZEXPORT z_inflateSetDictionary OF((z_streamp strm,
      |                                            ^~
zstd_zlibwrapper.c:733:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  733 | ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
      |                               ^~
zstd_zlibwrapper.c:929:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  929 | ZEXTERN int ZEXPORT z_inflateEnd OF((z_streamp strm))
      |                                  ^~
zstd_zlibwrapper.c:946:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  946 | ZEXTERN int ZEXPORT z_inflateSync OF((z_streamp strm))
      |                                   ^~
zstd_zlibwrapper.c:958:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  958 | ZEXTERN int ZEXPORT z_deflateCopy OF((z_streamp dest,
      |                                   ^~
zstd_zlibwrapper.c:967:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  967 | ZEXTERN int ZEXPORT z_deflateTune OF((z_streamp strm,
      |                                   ^~
zstd_zlibwrapper.c:980:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  980 | ZEXTERN int ZEXPORT z_deflatePending OF((z_streamp strm,
      |                                      ^~
zstd_zlibwrapper.c:991:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
  991 | ZEXTERN int ZEXPORT z_deflatePrime OF((z_streamp strm,
      |                                    ^~
zstd_zlibwrapper.c:1001:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1001 | ZEXTERN int ZEXPORT z_deflateSetHeader OF((z_streamp strm,
      |                                        ^~
zstd_zlibwrapper.c:1014:44: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1014 | ZEXTERN int ZEXPORT z_inflateGetDictionary OF((z_streamp strm,
      |                                            ^~
zstd_zlibwrapper.c:1025:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1025 | ZEXTERN int ZEXPORT z_inflateCopy OF((z_streamp dest,
      |                                   ^~
zstd_zlibwrapper.c:1035:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1035 | ZEXTERN long ZEXPORT z_inflateMark OF((z_streamp strm))
      |                                    ^~
zstd_zlibwrapper.c:1044:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1044 | ZEXTERN int ZEXPORT z_inflatePrime OF((z_streamp strm,
      |                                    ^~
zstd_zlibwrapper.c:1054:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1054 | ZEXTERN int ZEXPORT z_inflateGetHeader OF((z_streamp strm,
      |                                        ^~
zstd_zlibwrapper.c:1063:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1063 | ZEXTERN int ZEXPORT z_inflateBackInit_ OF((z_streamp strm, int windowBits,
      |                                        ^~
zstd_zlibwrapper.c:1074:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1074 | ZEXTERN int ZEXPORT z_inflateBack OF((z_streamp strm,
      |                                   ^~
zstd_zlibwrapper.c:1084:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1084 | ZEXTERN int ZEXPORT z_inflateBackEnd OF((z_streamp strm))
      |                                      ^~
zstd_zlibwrapper.c:1092:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1092 | ZEXTERN uLong ZEXPORT z_zlibCompileFlags OF((void)) { return zlibCompileFlags(); }
      |                                          ^~
zstd_zlibwrapper.c:1099:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1099 | ZEXTERN int ZEXPORT z_compress OF((Bytef *dest,   uLongf *destLen,
      |                                ^~
zstd_zlibwrapper.c:1118:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1118 | ZEXTERN int ZEXPORT z_compress2 OF((Bytef *dest,   uLongf *destLen,
      |                                 ^~
zstd_zlibwrapper.c:1134:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1134 | ZEXTERN uLong ZEXPORT z_compressBound OF((uLong sourceLen))
      |                                       ^~
zstd_zlibwrapper.c:1143:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1143 | ZEXTERN int ZEXPORT z_uncompress OF((Bytef *dest,   uLongf *destLen,
      |                                  ^~
zstd_zlibwrapper.c:1162:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1162 | ZEXTERN uLong ZEXPORT z_adler32 OF((uLong adler, const Bytef *buf, uInt len))
      |                                 ^~
zstd_zlibwrapper.c:1167:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1167 | ZEXTERN uLong ZEXPORT z_crc32   OF((uLong crc, const Bytef *buf, uInt len))
      |                                 ^~
zstd_zlibwrapper.c:1174:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1174 | ZEXTERN uLong ZEXPORT z_adler32_z OF((uLong adler, const Bytef *buf, z_size_t len))
      |                                   ^~
zstd_zlibwrapper.c:1179:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1179 | ZEXTERN uLong ZEXPORT z_crc32_z OF((uLong crc, const Bytef *buf, z_size_t len))
      |                                 ^~
zstd_zlibwrapper.c:1187:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1187 | ZEXTERN const z_crc_t FAR * ZEXPORT z_get_crc_table    OF((void))
      |                                                        ^~
zstd_zlibwrapper.c:1194:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OF’
 1194 | ZEXTERN const char * ZEXPORT z_zError OF((int err))

To Reproduce

  1. cd zlibWrapper
  2. make

Expected behavior
The build should succeed.

Desktop (please complete the following information):

  • OS: Gentoo
  • Version e5db7c9
  • Compiler gcc 11.3.0
  • Flags N/A
  • Other relevant hardware specs N/A
  • Build system Makefile

Additional context
Where is OF defined? I am not finding it in the zstd repo.

@orbea
Copy link
Contributor Author

orbea commented Jul 27, 2022

Okay, I see what happened, this changed in zconf.h.

zlib-1.2.12

#ifndef _Z_OF /* function prototypes */
#  ifdef STDC
#    define _Z_OF(args)  args
#  else
#    define _Z_OF(args)  ()
#  endif
#endif

zlib-1.2.11

#ifndef OF /* function prototypes */
#  ifdef STDC
#    define OF(args)  args
#  else
#    define OF(args)  ()
#  endif
#endif

orbea added a commit to orbea/zstd that referenced this issue Jul 27, 2022
In zlib 1.2.12 the OF macro was changed to _Z_OF breaking any
project that used zlibWrapper. To fix this the OF has been
changed to _Z_OF everywhere and _Z_OF is defined as OF in the
case it is not yet defined for zlib 1.2.11 and older.

Fixes: facebook#3216
@terrelln terrelln added build release-blocking Must be done by the release labels Jul 29, 2022
terrelln pushed a commit that referenced this issue Jul 29, 2022
In zlib 1.2.12 the OF macro was changed to _Z_OF breaking any
project that used zlibWrapper. To fix this the OF has been
changed to _Z_OF everywhere and _Z_OF is defined as OF in the
case it is not yet defined for zlib 1.2.11 and older.

Fixes: #3216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build release-blocking Must be done by the release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants