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

python@3.9: make test run on ARM #64869

Closed
wants to merge 1 commit into from
Closed

python@3.9: make test run on ARM #64869

wants to merge 1 commit into from

Conversation

claui
Copy link
Contributor

@claui claui commented Nov 15, 2020

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

The test block uses the _gdbm module as an example for an external loadable module. That module is not part of the natively built ARM Python though.

Replace _gdbm with _dbm, which is present in either architecture and should serve just the same purpose.

(For the record, _gdbm and _decimal are the only modules that are affected.)

The test block uses the _gdbm module as an example for an external
loadable module. That module is not part of the natively built ARM
Python though.

Replace _gdbm with _dbm, which is present in either architecture and
should serve just the same purpose.
@claui claui added 11 Big Sur is specifically affected CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. labels Nov 15, 2020
@fxcoudert
Copy link
Member

@claui but is it expected that the gdbm and decimal modules are not present? Or is it a build problem? Our formula depends on gdbm so it maybe a configuration issue.

@fxcoudert
Copy link
Member

I think we have had trouble with gdbm before, and this is exactly the reason why we put it in the test: to check it is correctly built.

@claui
Copy link
Contributor Author

claui commented Nov 15, 2020

@fxcoudert Good points. Need to investigate that.

@digitalresistor
Copy link
Contributor

I know that installing Python from the 3.9 branch (thus 3.9.0 + extra bits) does make gdbm work correctly on arm64.

@TonyWu20

This comment has been minimized.

@fxcoudert
Copy link
Member

@TonyWu20 if this is on a supported platform, please file an issue and report all the necessary information

@claui
Copy link
Contributor Author

claui commented Dec 6, 2020

Tried to add the gdbm formula’s opt_include but that did not help:

--- a/Formula/python@3.9.rb
+++ b/Formula/python@3.9.rb
@@ -114,7 +114,7 @@ class PythonAT39 < Formula
       --with-openssl=#{Formula["openssl@1.1"].opt_prefix}
     ]
 
-    cflags   = []
+    cflags   = ["-I#{Formula["gdbm"].opt_include}"]
     ldflags  = []
     cppflags = []
 
@@ -151,7 +151,7 @@ class PythonAT39 < Formula
       f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
     end
 
-    args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
+    args << "CFLAGS=#{cflags.join(" ")}"
     args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
     args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
 
@@ -349,7 +349,6 @@ class PythonAT39 < Formula
     # and it can occur that building sqlite silently fails if OSX's sqlite is used.
     system "#{bin}/python#{xy}", "-c", "import sqlite3"
     # Check if some other modules import. Then the linked libs are working.
-    system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()"
     system "#{bin}/python#{xy}", "-c", "import _gdbm"
     system "#{bin}/python#{xy}", "-c", "import zlib"
     system bin/"pip3", "list", "--format=columns"

The test still fails:

$ brew test python@3.9
==> Testing python@3.9
==> /opt/homebrew/Cellar/python@3.9/3.9.0_4/bin/python3.9 -c import sqlite3
==> /opt/homebrew/Cellar/python@3.9/3.9.0_4/bin/python3.9 -c import _gdbm
Last 15 lines from /var/brew/Library/Logs/Homebrew/python@3.9/test.02.python3.9:
2020-12-06 16:22:26 +0100

/opt/homebrew/Cellar/python@3.9/3.9.0_4/bin/python3.9
-c
import _gdbm

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_gdbm'
Error: python@3.9: failed
An exception occurred within a child process:
  BuildError: Failed executing: /opt/homebrew/Cellar/python@3.9/3.9.0_4/bin/python3.9 -c import\ _gdbm
/opt/homebrew/Library/Homebrew/formula.rb:2080:in `block in system'
/opt/homebrew/Library/Homebrew/formula.rb:2016:in `open'
/opt/homebrew/Library/Homebrew/formula.rb:2016:in `system'
/opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/python@3.9.rb:352:in `block in <class:PythonAT39>'
/opt/homebrew/Library/Homebrew/formula.rb:1884:in `block (3 levels) in run_test'
/opt/homebrew/Library/Homebrew/utils.rb:504:in `with_env'
/opt/homebrew/Library/Homebrew/formula.rb:1883:in `block (2 levels) in run_test'
/opt/homebrew/Library/Homebrew/formula.rb:901:in `with_logging'
/opt/homebrew/Library/Homebrew/formula.rb:1882:in `block in run_test'
/opt/homebrew/Library/Homebrew/mktemp.rb:63:in `block in run'
/opt/homebrew/Library/Homebrew/mktemp.rb:63:in `chdir'
/opt/homebrew/Library/Homebrew/mktemp.rb:63:in `run'
/opt/homebrew/Library/Homebrew/formula.rb:2129:in `mktemp'
/opt/homebrew/Library/Homebrew/formula.rb:1876:in `run_test'
/opt/homebrew/Library/Homebrew/test.rb:43:in `block in <main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/opt/homebrew/Library/Homebrew/test.rb:42:in `<main>'

@YilinGUO
Copy link

YilinGUO commented Dec 8, 2020

I created this PR to fix the issue #66458. Let me know if that helps. Thanks!

@fxcoudert
Copy link
Member

Fixed on #66438

@fxcoudert fxcoudert closed this Dec 8, 2020
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Jan 7, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
11 Big Sur is specifically affected CI-syntax-only Change only affects brew syntax, not the install. Only run syntax CI. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants