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

build fails on OSX 10.10 #32452

Closed
gabrielschulhof opened this issue Mar 24, 2020 · 9 comments
Closed

build fails on OSX 10.10 #32452

gabrielschulhof opened this issue Mar 24, 2020 · 9 comments
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX.

Comments

@gabrielschulhof
Copy link
Contributor

gabrielschulhof commented Mar 24, 2020

Steps to reproduce:

  1. Log into test-macstadium-macos10.10-x64-1
  2. git clone https://github.com/nodejs/node
  3. cd node
  4. ./configure

The result:

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
WARNING: C++ compiler (CXX=c++, 7.0.2) too old, need g++ 6.3.0 or clang++ 8.0.0
WARNING: warnings were emitted in the configure phase
Traceback (most recent call last):
  File "./configure", line 27, in <module>
    import configure
  File "/Users/administrator/gabrielschulhof/node/configure.py", line 1811, in <module>
    run_gyp(gyp_args)
  File "tools/gyp_node.py", line 54, in run_gyp
    rc = gyp.main(args)
  File "tools/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "tools/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "tools/gyp/pylib/gyp/generator/make.py", line 2213, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "tools/gyp/pylib/gyp/generator/make.py", line 794, in Write
    extra_mac_bundle_resources, part_of_all)
  File "tools/gyp/pylib/gyp/generator/make.py", line 978, in WriteActions
    part_of_all=part_of_all, command=name)
  File "tools/gyp/pylib/gyp/generator/make.py", line 1724, in WriteDoCmd
    force = True)
  File "tools/gyp/pylib/gyp/generator/make.py", line 1779, in WriteMakeRule
    cmddigest = hashlib.sha1((command or self.target).encode('utf-8')).hexdigest()
AttributeError: 'module' object has no attribute 'sha1'
@gabrielschulhof gabrielschulhof added build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. labels Mar 24, 2020
@gabrielschulhof
Copy link
Contributor Author

master is at 96f06e6.

From stackoverflow it looks like python may be messed up. I tried to brew reinstall python and brew reinstall python@2 but the former had some kind of link failure and the latter failed entirely.

@gabrielschulhof
Copy link
Contributor Author

test-macstadium-macos10:node administrator$ brew reinstall python@2
Warning: You are using macOS 10.10.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.

==> Reinstalling python@2 
Error: An exception occurred within a child process:
  FormulaUnavailableError: No available formula with the name "/usr/local/opt/python@2/.brew/python@2.rb" 

@gabrielschulhof
Copy link
Contributor Author

Looking at the python code it may also be the case that it is not finding the openssl implementation.

@gabrielschulhof
Copy link
Contributor Author

test-macstadium-macos10:node administrator$ brew reinstall python
Warning: You are using macOS 10.10.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.

==> Reinstalling python 
==> Downloading https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tar.xz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/downloads/44c7cdeb71f219f19f54e427000915c3e979312d73f8aabc41093d53a991c801--Python-3.7.7.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python/3.7.7 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/3.7.7/share --datadir=/usr/local/Cellar/python/3.7.7/share --enable-framework=/us
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/3.7.7
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/3.7.7/share/python
==> Downloading https://files.pythonhosted.org/packages/df/ed/bea598a87a8f7e21ac5bbf464102077c7102557c07db9ff4e207bd9f7806/setuptools-46.0.0.zip
Already downloaded: /Users/administrator/Library/Caches/Homebrew/downloads/e5199bbf2a8e2450a866445f256b9ca0f890309f843300835d2c4d3ebf9769d3--setuptools-46.0.0.zip
==> Downloading https://files.pythonhosted.org/packages/8e/76/66066b7bc71817238924c7e4b448abdb17eb0c92d645769c223f9ace478f/pip-20.0.2.tar.gz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/downloads/81c6f6c92bea8093b41c52486c1d47040fdaa166eba7820a14b14fc6fe4e1fd8--pip-20.0.2.tar.gz
==> Downloading https://files.pythonhosted.org/packages/75/28/521c6dc7fef23a68368efefdcd682f5b3d1d58c2b90b06dc1d0b805b51ae/wheel-0.34.2.tar.gz
Already downloaded: /Users/administrator/Library/Caches/Homebrew/downloads/553d732b4cf117039b60aab1f75ac3e6f6869a9fa3127b4107984fa5b084a00b--wheel-0.34.2.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink Frameworks/Python.framework/Headers
Target /usr/local/Frameworks/Python.framework/Headers
is a symlink belonging to python@2. You can unlink it:
  brew unlink python@2

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/Frameworks/Python.framework/Headers -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Headers
/usr/local/Frameworks/Python.framework/Python -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Python
/usr/local/Frameworks/Python.framework/Resources -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Resources
/usr/local/Frameworks/Python.framework/Versions/Current -> /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/Current
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7
==> /usr/local/Cellar/python/3.7.7/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.7/bin --install-lib=/usr/local/lib/python3.7
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python/3.7.7: 8,615 files, 120.8MB, built in 3 minutes 11 seconds

@gabrielschulhof
Copy link
Contributor Author

brew link --overwrite python worked as suggested by the error message.

@richardlau
Copy link
Member

This is most likely the same as nodejs/build#2238 (which I think only fixed the 10.11 macs).

fyi @AshCripps

@srl295
Copy link
Member

srl295 commented May 11, 2020

seeing the same on 12.x on 10.15.4. Trying an xcode upgrade (11.4 to 11.4.1)

update brew uninstall of all pythons python@2 and python@3.8 etc (yes, breaking all the things) and going back to /usr/bin/python worked.

another update
On a lark, I read the manual 🤣 https://docs.brew.sh/Homebrew-and-Python

Homebrew provides formulae to brew Python 3.x.

Homebrew provided a python@2 formula until the end of 2019, at which point it was removed due to the Python 2 deprecation.

So, I did still have python@2. I'm wondering if an 'orphaned' python@2 may be the culprit here as @gabrielschulhof hit. If the formula is gone, then python@2 won't have its deps updated anymore

FormulaUnavailableError: No available formula with the name "/usr/local/opt/python@2/.brew/python@2.rb"

see discussions in nodejs/node-gyp#1337 (comment)

Is there a way Node could detect this situation and suggest something? I'm not sure what the right fix is exactly. Perhaps brew uninstall python@2 --ignore-dependencies and just be aware that any remaining dependencies are probably already broken?

Update I forgot that I was on a 12.x branch, should mention that!

@cclauss
Copy link
Contributor

cclauss commented Jul 1, 2020

Is this issue still open?

Python 2 died on 1/1/2020 so brew uninstall python@2 is recommended.

If you have done brew install python and/or brew install python@3.8 then a current version of node-gyp should be working properly. If it is not, then please provide the command that was typed and the complete error log.

@richardlau
Copy link
Member

I've been starting several Node.js 10 builds today (I believe we only build Node.js 10 on macOS 10.10 now) and haven't seen the issue reported here.

@targos targos closed this as completed Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX.
Projects
None yet
Development

No branches or pull requests

5 participants