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

Update macOS installation and GUI compilation instructions for Apple Silicon #1074

Open
mchamberland opened this issue Nov 7, 2023 · 3 comments

Comments

@mchamberland
Copy link
Contributor

mchamberland commented Nov 7, 2023

The macOS installation instructions, including the instructions to compile the Qt-based applications, should be updated for Apple Silicon.

Here are my suggestions:

  1. When installing gcc with brew, the brew gcc is named 'gcc-[version number]'. For example, installing gcc13 with brew yields gcc-13, which is the compiler name that should be passed to the configure script (and not just plain gcc).

To build the Qt apps, the following extra steps are needed (you need to replace the version number within those paths with the correct version installed with brew):

  1. Add the following to the .zshrc file (I think zsh is the default shell on new Macs... unless you're doing migration assistant from an older Mac, then it keeps your old shell)
export QTDIR="/opt/homebrew/Cellar/qt@5/5.15.10"
export QMAKESPEC="/opt/homebrew/Cellar/qt@5/5.15.10/mkspecs/macx-g++"
  1. Add the following line to /opt/homebrew/Cellar/qt@5/5.15.10/mkspecs/common/macx.conf:
QMAKE_APPLE_DEVICE_ARCHS = arm64
  1. Specify the correct compilers in /opt/homebrew/Cellar/qt@5/5.15.10/mkspecs/common/g++-base.conf (again, this needs to be adjusted with the version installed with brew):
QMAKE_COMPILER  = gcc-13
QMAKE_CC        = $${CROSS_COMPILE}gcc-13
QMAKE_CXX       = $${CROSS_COMPILE}g++-13

This has been tested with macOS Sonoma (14.1), gcc 13, and qt 5.15.10, on an M2 MacBook Air.

One more thing: brew has changed where they install things semi-recently, so if you've had brew a long time on your Mac or if you migrated from an older Mac, it might be a good idea to remove brew completely and install from scratch before starting this process.

@mchamberland
Copy link
Contributor Author

Also, also: the current instructions for QT mention: "(Note that qmake uses its own compiler configuration, located inside the $QTDIR/mkspecs directory.)"

However, that sounds just like an aside and will not mean anything to an inexperienced user.

In my experience, using mismatched compilers between EGSnrc and the QT apps leads to issues when linking or running the applications. The QT compilers should match what was used to build EGSnrc.

@rtownson
Copy link
Collaborator

rtownson commented Nov 7, 2023

Thanks for these instructions, that's very helpful!

I have also found that if you're compiling egs_view yourself, the compilers need to match those used to compile EGSnrc. Which essentially ties you to using those bundled with QT.

@ftessier
Copy link
Member

ftessier commented Nov 7, 2023

This is big help @mchamberland thank you so much. We will update accordingly, and I will also test with another (older) intel silicon mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants