Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: support IBM i system #22156

Merged
merged 1 commit into from Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion numpy/distutils/ccompiler.py
Expand Up @@ -686,10 +686,17 @@ def CCompiler_cxx_compiler(self):
cxx.compiler_cxx = cxx.compiler_cxx
cxx.compiler_so = [cxx.compiler_cxx[0]] + \
sanitize_cxx_flags(cxx.compiler_so[1:])
if sys.platform.startswith('aix') and 'ld_so_aix' in cxx.linker_so[0]:
if (sys.platform.startswith(('aix', 'os400')) and
'ld_so_aix' in cxx.linker_so[0]):
# AIX needs the ld_so_aix script included with Python
cxx.linker_so = [cxx.linker_so[0], cxx.compiler_cxx[0]] \
+ cxx.linker_so[2:]
if sys.platform.startswith('os400'):
#This is required by i 7.4 and prievous for PRId64 in printf() call.
cxx.compiler_so.append('-D__STDC_FORMAT_MACROS')
#This a bug of gcc10.3, which failed to handle the TLS init.
cxx.compiler_so.append('-fno-extern-tls-init')
cxx.linker_so.append('-fno-extern-tls-init')
else:
cxx.linker_so = [cxx.compiler_cxx[0]] + cxx.linker_so[1:]
return cxx
Expand Down
6 changes: 6 additions & 0 deletions numpy/distutils/fcompiler/__init__.py
Expand Up @@ -527,6 +527,12 @@ def get_flags(tag, flags):
ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
python_exp = os.path.join(python_lib, 'config', 'python.exp')
linker_so = [ld_so_aix] + linker_so + ['-bI:'+python_exp]
if sys.platform.startswith('os400'):
from distutils.sysconfig import get_config_var
python_config = get_config_var('LIBPL')
ld_so_aix = os.path.join(python_config, 'ld_so_aix')
python_exp = os.path.join(python_config, 'python.exp')
linker_so = [ld_so_aix] + linker_so + ['-bI:'+python_exp]
self.set_commands(linker_so=linker_so+linker_so_flags)

linker_exe = self.linker_exe
Expand Down
4 changes: 2 additions & 2 deletions numpy/distutils/fcompiler/gnu.py
Expand Up @@ -256,7 +256,7 @@ def runtime_library_dir_option(self, dir):

if sys.platform == 'darwin':
return f'-Wl,-rpath,{dir}'
elif sys.platform[:3] == 'aix':
elif sys.platform.startswith(('aix', 'os400')):
# AIX RPATH is called LIBPATH
return f'-Wl,-blibpath:{dir}'
else:
Expand Down Expand Up @@ -305,7 +305,7 @@ def version_match(self, version_string):
module_dir_switch = '-J'
module_include_switch = '-I'

if sys.platform[:3] == 'aix':
if sys.platform.startswith(('aix', 'os400')):
executables['linker_so'].append('-lpthread')
if platform.architecture()[0][:2] == '64':
for key in ['compiler_f77', 'compiler_f90','compiler_fix','linker_so', 'linker_exe']:
Expand Down