Skip to content

Conversation

@psumbera
Copy link
Contributor

No description provided.

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

Thank you for the workflow!
As for the CMake part: in the Solaris docs at https://docs.oracle.com/cd/E88353_01/html/E37843/memset-s-3c.html it is claimed that #define __STDC_WANT_LIB_EXT1__ 1 is needed, and we already do that.
What Solaris version are you using exactly?

@psumbera
Copy link
Contributor Author

Thank you for the workflow! As for the CMake part: in the Solaris docs at https://docs.oracle.com/cd/E88353_01/html/E37843/memset-s-3c.html it is claimed that #define __STDC_WANT_LIB_EXT1__ 1 is needed, and we already do that. What Solaris version are you using exactly?

You are right. But in case of lib/zip_buffer.c it's defined after inclusion of <string.h>.

Not sure what is proper solution.

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

I thought I had fixed that in e16526d - which version are you testing against?

@psumbera
Copy link
Contributor Author

Ok, I saw the problem in 1.11.4. I didn't verify latest commits. So hopefully it does work now.

@0-wiz-0 0-wiz-0 merged commit e96a210 into nih-at:main Jan 27, 2026
1 check was pending
@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

Thank you, merged!

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

Hm, ziptool_regress fails to build with

[ 91%] Building C object regress/CMakeFiles/ziptool_regress.dir/ziptool_regress.c.o
  In file included from /home/runner/work/libzip/libzip/src/ziptool.c:34,
                   from /home/runner/work/libzip/libzip/regress/ziptool_regress.c:94:
  /home/runner/work/libzip/libzip/src/ziptool.c: In function ‘zstat’:
  /home/runner/work/libzip/libzip/lib/compat.h:189:23: error: implicit declaration of function ‘localtime_s’; did you mean ‘localtime_r’? [-Wimplicit-function-declaration]
    189 | #define zip_localtime localtime_s
        |                       ^~~~~~~~~~~
  /home/runner/work/libzip/libzip/src/ziptool.c:675:15: note: in expansion of macro ‘zip_localtime’
    675 |         tpm = zip_localtime(&sb.mtime, &tm);
        |               ^~~~~~~~~~~~~
  /home/runner/work/libzip/libzip/src/ziptool.c:675:13: error: assignment to ‘struct tm *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    675 |         tpm = zip_localtime(&sb.mtime, &tm);
        |             ^
  gmake[2]: *** [regress/CMakeFiles/ziptool_regress.dir/build.make:76: regress/CMakeFiles/ziptool_regress.dir/ziptool_regress.c.o] Error 1
  gmake[1]: *** [CMakeFiles/Makefile2:1484: regress/CMakeFiles/ziptool_regress.dir/all] Error 2
  gmake: *** [Makefile:146: all] Error 2
[185](https://github.com/nih-at/libzip/actions/runs/21400471581/job/61609832772#step:3:1861)

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

https://docs.oracle.com/cd/E88353_01/html/E37843/localtime-s-3c.html again says that #define __STDC_WANT_LIB_EXT1__ 1 should fix this, and src/ziptool.c includes compat.h, which starts with

/* to have *_MAX definitions for all types when compiling with g++ */
 #define __STDC_LIMIT_MACROS

 /* to have ISO C secure library functions */
 #define __STDC_WANT_LIB_EXT1__ 1

Not sure yet what the problem is.

@psumbera
Copy link
Contributor Author

Sorry, for the problems! Originally it was passing. I think it would be better to allow CI builds for all pull requests.

@psumbera
Copy link
Contributor Author

I think that this resolves the issue:

diff --git a/regress/ziptool_regress.c b/regress/ziptool_regress.c
index 1cfd2921..00f3765a 100644
--- a/regress/ziptool_regress.c
+++ b/regress/ziptool_regress.c
@@ -1,3 +1,5 @@
+#include "compat.h"
+
 #include "zip.h"
 
 #include <sys/stat.h>

But overall I think that it might be better to define -D__STDC_WANT_LIB_EXT1__=1 for build (set(CMAKE_REQUIRED_DEFINITIONS "-D__STDC_WANT_LIB_EXT1__=1")) than having it in lib/compat.h.

@0-wiz-0
Copy link
Member

0-wiz-0 commented Jan 27, 2026

I've fixed the Solaris build, thanks for the pointer.

As for your other suggestion - this is already set in the CMake file

./CMakeLists.txt:list(APPEND CMAKE_REQUIRED_DEFINITIONS -D__STDC_WANT_LIB_EXT1__=1)

so it should affect the whole build, and I'm not sure why it didn't affect ziptool_regress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants