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

Mac M1 Support #1004

Open
LaGregance opened this issue Apr 8, 2023 · 11 comments
Open

Mac M1 Support #1004

LaGregance opened this issue Apr 8, 2023 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@LaGregance
Copy link

Hi,
Following this closed issue: #969

When npm attempts to install nodegui on an M1 mac, it tries to download nodegui-binary-v0.59.0-darwin-arm64.tar.gz. An error is given that this package is not found. When looking at the release page, an arm64.tar.gz package does not exist.

Here is the error from the log regarding this issue:

Error: Error while downloading Precompiled NodeGui binary:https://github.com/nodegui/nodegui/releases/download/v0.59.0/nodegui-binary-v0.59.0-darwin-arm64.tar.gz. Not Found.

Temporary solution

As temporary solution, we can build ourself the artifact and add it to the cache:

cd /tmp

# 1. Build Qt
git clone git://code.qt.io/qt/qt5.git
cd qt5
git checkout 6.4

./init-repository --module-subset=essential -f
git submodule init qtsvg
git submodule update qtsvg

cd ..
mkdir qt5-6.4-macOS-release
cd qt5-6.4-macOS-release

../qt5/configure -release QMAKE_APPLE_DEVICE_ARCHS=arm64 -opensource -confirm-license -nomake examples -nomake tests -skip qt3d -skip webengine -skip qtactiveqt -skip qtcanvas3d  -skip qtdeclarative -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtcharts -skip qtgraphicaleffects -skip qtlocation  -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtscript

make -j15
make install

# 2. Add this to .bashrc or .zshrc
export QT_INSTALL_DIR="/usr/local/Qt-6.4.3"

# 3. Build nodegui
cd ..
gcl https://github.com/nodegui/nodegui.git
cd nodegui
npm install
npm run build

# Save the artifact to the cache directory
cd build/Release
tar -czf nodegui-binary-v0.59.0-darwin-arm64.tar.gz nodegui_core.node
mkdir -p ~/Library/Caches/nodegui-core-nodejs
mv nodegui-binary-v0.59.0-darwin-arm64.tar.gz ~/Library/Caches/nodegui-core-nodejs/.

Long-term solution

We should definitely add the artifact nodegui-binary-v0.59.0-darwin-arm64.tar.gz to the official release. What is the process to do it ?

Thanks.

@sedwards2009
Copy link
Collaborator

It sounds like we're not too far from the solution here. What does npm run install and npm run build do without your extra Qt build steps? If should be able to download the prebuilt Qt and put it in the miniqt folder in the source tree. npm run build should be able to build the lot.

After that, I think we might just be missing a mac + arm64 combo in the .github/workflows/release.yml file.

@LaGregance
Copy link
Author

Regarding of this: https://docs.nodegui.org/docs/guides/getting-started#using-your-own-custom-qt-installation-optional
It should not work since there are no binaries from Qt for M1 yet... So it's mandatory to build Qt ourself...

@sedwards2009
Copy link
Collaborator

The qtConfig.js script downloads the 6.4.1-0-202211101256qtbase-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64.7z. I thought the ARM64 meant it also supported M1 in the form of some kind of "universal binary". That is what it looks like from https://www.qt.io/blog/qt-on-apple-silicon too.

@sedwards2009
Copy link
Collaborator

oh, I see. That page you linked too is out of date and applies to the older Qt5.

@LaGregance
Copy link
Author

Indeed, using only the following works:

gcl https://github.com/nodegui/nodegui.git
cd nodegui
npm install
npm run build

I will make a PR when I had the time.

@OfficialCRUGG
Copy link

Any update on this? I cannot build my own binaries (Not enough storage space for XCode) so prebuilt ones would be amazing.

@sedwards2009 sedwards2009 added the help wanted Extra attention is needed label Jun 20, 2023
@emirefek
Copy link

emirefek commented Sep 2, 2023

@LaGregance can you write a guide to run NodeGUI on m1 mac? I didn't able to manage it to work.

@LaGregance
Copy link
Author

@LaGregance can you write a guide to run NodeGUI on m1 mac? I didn't able to manage it to work.

The temporary solution I mentioned in this issue should be enough to make it work, at which step do you have trouble ?

@Ivansstyle
Copy link

I am wondering if readme should be updated, because nodegui clearly requires qt>6, and in readme version 5 is used.

#1036

@sedwards2009 sedwards2009 pinned this issue Feb 17, 2024
@sedwards2009
Copy link
Collaborator

Does anyone here want to try fixing this mac support properly in NodeGui?

@rsshilli
Copy link

rsshilli commented May 15, 2024

LaGregance commented on Sep 2, 2023

The temporary solution I mentioned in this issue should be enough to make it work, at which step do you have trouble ?

It was this one:

../qt5/configure -release QMAKE_APPLE_DEVICE_ARCHS=arm64 -opensource -confirm-license -nomake examples -nomake tests -skip qt3d -skip webengine -skip qtactiveqt -skip qtcanvas3d  -skip qtdeclarative -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtcharts -skip qtgraphicaleffects -skip qtlocation  -skip qtpurchasing -skip qtquickcontrols -skip qtquickcontrols2 -skip qtremoteobjects -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtscript

It gives me this error:

CMake Error at qtbase/CMakeLists.txt:40 (message):
  The path "/tmp/qt5-6.4-macOS-release" contains symlinks.  This is not
  supported.  Possible solutions:

              - map directories using a transparent mechanism such as mount --bind
              - pass the real path of the build directory to CMake, e.g. using             cd $(realpath <path>) before invoking cmake <source_dir>.
Call Stack (most recent call first):
  qtbase/CMakeLists.txt:47 (qt_internal_check_if_path_has_symlinks)


-- Configuring incomplete, errors occurred!
CMake Error at /tmp/qt5/qtbase/cmake/QtProcessConfigureArgs.cmake:965 (message):
  CMake exited with code 1.

I don't see any symlinks. I don't know why cmake thinks they're there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants