8000 BLD: Enable build on AIX by aixtools · Pull Request #8173 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD: Enable build on AIX #8173

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

Merged
merged 2 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
commit BLD: AIX uses the flag _LARGE_FILES to ensure proper prototype…
… declarations

The problem this fix resolves is to ensure that 32-bit and 64-bit functions
(e.g., fclear() and fclear64()) to access/manipulate "large files" are
defined properly - much as GNU and other platforms use one or more of
the defines _FILE_OFFSET_BITS, _LARGEFILE_SOURCE, and _LARGEFILE64_SOURCE.

Without this fix the numpy code only defines flags that are not recognized
in the AIX environment and have no effect in anyway.
The fix applies the AIX convention and does not "export" any of the flags
currently exported. For all other platforms the current flags:
_FILE_OFFSET_BITS, _LARGEFILE_SOURCE, and _LARGEFILE64_SOURCE are "exported".

This fix should not have any impact or side-effect based on the version
of python used.

History:
Starting around 1997 AIX started supporting so-called "large files",
i.e., length > signed 32-bit. In the period 1997-1998 the flag _LARGE_FILES
was established to simplify porting 32-bit applications to 64-bit.
The convention is to define _LARGE_FILES before including any
"system include files" either as an argument to ${CC} (e.g., in ${CFLAGS}
or as the first #define in every source file. This is to ensure that
that no relevant function calls would be redefined later in the build process.
  • Loading branch information
aixtools committed Oct 21, 2016
commit 2c5e708f7a621bb714fc24c26e33f68afff45637
9 changes: 6 additions & 3 deletions numpy/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,12 @@ def generate_api(ext, build_dir):
config.add_include_dirs(join('src', 'npysort'))

config.add_define_macros([("HAVE_NPY_CONFIG_H", "1")])
config.add_define_macros([("_FILE_OFFSET_BITS", "64")])
config.add_define_macros([('_LARGEFILE_SOURCE', '1')])
config.add_define_macros([('_LARGEFILE64_SOURCE', '1')])
if sys.platform[:3] == "aix":
config.add_define_macros([("_LARGE_FILES", None)])
else:
config.add_define_macros([("_FILE_OFFSET_BITS", "64")])
config.add_define_macros([('_LARGEFILE_SOURCE', '1')])
config.add_define_macros([('_LARGEFILE64_SOURCE', '1')])

config.numpy_include_dirs.extend(config.paths('include'))

Expand Down
5 changes: 4 additions & 1 deletion numpy/random/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def generate_libraries(ext, build_dir):

# enable unix large file support on 32 bit systems
# (64 bit off_t, lseek -> lseek64 etc.)
defs = [('_FILE_OFFSET_BITS', '64'),
if sys.platform[:3] == "aix":
defs = [('_LARGE_FILES', None)]
else:
defs = [('_FILE_OFFSET_BITS', '64'),
('_LARGEFILE_SOURCE', '1'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation. the list contents should align vertically.

('_LARGEFILE64_SOURCE', '1')]
if needs_mingw_ftime_workaround():
Expand Down
0