MicBosi / VisualizationLibrary

Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on OpenGL 1.x-4.x supporting Windows, Linux and Mac OS X.
http://VisualizationLibrary.org
Other
339 stars 94 forks source link

make error: implicit declaration of function 'lseek' #202

Open ccworld1000 opened 2 years ago

ccworld1000 commented 2 years ago

Env: MacOS11, Xcode13

CC # make
[  1%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/adler32.c.o
[  1%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/compress.c.o
[  1%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/crc32.c.o
[  2%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/deflate.c.o
[  2%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/gzclose.c.o
[  2%] Building C object src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/gzlib.c.o
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:256:24: error: implicit declaration of function 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        state->start = LSEEK(state->fd, 0, SEEK_CUR);
                       ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:256:24: note: did you mean 'fseek'?
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/stdio.h:162:6: note: 'fseek' declared here
int      fseek(FILE *, long, int);
         ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:355:9: error: implicit declaration of function 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
        ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:396: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);
              ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:492:14: error: implicit declaration of function 'lseek' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    offset = LSEEK(state->fd, 0, SEEK_CUR);
             ^
/Users/cc/Downloads/VisualizationLibrary-master/src/external/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
4 errors generated.
make[2]: *** [src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/__/__/__/external/zlib/gzlib.c.o] Error 1
make[1]: *** [src/vlCore/plugins/zlib/CMakeFiles/ZLib.dir/all] Error 2
make: *** [all] Error 2
CC # open /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/
CC #
rmarrcode commented 1 year ago

Also had this issue on MACOSX. Was able to bypass by placing #include <unistd.h> in every file that has this issue.