Python cross compilation for HP-UX on Linux

Trying to cross compile python3.10.4 on a Linux machine with gcc-9.3.0 for HP-UX IA64 and running into following errors. Did not find the setenv/unsetenv in stdlib.h for HP-UX.

*Python/pylifecycle.c: In function ‘_coerce_default_locale_settings’:
Python/pylifecycle.c:319:9: error: implicit declaration of function ‘setenv’; did you mean ‘getenv’? [-Werror=implicit-function-declaration]

  • 319 | if (setenv(“LC_CTYPE”, newloc, 1)) {*
  •  |         ^~~~~~*
    
  •  |         getenv*
    

cc1: some warnings being treated as errors
./Modules/posixmodule.c: In function ‘os_putenv_impl’:
./Modules/posixmodule.c:10969:9: error: implicit declaration of function ‘setenv’; did you mean ‘getenv’? [-Werror=implicit-function-declaration]
10969 | if (setenv(name_string, value_string, 1)) {

  •  |         ^~~~~~*
    
  •  |         getenv*
    

./Modules/posixmodule.c: In function ‘os_unsetenv_impl’:
./Modules/posixmodule.c:11014:15: error: implicit declaration of function ‘unsetenv’; did you mean ‘getenv’? [-Werror=implicit-function-declaration]
11014 | int err = unsetenv(PyBytes_AS_STRING(name));

  •  |               ^~~~~~~~*
    
  •  |               getenv**
    

Looks like this is implemented in 3.9 and does not have any config to skip this. Need help addressing this issue.

Try the python-dev mailing list, probably. From my (quite limited) memory there hasn’t been anyone trying to build for hp/ux for a number of years.

Thank you Mats.

I was able to use 3.8 implementation of putenv to get this to working.