Hi, This patch provides two z/OS fixes:
1. configure.ac: Correct the build_os name and use pkg-config to find zoslib on z/OS and set EXTRA_LIBS_FOR_BUILD to the actual linker flags returned by pkg-config; fail with a clear error if zoslib.pc is not found. 2. src/spawn-posix.c: rename the gpgrt_spawn_actions member environ to env. This avoids a name collision with the global symbol “environ” (defined as a macro on z/OS), which cause build issues. Thanks Signed-off-by: Sachin T <[email protected]> --- configure.ac | 8 +++++--- src/spawn-posix.c | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 9792cba..359cc29 100644 --- a/configure.ac +++ b/configure.ac @@ -144,11 +144,13 @@ esac # Set some variables for building build platform helpers. case "$build_os" in - *zOS*) - EXTRA_LIBS_FOR_BUILD=zoslib + *openedition*) + PKG_CHECK_MODULES([ZOSLIB], [zoslib], + [EXTRA_LIBS_FOR_BUILD="$ZOSLIB_LIBS"], + [AC_MSG_ERROR([zoslib not found. Please ensure zoslib.pc is in PKG_CONFIG_PATH.])]) ;; *) - EXTRA_LIBS_FOR_BUILD= + EXTRA_LIBS_FOR_BUILD="" ;; esac AC_SUBST(EXTRA_LIBS_FOR_BUILD) diff --git a/src/spawn-posix.c b/src/spawn-posix.c index 8cdd032..73cef10 100644 --- a/src/spawn-posix.c +++ b/src/spawn-posix.c @@ -63,7 +63,7 @@ struct gpgrt_spawn_actions { int fd[3]; const int *except_fds; - char **environ; + char **env; const char *const *envchange; void (*atfork) (void *); void *atfork_arg; @@ -432,8 +432,8 @@ my_exec (const char *pgmname, const char *argv[], gpgrt_spawn_actions_t act, if (pgmname == NULL) return 0; - if (act->environ) - execve (pgmname, (char *const *)argv, act->environ); + if (act->env) + execve (pgmname, (char *const *)argv, act->env); else execv (pgmname, (char *const *)argv); @@ -534,7 +534,7 @@ void _gpgrt_spawn_actions_set_environ (gpgrt_spawn_actions_t act, char **environ_for_child) { - act->environ = environ_for_child; + act->env = environ_for_child; } void -- 2.51.0 From: Sachin T <[email protected]> Date: Monday, 30 June 2025 at 10:25 PM To: Werner Koch <[email protected]>, Sachin T via Gnupg-devel <[email protected]> Subject: Re: [EXTERNAL] Re: [PATCH libgpg-error] Add patch to support IBM z/OS Hi, Apologies for the delayed response. Thank you for the suggestions. I will look into both options and follow up with a patch once I have a solution prepared. Regards Sachin On 20/06/25, 9:31 PM, "Werner Koch" <[email protected]> wrote: On Fri, 20 Jun 2025 10:44, Sachin T said: > zoslib consists of two static libraries and one separate object > file. Due to a z/OS linker limitation, the .o file can’t be included > inside an archive , it may get ignored unless one of its symbols is > explicitly referenced. I think we have something like this also for an older SunOS or so. The solution was to explictly reference the symbol for the main code. I think this was/is in Libgcrypt but I can't remember. But no problem if you already have a solution. > Or would you prefer this logic be handled entirely within configure.ac? I think it better to put this into configure.ac - this also documents the need for them. +case "$build_os" in + *zOS*) + EXTRA_LIBS_FOR_BUILD=-lzoslib -lzoslib-supp <lib_path>/celquopt.s.o + ;; Is there any standard <lib_path> or can this be figured out at configure run time? Another option would be to add it to autogen.rc and extend autogen.sh with a --build-zos option like we did for Windows. Shalom-Salam, Werner -- The pioneers of a warless world are the youth that refuse military service. - A. Einstein
_______________________________________________ Gnupg-devel mailing list [email protected] https://lists.gnupg.org/mailman/listinfo/gnupg-devel
