madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.55k stars 2.43k forks source link

Problem building library when not Windows and application code is not C #923

Closed jimbodeman closed 6 months ago

jimbodeman commented 6 months ago

If compiling with Linux and application code is not C, a #include <unistd.h> is required in gzguts.h. I think this #include is expected to be in the application code but the application code used here is Ada. The ACT Gnat Pro compiler (based on gcc) is being used so it can handle compiling the Zlib library.

When built under Linux I get warnings for write, close, read and lseek.

Where this seems to work is inserting the #include directly after line 56 in gzguts.h that starts #if defined(STDC99)...

madler commented 6 months ago

./configure tests for unistd.h, and includes it if present. zlib is built with ./configure and make. How are you building zlib?

jimbodeman commented 6 months ago

I build Zlib using the Gnat toolset. I have been putting the source code into a Gnat project and using gprbuild <project name>. Then the Ada code project with's the Zlib project. If I gprbuild <Ada project>, it automatically builds the Zlib library.

If I do ./configure, then gprbuild builds fine with no warnings. It also builds fine under Windows (using the Gnat toolset) with the modified zconf.h file.

If zconf.h is modified by ./configure, do I still need to meet the requirements of FAQ number 24?

madler commented 6 months ago

If I do ./configure, then gprbuild builds fine with no warnings. It also builds fine under Windows (using the Gnat toolset) with the modified zconf.h file.

Great! I will consider this resolved then.

If zconf.h is modified by ./configure, do I still need to meet the requirements of FAQ number 24?

No, no worries.