VLC fails to compile on OS X with zlib 1.2.4
Compilation is perform with macports which provides zlib 1.2.4.
Error message is:
Making all in zip
/usr/bin/make all-am
/bin/sh ../../../libtool --tag=CC --mode=compile /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=gnu99
-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include
-I/opt/local/include -DSYS_DARWIN `top_srcdir="../../.." top_builddir="../../.."
../../../vlc-config --cflags plugin libzip_plugin_la-zipstream.lo` -O2 -arch i386
-D_INTL_REDIRECT_MACROS -DMACOSX_DEPLOYMENT_TARGET=10.5 -Wall -Wextra
-Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align
-Wwrite-strings -Wmissing-prototypes -Wvolatile-register-var
-Werror-implicit-function-declaration -MT libzip_plugin_la-zipstream.lo
-MD -MP -MF .deps/libzip_plugin_la-zipstream.Tpo -c
-o libzip_plugin_la-zipstream.lo `test -f 'zipstream.c' || echo './'`zipstream.c
libtool: compile: /Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=gnu99
-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../include
-I/opt/local/include -DSYS_DARWIN -I/opt/local/include -D_FILE_OFFSET_BITS=64
-D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE
-DHAVE_RELEASE -D__LIBVLC__ -D__PLUGIN__ -DMODULE_NAME=zip
-DMODULE_NAME_IS_zip -DMODULE_STRING=\"zip\" -O4 -ffast-math
-funroll-loops -march=pentium-m -mtune=prescott -fno-omit-frame-pointer
-I../../../libs/unzip -O2 -arch i386 -D_INTL_REDIRECT_MACROS
-DMACOSX_DEPLOYMENT_TARGET=10.5 -Wall -Wextra -Wsign-compare
-Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings
-Wmissing-prototypes -Wvolatile-register-var -Werror-implicit-function-declaration
-MT libzip_plugin_la-zipstream.lo -MD -MP
-MF .deps/libzip_plugin_la-zipstream.Tpo -c zipstream.c -fno-common -DPIC
-o .libs/libzip_plugin_la-zipstream.o
In file included from ../../../libs/unzip/unzip.h:53,
from zip.h:38,
from zipstream.c:32:
/opt/local/include/zlib.h:1561: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gzseek64'
/opt/local/include/zlib.h:1562: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gztell64'
/opt/local/include/zlib.h:1563: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gzoffset64'
/opt/local/include/zlib.h:1564: error: expected declaration specifiers or '...' before 'off64_t'
/opt/local/include/zlib.h:1565: error: expected declaration specifiers or '...' before 'off64_t'
zipstream.c: In function 'ZipIO_Write':
zipstream.c:833: warning: unused variable 'ERROR_zip_cannot_write_this_should_not_happen'
make[6]: *** [libzip_plugin_la-zipstream.lo] Error 1
make[5]: *** [all] Error 2
make[4]: *** [all-recursive] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
This error is caused by the compiler option _LARGEFILE64_SOURCE which is not a valid option on OS X. As specified in libc manual at http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#index-g_t_005fLARGEFILE64_005fSOURCE-48, LARGEFILE64_SOURCE should make off64_t available. This is not the case on OS X, where off_t is already 64 bits.
Also, searching through the code, except in log files, text files, or make files, none of off64, stat64, or lseek64 is used. This seems to indicate that _LARGEFILE64_SOURCE is no longer needed for the compilation of VLC.
I am attaching a proposed patch for this issue. It will certainly need to be checked on more than the only platform (OS X) I can test it on.
More detail on the issue can be found at: http://trac.macports.org/ticket/24067