GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cxx pthread check is not overrideable · Issue #86082 · python/cpython

cxx pthread check is not overrideable #86082

New issue
Copy link
New issue
Copy link
Closed
Closed
cxx pthread check is not overrideable#86082
Copy link
Labels
3.8 (EOL)end of lifeend of lifebuildThe build process and cross-buildThe build process and cross-build

Description

virtuald
mannequin
opened on Oct 3, 2020
Issue body actions
BPO 41916
Nosy @moreati, @virtuald
PRs
  • bpo-41916: allow cross-compiled python to have -pthread set for CXX #22525
  • 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 = None
    created_at = <Date 2020-10-03.07:20:28.934>
    labels = ['build', '3.8']
    title = 'cxx pthread check is not overrideable'
    updated_at = <Date 2020-10-25.19:38:59.827>
    user = 'https://github.com/virtuald'

    bugs.python.org fields:

    activity = <Date 2020-10-25.19:38:59.827>
    actor = 'virtuald'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Cross-Build']
    creation = <Date 2020-10-03.07:20:28.934>
    creator = 'virtuald'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41916
    keywords = ['patch']
    message_count = 2.0
    messages = ['377858', '379602']
    nosy_count = 2.0
    nosy_names = ['Alex.Willmer', 'virtuald']
    pr_nums = ['22525']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue41916'
    versions = ['Python 3.8']

    Activity

    1. virtuald commented on Oct 3, 2020

      @virtuald
      virtualdmannequin
      on Oct 3, 2020
      MannequinAuthor
      More actions

      I'm cross-compiling python to ARM, following instructions from the crossenv project @ https://crossenv.readthedocs.io/en/latest/quickstart.html#build-or-obtain-host-python

      I was getting pthread related errors when using cross-built extension modules. I realized the issue was that distutils wasn't passing -pthread to gcc.

      On my native python (Fedora 32 Python 3.8):

      >>> import pprint, distutils.sysconfig
      >>> pprint.pprint({i: distutils.sysconfig.get_config_vars(i)[0] for i in ('CC', 'CXX', 'LDSHARED')})
      {'CC': 'gcc -pthread',
       'CXX': 'g++ -pthread',
       'LDSHARED': 'gcc -pthread -shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now  '
                   '-g  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now  -g'}

      In my cross-compiled python environment:

      >>> import pprint, distutils.sysconfig
      >>> pprint.pprint({i: distutils.sysconfig.get_config_vars(i)[0] for i in ('CC', 'CXX', 'LDSHARED')})
      {'CC': 'arm-frc2020-linux-gnueabi-gcc',
       'CXX': 'arm-frc2020-linux-gnueabi-c++',
       'LDSHARED': 'arm-frc2020-linux-gnueabi-gcc -shared'}

      As you can see, no -pthread flag. I went digging in the configure script and found this comment in configure.ac:2110:

      # Some compilers won't report that they do not support -pthread,
      # so we need to run a program to see whether it really made the
      # function available.

      ... well, that doesn't work when cross-compiling. I looked at some other variables set to override things for cross compiling, and tried adding "ac_cv_pthread_is_default=no ac_cv_pthread=yes ac_cv_cxx_thread=yes" to my cross-compile ./configure, and it's closer:

      >>> import pprint, distutils.sysconfig
      >>> pprint.pprint({i: distutils.sysconfig.get_config_vars(i)[0] for i in ('CC', 'CXX', 'LDSHARED')})
      {'CC': 'arm-frc2020-linux-gnueabi-gcc -pthread',
       'CXX': 'arm-frc2020-linux-gnueabi-c++',
       'LDSHARED': 'arm-frc2020-linux-gnueabi-gcc -pthread -shared'}

      Closer, but not there yet! It appears that the $ac_cv_cxx_thread is not externally settable (unlike ac_cv_pthread), which I guess is because it's not wrapped in a AC_CACHE_VAL macro?

      It seems that the right fix would be for someone to use AC_CACHE_VAL to allow $ac_cv_cxx_thread to be set externally? I'm happy to cargo cult some code from other parts of configure.ac and make a PR for it, but it's not immediately clear (a) what bad side effects this could cause and (b) what the best mechanism to use to regenerate configure et al is?

    2. virtuald
      added
      3.8 (EOL)end of lifeend of life
      buildThe build process and cross-buildThe build process and cross-build
      on Oct 3, 2020
    3. virtuald commented on Oct 25, 2020

      @virtuald
      virtualdmannequin
      on Oct 25, 2020
      MannequinAuthor
      More actions

      FWIW, I've been using the patch in my PR and it seems to work.

    4. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    5. gpshead
      added a commit that references this issue on Jan 5, 2023

      gh-86082: bpo-41916: allow cross-compiled python to have -pthread set…

      cc87487
    6. gpshead commented on Jan 5, 2023

      @gpshead
      gpshead
      on Jan 5, 2023
      Member
      More actions

      thanks!

    7. gpshead
      closed this as completedon Jan 5, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifeend of lifebuildThe build process and cross-buildThe build process and cross-build

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.