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

Cannot install/build any Python version on macOS High Sierra #1245

Closed
6 tasks done
cjbischoff opened this issue Nov 20, 2018 · 15 comments
Closed
6 tasks done

Cannot install/build any Python version on macOS High Sierra #1245

cjbischoff opened this issue Nov 20, 2018 · 15 comments
Labels
area: build bugs or improvements with `pyenv install` impl: cpython os: macOS

Comments

@cjbischoff
Copy link

cjbischoff commented Nov 20, 2018

Description

  • Platform information: OS X 10.13.6 using python-build 20180424

  • OS architecture: Darwin platform.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64 & i386

  • pyenv version: pyenv 1.2.8

  • Python version: 3.6.7

  • C Compiler information:

    Apple LLVM version 10.0.0 (clang-1000.11.45.5)
    Target: x86_64-apple-darwin17.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
  • Please attach verbose build log as gist :https://gist.github.com/cjbischoff/7a6e742f489e671f670f88528e8c1855

@adonig
Copy link

adonig commented Nov 27, 2018

Same problem here on OS X 10.14.1 Mojave. Cannot build any Python version. Build process fails with missing symbols even after installing the additional SDK headers and reinstalling binutils :-(

EDIT: Removing binutils solved the problem for me: brew remove binutils

@mmerickel
Copy link

EDIT: Removing binutils solved the problem for me: brew remove binutils

This also worked for me.

@ryan-gi
Copy link

ryan-gi commented Dec 9, 2018

EDIT: Removing binutils solved the problem for me: brew remove binutils

Fantastic. This also worked for me.

@socketbox
Copy link

Same problem here on OS X 10.14.1 Mojave. Cannot build any Python version. Build process fails with missing symbols even after installing the additional SDK headers and reinstalling binutils :-(

EDIT: Removing binutils solved the problem for me: brew remove binutils

Very interested in how @adonig came to discover that this was the problem. Could you give some insight as to how you tracked the issue back to binutils? I had thought it was an issue with flags being passed to the "native" ld (ie. the one at /usr/bin/ld).

@fpatz
Copy link

fpatz commented Jan 23, 2019

Root cause for this is that the system ar is shadowed by binutils. The libpythonX.Ym.a produced by binutils' ar cannot be used for linking. Verified by building with AR=/usr/bin/ar. I'd suggest explicitly setting AR for macOS builds or at least placing a hint in the installation instructions (... or marking binutils incompatible with pyenv, if that can be done with Homebrew?).

@chrahunt chrahunt added os: macOS area: build bugs or improvements with `pyenv install` impl: cpython labels Feb 16, 2019
@dmhenry
Copy link

dmhenry commented Mar 13, 2019

@fpatz, I've seen references to building with AR=/usr/bin/ar in other places as well, but I'm not clear on how to do that. Can you tell me? I'm new to Python and trying to figure out the tooling. I'm trying to pyenv install 3.6.8. Can I pass this here somehow? Thanks in advance!

@fpatz
Copy link

fpatz commented Mar 13, 2019

Simply prefix the command: AR=/usr/bin/env pyenv install .... This sets AR for that invocation of pyenv. Or (temporarily) brew uninstall binutils, if that is where ar is coming from (you can check with which ar -- if it says /usr/local/bin/ar you probably have binutils installed).

@cjbischoff
Copy link
Author

brew remove binutils that worked also

@DavidAntliff
Copy link

FWIW, AR=/usr/bin/ar pyenv install 3.7.2 worked for me (avoided having to uninstall binutils).

@purp
Copy link

purp commented Mar 29, 2019

AR=... was not successful for me.

My steps:

  • brew uninstall binutils
  • download and install Mac OS 10.14 command line tools for Xcode 10.2 manually (for some reason xcode-select --install didn't do the magic for me)
  • sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / after installing command line tools, per Common Build Problems

All better now.

@wulameng
Copy link

Same problem here on OS X 10.14.1 Mojave. Cannot build any Python version. Build process fails with missing symbols even after installing the additional SDK headers and reinstalling binutils :-(

EDIT: Removing binutils solved the problem for me: brew remove binutils

THANKS BRO,This also worked for me. :)👍👍👍👍👍

@haydenk
Copy link

haydenk commented Dec 20, 2019

Uninstalling binutils works on macOS 10.15 (Catalina) as well, were we do not have the macOS_SDK_headers_for_macOS_10.14.pkg available.

EDIT Also what @DavidAntliff mentioned also worked.

@XxUnkn0wnxX
Copy link

XxUnkn0wnxX commented Jan 2, 2020

for Catalina the headers are located somewhere else noted here: https://bbqsoftwares.com/blog/xdebug-catalina-issue

since the "macOS_SDK_headers_for_macOS_10.15" doesnt exsist & /usr/include has been removed
the new location is /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include as of xcode 11.

i'm also getting the issue ModuleNotFoundError: No module named 'pyexpat'
Log: python-build.20200103024154.82234.log.zip

@matzeschmo
Copy link

Thanks a lot @fpatz. Had the same problem today with MacOS Mojave (10.14.4).
export AR=/usr/bin/ar solved the problem and installing with pyenv install 3.8.2 finally worked! 👍

@weaming
Copy link

weaming commented Sep 16, 2022

Same for #2441 , incorrect ar, aha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build bugs or improvements with `pyenv install` impl: cpython os: macOS
Projects
None yet
Development

No branches or pull requests