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

npm install with custom Qt installation is looking for Qt6 libraries, however qt5 is mentioned in the Readme (m2 Mac) #1036

Open
Ivansstyle opened this issue Jan 5, 2024 · 2 comments

Comments

@Ivansstyle
Copy link

Describe the bug
When trying to use NodeGUI with m2 and following the readme, npm throws an error at CMake stage of linking to Qt5 libraries

To Reproduce
Steps to reproduce the behavior:

  1. Follow README.txt for section for M1 macs

Expected behavior
npm module is installed

logs

❯ npm install
npm WARN deprecated cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
npm ERR! code 1
npm ERR! path /Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui
npm ERR! command failed
npm ERR! command sh -c npm run setupqt && (node ./scripts/skip.js || npm run setupbinary || npm run build:addon)
npm ERR! > @nodegui/nodegui@0.63.0 setupqt
npm ERR! > node ./scripts/setupMiniQt.js
npm ERR! 
npm ERR! CustomQt detected at /usr/local/Qt-5.15.12 . Hence, skipping Mini Qt installation...
npm ERR! 
npm ERR! > @nodegui/nodegui@0.63.0 setupbinary
npm ERR! > node ./scripts/setupBinary.js
npm ERR! 
npm ERR! 
npm ERR! > @nodegui/nodegui@0.63.0 build:addon
npm ERR! > cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js compile
npm ERR! 
npm ERR! [
npm ERR!   '/opt/homebrew/Cellar/node/21.4.0/bin/node',
npm ERR!   '/Users/is/Code/uni/RhymeFinderJS/node_modules/.bin/cmake-js',
npm ERR!   'compile'
npm ERR! ]
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is AppleClang 15.0.0.15000040
npm ERR! -- The CXX compiler identification is AppleClang 15.0.0.15000040
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Using Qt installation for nodegui_core QT_CMAKE_HOME_DIR:/usr/local/Qt-5.15.12/lib/cmake/Qt6
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is AppleClang 15.0.0.15000040
npm ERR! -- The CXX compiler identification is AppleClang 15.0.0.15000040
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Using Qt installation for nodegui_core QT_CMAKE_HOME_DIR:/usr/local/Qt-5.15.12/lib/cmake/Qt6
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! (node:52992) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! (node:53037) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! Error: Error while downloading Precompiled NodeGui binary:https://github.com/nodegui/nodegui/releases/download/v0.63.0/nodegui-binary-v0.63.0-darwin-arm64.tar.gz. Not Found
npm ERR!     at Object.<anonymous> (/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/artifact-installer/dist/downloader.js:69:31)
npm ERR!     at step (/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/artifact-installer/dist/downloader.js:33:23)
npm ERR!     at Object.next (/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/artifact-installer/dist/downloader.js:14:53)
npm ERR!     at fulfilled (/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/artifact-installer/dist/downloader.js:5:58)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR! info TOOL Using Ninja generator, because ninja is available.
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Ninja',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=6.3.2',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/build/Release',
npm ERR! info RUN   '-DCMAKE_JS_INC=/Users/is/.cmake-js/node-arm64/v21.4.0/include/node',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=21.4.0',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION',
npm ERR! info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
npm ERR! info RUN ]
npm ERR! CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
npm ERR!   Compatibility with CMake < 3.5 will be removed from a future version of
npm ERR!   CMake.
npm ERR! 
npm ERR!   Update the VERSION argument <min> value or use a ...<max> suffix to tell
npm ERR!   CMake that the project does not need compatibility with older versions.
npm ERR! 
npm ERR! 
npm ERR! CMake Error at config/qt.cmake:23 (find_package):
npm ERR!   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
npm ERR!   asked CMake to find a package configuration file provided by "Qt6", but
npm ERR!   CMake did not find one.
npm ERR! 
npm ERR!   Could not find a package configuration file provided by "Qt6" with any of
npm ERR!   the following names:
npm ERR! 
npm ERR!     Qt6Config.cmake
npm ERR!     qt6-config.cmake
npm ERR! 
npm ERR!   Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
npm ERR!   to a directory containing one of the above files.  If "Qt6" provides a
npm ERR!   separate development package or SDK, be sure it has been installed.
npm ERR! Call Stack (most recent call first):
npm ERR!   CMakeLists.txt:241 (AddQtSupport)
npm ERR! 
npm ERR! 
npm ERR! info REP Build has been failed, trying to do a full rebuild.
npm ERR! info CMD CLEAN
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '-E',
npm ERR! info RUN   'remove_directory',
npm ERR! info RUN   '/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/build'
npm ERR! info RUN ]
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Ninja',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=6.3.2',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/build/Release',
npm ERR! info RUN   '-DCMAKE_JS_INC=/Users/is/.cmake-js/node-arm64/v21.4.0/include/node',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=21.4.0',
npm ERR! info RUN   '-DNODE_ARCH=arm64',
npm ERR! info RUN   '-DCMAKE_OSX_ARCHITECTURES=arm64',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-D_DARWIN_USE_64_BIT_INODE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION',
npm ERR! info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=-undefined dynamic_lookup'
npm ERR! info RUN ]
npm ERR! CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
npm ERR!   Compatibility with CMake < 3.5 will be removed from a future version of
npm ERR!   CMake.
npm ERR! 
npm ERR!   Update the VERSION argument <min> value or use a ...<max> suffix to tell
npm ERR!   CMake that the project does not need compatibility with older versions.
npm ERR! 
npm ERR! 
npm ERR! CMake Error at config/qt.cmake:23 (find_package):
npm ERR!   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
npm ERR!   asked CMake to find a package configuration file provided by "Qt6", but
npm ERR!   CMake did not find one.
npm ERR! 
npm ERR!   Could not find a package configuration file provided by "Qt6" with any of
npm ERR!   the following names:
npm ERR! 
npm ERR!     Qt6Config.cmake
npm ERR!     qt6-config.cmake
npm ERR! 
npm ERR!   Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
npm ERR!   to a directory containing one of the above files.  If "Qt6" provides a
npm ERR!   separate development package or SDK, be sure it has been installed.
npm ERR! Call Stack (most recent call first):
npm ERR!   CMakeLists.txt:241 (AddQtSupport)
npm ERR! 
npm ERR! 
npm ERR! ERR! OMG Process terminated: 1

Desktop (please complete the following information):

  • OS: macOS
@Ivansstyle
Copy link
Author

Ivansstyle commented Jan 5, 2024

Ok, while trying to install the package along qt6 installed via brew I have another stream of errors, which may be related to something else.

Note, I am on Sonoma (14.0)

Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/src/cpp/include/nodegui/QtWidgets/QFileDialog/qfiledialog_wrap.h:9: npm ERR! In file included from /Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/src/cpp/include/nodegui/QtWidgets/QFileDialog/nfiledialog.hpp:2: 
npm ERR! In file included from /opt/homebrew/opt/qt/lib/QtWidgets.framework/Headers/QFileDialog:1: npm ERR! In file included from /opt/homebrew/opt/qt/lib/QtWidgets.framework/Headers/qfiledialog.h:8: 
npm ERR! In file included from /opt/homebrew/opt/qt/include/QtCore/qdir.h:8: 
npm ERR! /opt/homebrew/opt/qt/include/QtCore/qfile.h:129:14: error: '~path' is unavailable: introduced in macOS 10.15 npm ERR! { return QtPrivate::toFilesystemPath(fileName()); }
 npm ERR! ^ npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__filesystem/path.h:505:3: note: '~path' has been explicitly marked unavailable here npm ERR! ~path() = default; npm ERR! ^ npm ERR! In file included from /Users/is/Code/uni/RhymeFinderJS/node_modules/@nodegui/nodegui/src/cpp/main.cpp:71: npm ERR! In file included from

Where error: '~path' is unavailable: introduced in macOS 10.15

is regarding std::filesystem::path

However I am clearly using Sonoma's sdk (14.0): /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk

It may have been not the smartest to use qt@6 directly from brew, but why it detects as macOS 10.15 I have no idea.

As I seen from the logs, if it fails to compile the package, then it tries to install it from GitHub releases, where there is no darwing-arm64 version.

Will be trying #1004

@Ivansstyle
Copy link
Author

Ivansstyle commented Jan 5, 2024

Btw it is possible to add arm64 build for nodegui by simply adding

"build-arm": "tsc && npm run build-arm:addon",
"build-arm:addon": "arch -arm64 cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js compile --arch arm64",

Which will use universal binaries to compile for arch. This way it is possible to use free macOS runners to compile for arm64 on github, however some modification would be necessary to create a correct version in the workflow. For this build matrix would need to be updated to include that step, and build action should be conditional to use build-arm command for arm target

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

No branches or pull requests

1 participant