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
bpo-44583: Fix build for OSF1/Tru64. #27063
base: main
Are you sure you want to change the base?
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
3ac8e47
to
d1e2928
Compare
e2101da
to
de9293c
Compare
install succeeds a lot:
but install eventually fails:
|
b245e0a
to
8f9fc33
Compare
This is meant to enable compiling with gcc4 (4.7.4). gcc3 (3.4.6) and native cc are a bit different, and might be handled later. - _XOPEN_SOURCE_EXTENDED both hides and reveals content. There is no good answer. The system headers define it by default. Undefine it to avoid warnings about repeated defines (having included sys/types to get gid_t to reproduce some if'ed out system header content). Duplicate a few lines of content that are under ifndef _XOPEN_SOURCE_EXTENDED. - Duplicate a few other troublesome lines, i.e. due to ifdef _BSD. - Possible duplication summary: round, finite, copysign, NSIG, setenv, unsetenv. - OSF1 appears to have no monotic timer; fake it badly with realtime This is probably the worst part, actual semantic degradation. - unsetenv is broken, returns void, not int configure fails to detect this, because the prototype is under ifdef _BSD and the program compiles without warning; unprototyped functions are assumed to return int, after all - wait4 always takes union wait* even if int* is used elsewhere; cast - printf C99 macros are missing with gcc - sendfile is implemented and documented, but does not match other systems; skip it - plock is documented and probably implemented, but not declared; declare it - cast away const in initgroups call (safe for all systems) - Specifying visibilty on OSF/1 warns each time; don't do it. The fixes are a bit spread out between configure.ac, pyconfig.h.in and new file pyportosf.h. It may be preferable to consolidate, esp. in configure.ac.
// Native cc support is hypothetical. gcc4 is being used. | ||
#define __STDC_CONSTANT_MACROS 1 | ||
#define __STDC_LIMIT_MACROS 1 | ||
#define __STDC_FORMAT_MACROS 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are ok for all systems. Some others even require at least one of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double copysign(double, double); // /usr/include/math.h ifndef _XOPEN_SOURCE_EXTENDED | ||
int initgroups(char*, gid_t); // /usr/include/grp.h ifndef _XOPEN_SOURCE_EXTENDED | ||
int plock(int); // documented but not declared anywhere | ||
#define HAVE_BROKEN_UNSETENV 1 // unsetenv returns void, not int; configure fails because ifdef _BSD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the PR is mostly ok, I can try to fix configure.ac instead.
i.e. it could say:
#if defined(__osf__) && !defined(_BSD)
#define _BSD
#endif
typedef union wait WAIT4_TYPE; | ||
#else | ||
typedef WAIT_TYPE WAIT4_TYPE; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok, but if reviewers prefer, I could probably autoconf this.
/* Define to 1 if you have the `sendfile' function. */ | ||
#undef HAVE_SENDFILE | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok, but if reviewers prefer, I could probably kinda autoconf it.
In particular, the check for sendfile would move out of the list of funcs, and into an individual call, that is conditional on not being OSF.
And/or we could confirm there is a declaration and what it is "like".
That would likely cleanup other systems.
Assuming the declaration is not difficult to attain.
I want to at least test the waters to see if anything is ok for OSF1, and if so, can refine it in this PR or a followup.
|
||
#endif // __GNUC__ | ||
|
||
#define CLOCK_MONOTONIC CLOCK_REALTIME // no known monotonic time source; fake it poorly for py_get_monotonic_clock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be based on ifndef CLOCK_MONOTIC.
Here though I have minimized includes, and OSF will surely never change.
Perhaps autoconf?
Ideally still, to find a monotonic time source.
// incorrect system definition: "X" | ||
#define PRIX64 "lX" | ||
#define PRIXPTR "lX" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These probably be "approximately" autoconfed.
That is, if we have the types int64_t, compare their size to int, long, long long, and whatever we find matches, use their strings.
Something like this:
https://github.com/mono/mono/blob/e44d84d10a0a6bfe8376cec30582c5c93fd3a92f/configure.ac#L5340
Support for OSF1 was removed in Python 3.3 (see https://www.python.org/dev/peps/pep-0011/#unsupporting-platforms). I expect that there will be little interest amongst the core developers for reintroducing support because OSF1 is an ancient operating system that is long out of support. |
Yeah, I found that eventually. |
FWIW, because I cannot see it referenced here. This is the commit that removed it: 736e7fc |
This PR is stale because it has been open for 30 days with no activity. |
This enables building with gcc4 (4.7.4) on OSF1/Tru64.
gcc3 (3.4.6) and native cc are a bit different, and might be handled later.
There is no good answer.
The system headers define it by default.
Undefine it to avoid warnings about repeated defines.
Duplicate a few lines of content that are under ifndef _XOPEN_SOURCE_EXTENDED
This is probably the worst part.
configure fails to detect this, because the
prototype is under ifdef _BSD and the program compiles without warning or error;
unprototyped functions are assumed to return int, after all
The fixes are a bit spread out between configure.ac, pyconfig.h.in
and new file pyportosf.h. It may be preferable to consolidate, esp. in configure.ac.
Fwiw I got python2 running also.
https://bugs.python.org/issue44583