error using MacPorts zlib, not present with system zlib?
Adam Mercer
ram at macports.org
Wed Feb 22 12:32:56 PST 2012
Hi
Not sure of the correct place to discuss this but in tracking down a
build issue with a port I've found an interesting issue with MacPorts
zlib.
This simple test code illustrates the problem:
[ram at mimir tmp]$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <zlib.h>
int main(void)
{
void *file;
int c;
file = gzopen("test.dat.gz", "r");
if (file == Z_NULL)
{
fprintf(stderr, "unable to open file\n");
exit(1);
}
c = gzgetc(file);
fprintf(stdout, "c = %c\n", c);
gzclose(file);
}
[ram at mimir tmp]$ zcat test.dat.gz
test
file
If I compile this against the system zlib then it works as expected:
[ram at mimir tmp]$ clang -o test test.c -lz
[ram at mimir tmp]$ ./test
c = t
But not against the MacPorts zlib:
[ram at mimir tmp]$ clang -o test test.c -I/opt/local/include -L/opt/local/lib -lz
test.c:17:7: error: member reference base type 'void' is not a structure or
union
c = gzgetc(file);
^~~~~~~~~~~~
/opt/local/include/zlib.h:1655:11: note: instantiated from:
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g))
~~~ ^
test.c:17:7: error: member reference base type 'void' is not a structure or
union
c = gzgetc(file);
^~~~~~~~~~~~
/opt/local/include/zlib.h:1655:24: note: instantiated from:
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g))
~~~ ^
test.c:17:7: error: member reference base type 'void' is not a structure or
union
c = gzgetc(file);
^~~~~~~~~~~~
/opt/local/include/zlib.h:1655:37: note: instantiated from:
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g))
~~~ ^
test.c:17:7: error: member reference base type 'void' is not a structure or
union
c = gzgetc(file);
^~~~~~~~~~~~
/opt/local/include/zlib.h:1655:51: note: instantiated from:
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g))
~~~ ^
4 errors generated.
[ram at mimir tmp]$
Does anyone know why MacPorts zlib treats this as an error but the
system version doesn't?
Cheers
Adam
More information about the macports-users
mailing list