Trying to build the latest release (version 3.18.0) with GCC version 14.2.1 fails with
gzlib.c:14:17: error: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]:
[...]
gcc -march=i686 -m32 -march=native -mtune=native -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -fstack-clash-protection -fcf-protection -w -flto=auto -O3 -fPIC -fvisibility=hidden -DNO_LCMS -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/zutil.c -o Source/ZLib/zutil.o
Source/ZLib/gzlib.c: In function ‘gz_open’:
Source/ZLib/gzlib.c:14:17: error: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
14 | # define LSEEK lseek
| ^~~~~
Source/ZLib/gzlib.c:252:9: note: in expansion of macro ‘LSEEK’
252 | LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */
| ^~~~~
Source/ZLib/gzwrite.c: In function ‘gz_comp’:
Source/ZLib/gzwrite.c:89:20: error: implicit declaration of function ‘write’; did you mean ‘fwrite’? [-Wimplicit-function-declaration]
89 | writ = write(state->fd, strm->next_in, put);
| ^~~~~
| fwrite
Source/ZLib/gzwrite.c: In function ‘gzclose_w’:
Source/ZLib/gzwrite.c:661:9: error: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
661 | if (close(state->fd) == -1)
| ^~~~~
| pclose
gcc -march=i686 -m32 -march=native -mtune=native -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -fstack-clash-protection -fcf-protection -w -flto=auto -O3 -fPIC -fvisibility=hidden -DNO_LCMS -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/LibOpenJPEG/bio.c -o Source/LibOpenJPEG/bio.o
make[1]: *** [Makefile.gnu:61: Source/ZLib/gzlib.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.gnu:61: Source/ZLib/gzwrite.o] Error 1
Source/ZLib/gzread.c: In function ‘gz_load’:
Source/ZLib/gzread.c:35:15: error: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
35 | ret = read(state->fd, buf + *have, get);
| ^~~~
| fread
Source/ZLib/gzread.c: In function ‘gzclose_r’:
Source/ZLib/gzread.c:651:11: error: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
651 | ret = close(state->fd);
| ^~~~~
| pclose
make[1]: *** [Makefile.gnu:61: Source/ZLib/gzread.o] Error 1
make[1]: Leaving directory '/var/cache/makepkg/build/lib32-freeimage/src/FreeImage'
A workaround is to add -Wno-error=implicit-function-declaration to CFLAGS/ CXXFLAGS environment variable, but it should be fixed in the source code.
Also warnings are generated.
Regards!