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

Fix compiler detection when brew's ccache is installed on Mac OS X #65510

Closed
jszakmeister mannequin opened this issue Apr 19, 2014 · 5 comments
Closed

Fix compiler detection when brew's ccache is installed on Mac OS X #65510

jszakmeister mannequin opened this issue Apr 19, 2014 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@jszakmeister
Copy link
Mannequin

jszakmeister mannequin commented Apr 19, 2014

BPO 21311
Nosy @jszakmeister, @ned-deily, @merwok, @dstufft
Files
  • fix-osx-llvm-detection-with-ccache.patch: First fix: non-empty check before examining output.
  • alt-fix-osx-llvm-detection-with-ccache.patch: Alternate fix: return empty string from _read_output
  • 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 = 'https://github.com/ned-deily'
    closed_at = <Date 2014-04-19.20:35:17.666>
    created_at = <Date 2014-04-19.13:21:02.463>
    labels = ['library']
    title = "Fix compiler detection when brew's ccache is installed on Mac OS X"
    updated_at = <Date 2014-04-19.22:27:12.780>
    user = 'https://github.com/jszakmeister'

    bugs.python.org fields:

    activity = <Date 2014-04-19.22:27:12.780>
    actor = 'jszakmeister'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2014-04-19.20:35:17.666>
    closer = 'ned.deily'
    components = ['Distutils']
    creation = <Date 2014-04-19.13:21:02.463>
    creator = 'jszakmeister'
    dependencies = []
    files = ['34972', '34973']
    hgrepos = []
    issue_num = 21311
    keywords = ['patch']
    message_count = 5.0
    messages = ['216856', '216857', '216877', '216878', '216884']
    nosy_count = 5.0
    nosy_names = ['jszakmeister', 'ned.deily', 'eric.araujo', 'python-dev', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue21311'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @jszakmeister
    Copy link
    Mannequin Author

    jszakmeister mannequin commented Apr 19, 2014

    It's pretty typical for ccache packages to install symlinks for compilers that may not be present on the system, such as Homebrew's ccache package. Unfortunately, the _osx_support.py file is mislead by the presence of the symlink and ends up backtracing.

    This issue is present in 2.7 and onwards. I'm attaching two possible fixes for the problem, both created against 2.7. The issue is that the symlink in detected, but _read_output() returns None, which then fails when the output is examined (if 'str' in None...). The first patch does a simple non-empty check. The alternate version makes _read_output() return an empty string instead of None.

    @jszakmeister jszakmeister mannequin added the stdlib Python modules in the Lib dir label Apr 19, 2014
    @jszakmeister
    Copy link
    Mannequin Author

    jszakmeister mannequin commented Apr 19, 2014

    Here's the alternate fix.

    @ned-deily ned-deily self-assigned this Apr 19, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 19, 2014

    New changeset e3217efa6edd by Ned Deily in branch '2.7':
    Issue bpo-21311: Avoid exception in _osx_support with non-standard compiler
    http://hg.python.org/cpython/rev/e3217efa6edd

    New changeset 3d1578c705c9 by Ned Deily in branch '3.4':
    Issue bpo-21311: Avoid exception in _osx_support with non-standard compiler
    http://hg.python.org/cpython/rev/3d1578c705c9

    New changeset 2a4401109672 by Ned Deily in branch 'default':
    Issue bpo-21311: merge with 3.4
    http://hg.python.org/cpython/rev/2a4401109672

    @ned-deily
    Copy link
    Member

    Thanks for the report and the patches. I am not sure exactly what problem using ccache is causing but it is clear that, if for whatever reason the call to _read_output fails and returns None, the 'llvm-gcc' test will fail so that test should be fixed as suggested in your first patch which I've applied for release in 2.7.7, 3.4.1, and 3.5.0.

    @jszakmeister
    Copy link
    Mannequin Author

    jszakmeister mannequin commented Apr 19, 2014

    Thank you Ned! The issue is that you can create symlinks to ccache to and put them on your path. Distros do this for you now, but most create symlinks for a bunch of compilers... including ones that may not be installed. So the presence of the name ('gcc', for instance) doesn't mean that the compiler is actually installed. It could be a symlink to the ccache binary and running it could fail. I hope that makes a little more sense.

    Thanks again for applying the patch!

    @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
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant