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

qscintilla2, octave: bottle for ARM #69653

Closed
wants to merge 2 commits into from
Closed

Conversation

carlocab
Copy link
Member

  • 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>)?

@carlocab carlocab added the CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. label Jan 24, 2021
@BrewTestBot BrewTestBot added no ARM bottle Formula has no ARM bottle python Python use is a significant feature of the PR or issue labels Jan 24, 2021
@carlocab carlocab added the help wanted Task(s) needing PRs from the community or maintainers label Jan 24, 2021
@carlocab
Copy link
Member Author

@lteneyck what change did you make to the formula exactly, to get it to work? The change I have here allows qscintilla2 to compile, but it fails the test:

==> /opt/homebrew/opt/python@3.9/bin/python3 test.py
Traceback (most recent call last):
  File "/private/tmp/qscintilla2-test-20210123-5191-lvsige/test.py", line 1, in <module>
    import PyQt5.Qsci
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/PyQt5/Qsci.so, 2): Library not loaded: @rpath/libqscintilla2_qt5.15.dylib
  Referenced from: /opt/homebrew/lib/python3.9/site-packages/PyQt5/Qsci.so
  Reason: image not found

@carlocab
Copy link
Member Author

carlocab commented Jan 24, 2021

From the existing bottle, the default rpath of Qsci.so is

Load command 23
          cmd LC_RPATH
      cmdsize 48
         path @executable_path/../Frameworks (offset 12)

Not sure there's a way of specifying this using install options.

@carlocab
Copy link
Member Author

carlocab commented Jan 24, 2021

Related issue at MacPorts: macports/macports-ports#7790, https://trac.macports.org/ticket/60796

@carlocab carlocab force-pushed the qs-arm branch 2 times, most recently from 86bc00a to a003c6c Compare January 24, 2021 06:54
@carlocab carlocab removed the help wanted Task(s) needing PRs from the community or maintainers label Jan 24, 2021
@lteneyck
Copy link

For a quick test I simply forced spec=macx-clang-arm64 and it compiled and passed test. I am a bare beginner in ruby so I did not try to sort out the conditionals for linux and macOS. Something like this:
onlinux do
spec="linux-g++"
end
onmacos do
spec=archx86? "macx-clang-x64" : "macs-clang-arm64"
end

but I this is just the outline, I am undoubtedly missing on syntax and how to find out if it is arm64 or x86_64.

@carlocab
Copy link
Member Author

What happens when you do brew test qscintilla2?

@carlocab carlocab changed the title qscintilla2: bottle for ARM qscintilla2, octave: bottle for ARM Jan 24, 2021
@carlocab
Copy link
Member Author

On Big Sur:

Error: 1 failed step!
brew test --retry --verbose dynare

Looks like the test just timed out, which probably shouldn't be blocking.

@carlocab carlocab changed the title qscintilla2, octave: bottle for ARM qscintilla2, octave, dynare: bottle for ARM Jan 24, 2021
@carlocab
Copy link
Member Author

Dynare didn't build on ARM:

ld: library not found for -lquadmath

@carlocab carlocab changed the title qscintilla2, octave, dynare: bottle for ARM qscintilla2, octave: bottle for ARM Jan 24, 2021
@lteneyck
Copy link

Oops. I have both x86_64 and arm64 homebrew installed. I have "abrew" aliased to /opt/homebrew/bin/brew, which means that abrew operates in arm64 mode and installs in the /opt/homebrew directory tree, but my default path has /usr/local, so "brew" installs and operates in /usr/local/homebrew. Unfortunately after I did "abrew install -s qscintilla2" I inadvertently did "brew test qscintilla2" so I tested the wrong one. Not surprisingly, it passed.

"abrew test qscintilla2" fails as follows:
`Lynns-Mac-M1Mini:mkspecs lynn$ abrew install -s qscintilla2
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 2 casks.

==> Downloading https://www.riverbankcomputing.com/static/Downloads/QScintilla/2
Already downloaded: /Users/lynn/Library/Caches/Homebrew/downloads/7f261304df66c3e1d261d8dec69a6d012708cd509ad2a3dcc9fb02975051e58f--QScintilla-2.11.6.tar.gz
==> qmake qscintilla.pro -config release -spec macx-clang-arm64
==> make
==> make install
==> /opt/homebrew/opt/python@3.9/bin/python3 configure.py -o /opt/homebrew/Cella
==> make
==> make install
==> make clean
🍺 /opt/homebrew/Cellar/qscintilla2/2.11.6: 139 files, 8.0MB, built in 31 seconds
Lynns-Mac-M1Mini:mkspecs lynn$ abrew test qscintilla2
==> Testing qscintilla2
==> /opt/homebrew/opt/python@3.9/bin/python3 test.py
Last 15 lines from /Users/lynn/Library/Logs/Homebrew/qscintilla2/test.01.python3:
2021-01-24 10:26:39 -0800

/opt/homebrew/opt/python@3.9/bin/python3
test.py

Traceback (most recent call last):
File "/private/tmp/qscintilla2-test-20210124-90008-vd0snz/test.py", line 1, in
import PyQt5.Qsci
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/PyQt5/Qsci.so, 2): Library not loaded: @rpath/libqscintilla2_qt5.15.dylib
Referenced from: /opt/homebrew/lib/python3.9/site-packages/PyQt5/Qsci.so
Reason: no suitable image found. Did find:
/usr/local/lib/libqscintilla2_qt5.15.dylib: mach-o, but wrong architecture
/usr/local/Cellar/qscintilla2/2.11.6/lib/libqscintilla2_qt5.15.0.0.dylib: mach-o, but wrong architecture
Error: qscintilla2: failed
An exception occurred within a child process:
BuildError: Failed executing: /opt/homebrew/opt/python@3.9/bin/python3 test.py
/opt/homebrew/Library/Homebrew/formula.rb:2107:in block in system' /opt/homebrew/Library/Homebrew/formula.rb:2043:in open'
/opt/homebrew/Library/Homebrew/formula.rb:2043:in system' /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/qscintilla2.rb:79:in block in class:Qscintilla2'
/opt/homebrew/Library/Homebrew/formula.rb:1910:in block (3 levels) in run_test' /opt/homebrew/Library/Homebrew/utils.rb:531:in with_env'
/opt/homebrew/Library/Homebrew/formula.rb:1909:in block (2 levels) in run_test' /opt/homebrew/Library/Homebrew/formula.rb:899:in with_logging'
/opt/homebrew/Library/Homebrew/formula.rb:1908: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:2156:in mktemp' /opt/homebrew/Library/Homebrew/formula.rb:1902: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>' Lynns-Mac-M1Mini:mkspecs lynn

It appears that there is a problem with the test code finding the right module -- and I have no idea why it would even look in /usr/local/lib.

I apologize for the false claim of passing brew test for arm64.

I have checked /opt/homebrew/lib/python3.9/site-packages/PyQt5/Qsci.so and it is present, and furthermore is an arm64 library.
However, it appears that ..../Qsci.so attempts to reference @rpath/libqscintilla2_qt5.15.dylib
libqscintilla2_qt5.15.dylib exists in /opt/homebrew/Cellar/qscintilla2/2.11.6/lib and is an arm64 library.

It looks as though somewhere in the setup rpath is not being set correctly.

@BrewTestBot
Copy link
Member

:shipit: @carlocab has triggered a merge.

@carlocab carlocab deleted the qs-arm branch January 25, 2021 05:25
@carlocab
Copy link
Member Author

Thanks, @lteneyck. You should be able to do abrew [re]install qscintilla2 now.

@carlocab
Copy link
Member Author

@lteneyck
Copy link

lteneyck commented Jan 25, 2021

### There may be a problem.

I ran brew update / brew upgrade on my x86 repository on my M1 mini, and it failed in qscintilla2. The formula install method has
`def install
"<<<<<<< Updated upstream"

spec = (ENV.compiler == :clang) ? "macx-clang" : "macx-g++"
spec << "-arm64" if Hardware::CPU.arm?

"======="
#spec = (ENV.compiler == :clang) ? "macx-clang" : "macx-g++"
spec = "macx-g++"
on_linux do
spec.replace "linux-g++"
end

">>>>>>> Stashed changes"
`
which triggered a ruby syntax error.

On further examination I found that there may be some more issues. I am not sure where "qmake" is running, but I found that the qt/5.15.2/mkspecs directories in the arm64 bottle are NOT the same as the ones in the x86_64 bottle. The arm64 version contains the macx-clang-arm64 spec, and also a macx-clang-x64 spec, which should presumably be used the x86_64 build. However, THESE SPECS ARE NOT PRESENT in the qt/5.15.2 bottle for x86_64. I also noticed that the macx-clang-x64 spec is different from the macx-g++ spec, and contains some things that are specific to the Apple Silicon platform. I do not know if these things are benign on a real x86_64 mac running Big Sur.

It now appears we have four cases to support. Do we want to do this with one formula and once source code base?

  1. arm64 native mode: macx-clang-arm64
  2. arm64 Rosetta2 mode: macx-clang-x86
  3. x86_64 macOS, not clang: macx-g++
  4. Linux x86_64, GCC: linux-g++

Note that 1 and 2 both have the same compiler (clang) and the same cpu (arm). If the formula can determine which system it is running on I assume it can tell the formula -- it obviously knows which repository to talk to.

I am assuming that on linux we only support GCC, even though clang is available -- there is a spec for linux-clang.

@lteneyck
Copy link

lteneyck commented Jan 25, 2021

I recall seeing a discussion that deprecated cross-compiling. If the bottles for x86 Big Sur are built on x86 systems the problem distinguishing between (1) and (2) above go away. we can then do

def install on_macos do spec = ((ENV.compiler == :clang) ? "macx-clang-arm64" : "macx-g++") if Hardware::CPU.arm? spec.replace "macx-g++" if (!Hardware::CPU.arm || ENV.compiler != :clang)? end on_linux do spec.replace "linux-g++" end

which means that we won't cross-compile on arm64. One question of ruby syntax -- if the first setting of spec does not happen because the Hardware::CPU.arm is false, should the next one be spec = or spec.replace?

This requires the same version of the qmake mkspecs directory we presently have on qt/5.15.2 for arm.

@carlocab carlocab mentioned this pull request Jan 25, 2021
5 tasks
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Jan 26, 2021
The dynare test keeps timing out, causing CI failures. See, for
example, Homebrew#69747 and Homebrew#69653.
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 25, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI-force-arm [DEPRECATED] Don't pass --skip-unbottled-arm to brew test-bot. no ARM bottle Formula has no ARM bottle outdated PR was locked due to age python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants