nomic-ai / gpt4all

GPT4All: Run Local LLMs on Any Device. Open-source and available for commercial use.
https://nomic.ai/gpt4all
MIT License
69.11k stars 7.59k forks source link

Build success, but packed failed using QT deploy tool both win & mac #2228

Closed wowliuzj closed 4 months ago

wowliuzj commented 4 months ago

Bug Report

Clone the code and follow the instruction open GPT4All-chat in QT, built and run successfully.

After running windeployqt in Windows 11 or macdeployqt in MacOS(intel chip) and run chat.exe directly it reports FileNotFound libc++.dll and libunwin.dll in Windows11 if run in QT, the application output shows several warnings and exit -1. [Warning] (Wed Apr 17 16:18:21 2024): QQmlApplicationEngine failed to load component [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:6:1: module "Qt5Compat.GraphicalEffects" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:5:1: module "QtQuick.Layouts" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:4:1: module "QtQuick.Controls.Basic" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:3:1: module "QtQuick.Controls" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml: module "QtQml.WorkerScript" is not installed [Warning] (Wed Apr 17 16:18:21 2024): qrc:/gpt4all/main.qml:1:1: module "QtCore" is not installed [Warning] (Wed Apr 17 16:18:21 2024): QIODevice::read (QNetworkReplyHttpImpl): device not open [Warning] (Wed Apr 17 16:18:21 2024): ERROR: Couldn't parse: "" "illegal value"

Steps to Reproduce

  1. clone code from github
  2. open project in QT
  3. after build run windeployqt or macdeployqt
  4. try to run application

Your Environment

cebtenzzre commented 4 months ago

The main supported way of installing GPT4All from source is to build an offline installer by adding GPT4ALL_OFFLINE_INSTALLER=ON to the CMake definitions, and running the package target. If you do anything else, I wouldn't expect it to work.

wowliuzj commented 4 months ago

The main supported way of installing GPT4All from source is to build an offline installer by adding GPT4ALL_OFFLINE_INSTALLER=ON to the CMake definitions, and running the package target. If you do anything else, I wouldn't expect it to work.

Sorry, I am new to CMake, where should I add this ?

cosmic-snow commented 4 months ago

If by

  1. open project in QT

you mean Qt Creator, you should actually be able to find/see that in the CMake configuration table: image

Or I guess you could add it manually in that string form mentioned above (not tried myself).

Don't forget to regenerate (Run CMake) and then rebuild, though. CMake is is creating your build configuration.

However, if you just want to run it from inside Qt Creator, that's possible, too, and you don't need to change anything for that. Do:

Build > Run Without Deployment

(near the bottom of the menu)

wowliuzj commented 4 months ago

Here is my steps: 1, I turend option GPT4ALL_OFFLINE_INSTALLER ON in CMake configuration table, 2, rerun/regenerate CMake file 3, rebuild the project. 4, Open a new terminal and run "/Qt/6.8.0/macos/bin/macdeployqt /gpt4all/build-gpt4all-chat-Qt_6_8_0_for_macOS-Release/bin/gpt4all.app/Content/Macos/gpt4all -qmldir=/gpt4all/gpt4all-chat" 5, The program runs perfect in this Mac with Qt installed, 6, Copy the bundle to another Mac to run it but failed. If I want to build in Mac and run it on other Macs, how should I do it?

cosmic-snow commented 4 months ago

Not sure because I don't have a Mac, but with GPT4ALL_OFFLINE_INSTALLER ON you should actually produce an installer similar to the one that is offered through the website.

You would copy that to the other Macs and run it to start the installation.

To me, it doesn't look like that is what you did there in your steps. The installer should have bundled the Qt dependencies.

wowliuzj commented 4 months ago

I did turn the option on image and also in the CMake file image But no matter I turn it on or off, the building result doesn't have much different. I am using Qt 6.8.0 for macOS. But I didn't install XCode on my Mac, Should I install it?

cosmic-snow commented 4 months ago

I was assuming you were also following the instructions of cebtenzzre:

... build an offline installer by adding GPT4ALL_OFFLINE_INSTALLER=ON to the CMake definitions, and running the package target.

But your latest comment makes me think that maybe you're only setting that option, but you aren't running the target package.

If that's the case, go to your build settings. Under the CMake options you can add a Build Step. Select CMake Build in the dropdown and you should see a new list with checkboxes ('Targets:'), one of them labelled PACKAGE. Activate that, then build again.

Here's how that checkbox looks on my end: image Then I get an installer in the build directory: image

wowliuzj commented 4 months ago

Yes, thanks for your remind. I missed the target part. But after I added build step and select target as package, the build failed with "ninja: build stopped: subcommand failed." Is this correct? image

cosmic-snow commented 4 months ago

If the first build step (whose command line is cut off in your screenshot) is actually compiling, then that should be fine, yes.

Can you open the 'Compile Output' View at the bottom and see if you can figure out what exactly has failed?

wowliuzj commented 4 months ago

Here is the output, looks like I missed some part of Qt. image

I removed the build folder, re-run the CMake file and re-build the project. Even if it failed. I run the macdeployqt command, and copy the bundle to a new created virtual machine. It is running! Real thanks for your help! Let me fixed the QtIFW compiler "binarycreator", to see if whether it could generate a install package or not.

cosmic-snow commented 4 months ago

Good. But I'm not sure about that error. QtIFW is the Installer FrameWork and should be part of the Qt installation, if you've checked the right boxes when installing. Which I'm assuming you did because you were able to run deploy commands, but I'm not entirely sure whether those are part of QtIFW or not. Maybe make sure it's part of your installation?

wowliuzj commented 4 months ago

This is the first time that I am using Qt. Just followed the instruction here to installed the Qt. Not sure whether it related with XCode or not, since I didn't have it in my system. I will reinstall the Qt and try it again. Thanks again for your help!

cosmic-snow commented 4 months ago

Ah right, one thing I've just noticed is that if you check build_and_run.md, the Qt Installer Framework isn't checked in that screenshot. See 'Developer and Designer Tools'. Maybe that's it.

Other than that I can't say more because I don't have a Mac anywhere.