classification
Title: [HPUX] compilation error in pytime.c with cc compiler
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Robert Boehne, haney, michael-o, vstinner
Priority: normal Keywords:

Created on 2017-04-27 04:24 by haney, last changed 2018-07-03 11:18 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
tests.out haney, 2017-07-07 15:24
Pull Requests
URL Status Linked Edit
PR 1351 merged haney, 2017-04-28 23:26
PR 2519 merged Robert Boehne, 2017-07-06 21:52
Messages (15)
msg292397 - (view) Author: David Haney (haney) * Date: 2017-04-27 04:24
When compiling on HP-UX with the native cc compiler, the following compilation error occurs in pytime.c

        cc -Ae -c  -O  -O     -I. -I./Include    -DPy_BUILD_CORE -o Python/pytime.o Python/pytime.c
"Python/pytime.c", line 723: error #2020: identifier "CLOCK_MONOTONIC" is
          undefined
      const clockid_t clk_id = CLOCK_MONOTONIC;
                               ^

1 error detected in the compilation of "Python/pytime.c".
*** Error exit code 2

Stop.


HP-UX does not support the CLOCK_MONOTONIC state.
msg292423 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-27 11:21
> HP-UX does not support the CLOCK_MONOTONIC state.

I'm sorry but CPython requires a monotonic clock since CPython 3.5.

According to https://bugreports.qt.io/browse/QTBUG-22301 HP-UX < 11.3 and Solaris 9 don't support monotonic clock.

It seems like gethrtime() is the right function to be used on HP-UX.
https://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/gethrtime.3C.html

"gethrtime() is measured from an unspecified starting point and is not subject to time server and administrator changes"
src: http://nadeausoftware.com/articles/2012/04/c_c_tip_how_measure_elapsed_real_time_benchmarking#gethrtimenbsp
msg292438 - (view) Author: David Haney (haney) * Date: 2017-04-27 13:10
> It seems like gethrtime() is the right function to be used on HP-UX.
> https://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/gethrtime.3C.html

Thanks, I'll work on getting a patch that leverages gethrtime() tested and submitted for review.
msg292439 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-27 13:22
I'm quite sure that once I wrote a patch using gethrtime() for Solaris, but then I saw that it's the same clock than clock_gettime(CLOCK_MONOTONIC), so I removed gethrtime() to simplify the code.

See also my PEP 418, which mentions gethrtime() by the way:
https://www.python.org/dev/peps/pep-0418/#solaris-gethrtime
msg296553 - (view) Author: David Haney (haney) * Date: 2017-06-21 13:17
I submitted a pull request for a possible fix for this issue but haven't received any feedback yet. Is there any additional information needed from me?
msg296572 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-21 18:18
New changeset c90e96015085784df86632b26059b19c80cbfc97 by Victor Stinner (haney) in branch 'master':
bpo-30183: Fixes HP-UX cc compilation error in pytime.c (#1351)
https://github.com/python/cpython/commit/c90e96015085784df86632b26059b19c80cbfc97
msg297406 - (view) Author: Robert Boehne (Robert Boehne) * Date: 2017-06-30 14:15
I'd love to have this fix backported to 3.5 and 3.6.  It seems trivial to do, and I'd be happy to do it myself.
msg297409 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-30 14:19
> I'd love to have this fix backported to 3.5 and 3.6.  It seems trivial to do, and I'd be happy to do it myself.

Go ahead :-)
msg297410 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-30 14:20
Can someone please give the list of failing tests of the Python master branch on HP-UX?
msg297427 - (view) Author: Robert Boehne (Robert Boehne) * Date: 2017-06-30 16:22
I am having trouble getting things build still.  The problem is that the build is using a naked "ld" to link, and it is picking 32-bit mode by default in my 64-bit acc build. (Itanium)

IMO the problem is configure.ac:2467 which should look more like the gcc section.  I can produce a patch, and perhaps you can walk me though the submission process.
msg297589 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-03 14:06
@David Haney: Can you please give the list of tests which fail on HP-UX? I would like to have an idea of the status of the HP-UX support.
msg297893 - (view) Author: David Haney (haney) * Date: 2017-07-07 15:24
I've attached the test output summary from a recent build.
msg298000 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-09 21:38
Oh ok, a lot of tests fail on HP-UX. We are far from supporting HP-UX.

331 tests OK.
41 tests failed:
    test_asyncio test_asyncore test_c_locale_coercion test_calendar
    test_cmd_line test_cmd_line_script test_datetime test_distutils
    test_email test_faulthandler test_fileio test_httpservers
    test_imaplib test_imp test_import test_io test_logging
    test_macpath test_mailbox test_mmap test_multiprocessing_fork
    test_multiprocessing_forkserver test_multiprocessing_main_handling
    test_multiprocessing_spawn test_ntpath test_openpty test_os
    test_posix test_posixpath test_pty test_re test_signal
    test_strftime test_strptime test_subprocess test_time test_tools
    test_unicode test_unicode_file test_xmlrpc test_zipimport
msg320959 - (view) Author: Michael Osipov (michael-o) * Date: 2018-07-03 11:16
I have applied the patch to 3.6.6 from the source tarball and I was able to proceed with the compilation.

I would take the failed tests as blocker. Try to solve them later.

Can this be closed?
msg320961 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-03 11:18
Yes, I close the issue.
History
Date User Action Args
2018-07-03 11:18:52vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg320961

stage: patch review -> resolved
2018-07-03 11:16:16michael-osetnosy: + michael-o
messages: + msg320959
2017-07-10 16:24:45Mariattasetstage: patch review
2017-07-09 21:38:15vstinnersetmessages: + msg298000
2017-07-07 15:24:19haneysetfiles: + tests.out

messages: + msg297893
2017-07-06 21:52:37Robert Boehnesetpull_requests: + pull_request2674
2017-07-03 14:06:41vstinnersetmessages: + msg297589
2017-06-30 16:22:02Robert Boehnesetmessages: + msg297427
2017-06-30 14:20:09vstinnersetmessages: + msg297410
2017-06-30 14:19:37vstinnersetmessages: + msg297409
2017-06-30 14:15:28Robert Boehnesetnosy: + Robert Boehne
messages: + msg297406
2017-06-21 18:18:25vstinnersetmessages: + msg296572
2017-06-21 13:17:49haneysetpull_requests: - pull_request2361
2017-06-21 13:17:25haneysetmessages: + msg296553
pull_requests: + pull_request2361
2017-04-28 23:26:47haneysetpull_requests: + pull_request1463
2017-04-27 13:22:20vstinnersetmessages: + msg292439
2017-04-27 13:10:00haneysetmessages: + msg292438
2017-04-27 11:21:50vstinnersetnosy: + vstinner
messages: + msg292423
2017-04-27 04:24:50haneycreate