gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
62 stars 50 forks source link

error: implicit declaration of function ‘strndup’ #2

Closed ryandesign closed 7 years ago

ryandesign commented 7 years ago

libzzip 0.13.66 fails to build on older systems, such as Mac OS X 10.6 Snow Leopard and earlier, that do not have the strndup function:

:info:build ../../bins/unzzipcat-zip.c: In function ‘create_fopen’:
:info:build ../../bins/unzzipcat-zip.c:52: error: implicit declaration of function ‘strndup’
:info:build ../../bins/unzzipcat-zip.c:52: warning: incompatible implicit declaration of built-in function ‘strndup’

You should either avoid using this function or provide a compatibility implementation when needed.

See https://trac.macports.org/ticket/54227 for the MacPorts project's bug report on this issue.

gdraheim commented 7 years ago

A new internal header <zzip/__string.h> has been introduced to handle a missing strndup().

Please check the current master branch again.

gdraheim commented 7 years ago

Also reported to need a fix on mingw.

Probably fixed by now, feel free to reopen an issue otherwise.

nickion commented 5 years ago

Might have been fixed back in 2017, but it's an issue with the most recent release 0.13.69

gcc -DHAVE_CONFIG_H -I.. -I../..       -O2 -D_USE_MMAP  -fomit-frame-pointer -Wall -Wpointer-arith -Wsign-compare -Wmissing-declarations -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wstrict-aliasing -Wstrict-prototypes  -MT unzzipcat-zip.o -MD -MP -MF .deps/unzzipcat-zip.Tpo -c -o unzzipcat-zip.o ../../bins/unzzipcat-zip.c
../../bins/unzzipcat-zip.c: In function ‘makedirs’:
../../bins/unzzipcat-zip.c:76: error: implicit declaration of function ‘strndup’
../../bins/unzzipcat-zip.c:76: warning: incompatible implicit declaration of built-in function ‘strndup’
../../bins/unzzipcat-zip.c: In function ‘create_fopen’:
../../bins/unzzipcat-zip.c:93: warning: incompatible implicit declaration of built-in function ‘strndup’
make[3]: *** [unzzipcat-zip.o] Error 1

Incidentally, for some reason the builds aren't produced with -O2, so we had to add that by setting CFLAGS explicitly. It has no relation to the error.