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

Compiling timemodule.c can fail on macOS due to availability warnings #79206

Closed
MaximeBelanger mannequin opened this issue Oct 19, 2018 · 4 comments
Closed

Compiling timemodule.c can fail on macOS due to availability warnings #79206

MaximeBelanger mannequin opened this issue Oct 19, 2018 · 4 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life build The build process and cross-build extension-modules C modules in the Modules dir OS-mac

Comments

@MaximeBelanger
Copy link
Mannequin

MaximeBelanger mannequin commented Oct 19, 2018

BPO 35025
Nosy @ronaldoussoren, @vstinner, @benjaminp, @ned-deily, @miss-islington
PRs
  • bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c #9961
  • [3.7] closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961) #10019
  • [3.6] closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961) #10020
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-10-21.00:08:00.648>
    created_at = <Date 2018-10-19.06:24:57.716>
    labels = ['extension-modules', 'OS-mac', '3.8', 'build', '3.7']
    title = 'Compiling `timemodule.c` can fail on macOS due to availability warnings'
    updated_at = <Date 2018-10-21.00:41:45.409>
    user = 'https://bugs.python.org/MaximeBelanger'

    bugs.python.org fields:

    activity = <Date 2018-10-21.00:41:45.409>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-21.00:08:00.648>
    closer = 'benjamin.peterson'
    components = ['Extension Modules', 'macOS']
    creation = <Date 2018-10-19.06:24:57.716>
    creator = 'Maxime Belanger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35025
    keywords = ['patch']
    message_count = 4.0
    messages = ['328030', '328183', '328184', '328185']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'vstinner', 'benjamin.peterson', 'ned.deily', 'Maxime Belanger', 'miss-islington']
    pr_nums = ['9961', '10019', '10020']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue35025'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @MaximeBelanger
    Copy link
    Mannequin Author

    MaximeBelanger mannequin commented Oct 19, 2018

    We build Python on macOS with -Werror=unguarded-availability and -mmacosx-version-min=<xx> to ensure libpython is binary-compatible with earlier versions of macOS.

    This can create problems when building some modules, including timemodule.c, which was recently altered to fix bpo-28081. The initial fix is inappropriate, because attempting to reference CLOCK_REALTIME et al when HAVE_CLOCK_GETTIME is unset (in our case, due to being too "new"), results in a compiler error:

    ./Modules/timemodule.c:1368:29: error: '_CLOCK_REALTIME' is only available on macOS 10.12 or newer
          [-Werror,-Wunguarded-availability]
        PyModule_AddIntMacro(m, CLOCK_REALTIME);
                                ^~~~~~~~~~~~~~
    /usr/include/time.h:154:24: note: expanded from macro 'CLOCK_REALTIME'
    #define CLOCK_REALTIME _CLOCK_REALTIME
                           ^~~~~~~~~~~~~~~
    ./Include/modsupport.h:78:67: note: expanded from macro 'PyModule_AddIntMacro'
    #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
    

    A more correct patch (I'm attaching ours) is to only add the macros to the module if at least one of the three functions is defined. This should continue to work for the author of the original issue as well as fix our problem.

    @MaximeBelanger MaximeBelanger mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life extension-modules C modules in the Modules dir OS-mac build The build process and cross-build labels Oct 19, 2018
    @benjaminp
    Copy link
    Contributor

    New changeset 9445118 by Benjamin Peterson (Max Bélanger) in branch 'master':
    closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961)
    9445118

    @miss-islington
    Copy link
    Contributor

    New changeset beb83d0 by Miss Islington (bot) in branch '3.6':
    closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961)
    beb83d0

    @miss-islington
    Copy link
    Contributor

    New changeset 002aef3 by Miss Islington (bot) in branch '3.7':
    closes bpo-35025: Properly guard the CLOCK_GETTIME et al macros in timemodule.c. (GH-9961)
    002aef3

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life build The build process and cross-build extension-modules C modules in the Modules dir OS-mac
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants