[MacPorts] #61790: freeimage: fails to compile on macOS 11.0 due to C99 implicit declaration issues

MacPorts noreply at macports.org
Wed Dec 9 12:38:58 UTC 2020


#61790: freeimage: fails to compile on macOS 11.0 due to C99 implicit declaration
issues
--------------------+-----------------------
 Reporter:  mdave   |      Owner:  (none)
     Type:  defect  |     Status:  new
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:  freeimage
--------------------+-----------------------
 This seems to be a pretty common theme amongst a lot of ports, so will aim
 to help out where I can to fix things. A few C99 errors on macOS 11.0 for
 the freeimage source, e.g.

 {{{
 /usr/bin/clang -Os -arch x86_64
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -O3 -fPIC
 -fexceptions -fvisibility=hidden -DOPJ_STATIC -DNO_LCMS
 -DDISABLE_PERF_MEASUREMENT -D__ANSI__ -I. -ISource -ISource/Metadata
 -ISource/FreeImageToolkit -ISource/LibJPEG -ISource/LibPNG
 -ISource/LibTIFF4 -ISource/ZLib -ISource/LibOpenJPEG -ISource/OpenEXR
 -ISource/OpenEXR/Half -ISource/OpenEXR/Iex -ISource/OpenEXR/IlmImf
 -ISource/OpenEXR/IlmThread -ISource/OpenEXR/Imath -ISource/OpenEXR/IexMath
 -ISource/LibRawLite -ISource/LibRawLite/dcraw -ISource/LibRawLite/internal
 -ISource/LibRawLite/libraw -ISource/LibRawLite/src -ISource/LibWebP
 -ISource/LibJXR -ISource/LibJXR/common/include -ISource/LibJXR/image/sys
 -ISource/LibJXR/jxrgluelib -fPIC -c Source/ZLib/inffast.c -o
 Source/ZLib/inffast.o
 Source/ZLib/gzlib.c:252:9: error: implicit declaration of function 'lseek'
 is invalid in C99 [-Werror,-Wimplicit-function-declaration]
         LSEEK(state->fd, 0, SEEK_END);  /* so gzoffset() is correct */
         ^
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 Source/ZLib/gzlib.c:252:9: note: did you mean 'fseek'?
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/stdio.h:162:6:
 note: 'fseek' declared here
 int      fseek(FILE *, long, int);
          ^
 Source/ZLib/gzlib.c:258:24: error: implicit declaration of function
 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
         state->start = LSEEK(state->fd, 0, SEEK_CUR);
                        ^
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 Source/ZLib/gzlib.c:359:9: error: implicit declaration of function 'lseek'
 is invalid in C99 [-Werror,-Wimplicit-function-declaration]
     if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
         ^
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 Source/ZLib/gzlib.c:400:15: error: implicit declaration of function
 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
         ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
               ^
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 Source/ZLib/gzlib.c:496:14: error: implicit declaration of function
 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
     offset = LSEEK(state->fd, 0, SEEK_CUR);
              ^
 Source/ZLib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
 #  define LSEEK lseek
                 ^
 5 errors generated.
 Source/ZLib/gzread.c:35:15: error: implicit declaration of function 'read'
 is invalid in C99 [-Werror,-Wimplicit-function-declaration]
         ret = read(state->fd, buf + *have, get);
 }}}

 I have a patch for this, which I will put up as a PR on GitHub shortly,
 which involves adding necessary headers and inlining a function to get
 this to compile.

-- 
Ticket URL: <https://trac.macports.org/ticket/61790>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list