2023-10-18 11:37:28 -04:00
# Building gpt4all-chat from source
2023-05-09 21:59:11 -04:00
Depending upon your operating system, there are many ways that Qt is distributed.
2023-05-09 23:00:50 -04:00
Here is the recommended method for getting the Qt dependency installed to setup and build
gpt4all-chat from source.
2023-05-09 21:59:11 -04:00
2023-10-18 11:37:28 -04:00
## Prerequisites
2023-05-09 21:59:11 -04:00
2023-10-18 12:09:52 -04:00
On Windows and Linux, building GPT4All requires the complete Vulkan SDK. You may download it from here: https://vulkan.lunarg.com/sdk/home
2023-05-09 21:59:11 -04:00
2023-10-18 11:37:28 -04:00
macOS users do not need Vulkan, as GPT4All will use Metal instead.
2023-05-09 21:59:11 -04:00
2023-10-18 11:37:28 -04:00
## Note for Linux users
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
Linux users may install Qt via their distro's official packages instead of using the Qt installer. You need at least Qt 6.5, with support for QPdf and the Qt HTTP Server. It should be straightforward to build with just cmake and make, but you may continue to follow these instructions to build with Qt Creator.
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
On Arch Linux, this looks like:
```
sudo pacman -S --needed base-devel qt6-base qt6-httpserver qtcreator cmake ninja
```
On Ubuntu 23.04, this looks like:
```
sudo apt install build-essential libqt6gui6 qt6-base-dev libqt6httpserver6 qt6-httpserver-dev qtcreator cmake ninja-build
```
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
## Download Qt
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
- Go to https://login.qt.io/register to create a free Qt account.
- Download the Qt Online Installer for your OS from here: https://www.qt.io/download-qt-installer-oss
- Sign into the installer.
- Agree to the terms of the (L)GPL 3 license.
- Select whether you would like to send anonymous usage statistics to Qt.
- On the Installation Folder page, leave the default installation path, and select "Custom Installation".
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
## Customize the installation
2023-05-09 22:36:02 -04:00
![image ](https://github.com/nomic-ai/gpt4all-chat/assets/10168/c6e999e5-cc8a-4dfc-8065-b59139e8c7ae )
2023-10-18 11:37:28 -04:00
Under "Qt", find the latest Qt 6.x release.
Under this release (e.g. Qt 6.5.0), select the target platform:
- On macOS, it is just called "macOS".
- On Windows, it is called "MSVC 2019 64-bit" (for 64-bit x86 CPUs). MinGW has not been tested.
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
Under this release, select the following additional components:
- Qt Quick 3D
- Qt 5 Compatibility Module
- Qt Shader Tools
2023-10-27 21:40:14 -04:00
- Additional Libraries:
- Qt HTTP Server
- Qt PDF
2023-10-18 11:37:28 -04:00
- Qt Debug information Files
- Qt Quick Timeline
2023-05-09 23:00:50 -04:00
2023-10-18 11:37:28 -04:00
Under Developer and Designer Tools, select the following components:
- Qt Creator
- Qt Creator CDB Debugger Support (for Windows only)
- Debugging Tools for Windows (for Windows only)
- CMake
- Ninja
2023-05-09 23:00:50 -04:00
2023-10-18 11:37:28 -04:00
Agree to the license and complete the installation.
2023-05-09 23:00:50 -04:00
2023-10-18 11:37:28 -04:00
## Download the source code
You must use git to download the source code for gpt4all:
2023-05-09 23:00:50 -04:00
```
2023-05-18 21:40:17 -04:00
git clone --recurse-submodules https://github.com/nomic-ai/gpt4all
2023-05-09 23:00:50 -04:00
```
2023-10-18 11:37:28 -04:00
Note the use of --recurse-submodules, which makes sure the necessary dependencies are downloaded inside the repo. This is why you cannot simply download a zip archive.
2023-05-09 23:00:50 -04:00
2023-10-18 11:37:28 -04:00
Windows users: To install git for Windows, see https://git-scm.com/downloads. Once it is installed, you should be able to shift-right click in any folder, "Open PowerShell window here" (or similar, depending on the version of Windows), and run the above command.
2023-05-09 23:00:50 -04:00
2023-10-18 11:37:28 -04:00
## Open gpt4all-chat in Qt Creator
Open Qt Creator. Navigate to File > Open File or Project, find the "gpt4all-chat" folder inside the freshly cloned repository, and select CMakeLists.txt.
![image ](https://github.com/nomic-ai/gpt4all-chat/assets/10168/3d3e2743-2a1d-43d6-9e55-62f7f4306de7 )
2023-05-09 23:00:50 -04:00
## Configure project
2023-10-18 11:37:28 -04:00
You can now expand the "Details" section next to the build kit. It is best to uncheck all but one build configuration, e.g. "Release", which will produce optimized binaries that are not useful for debugging.
Click "Configure Project", and wait for it to complete.
2023-05-09 23:00:50 -04:00
![image ](https://github.com/nomic-ai/gpt4all-chat/assets/10168/44d5aafb-a95d-434b-ba2a-a3138c0e49a0 )
## Build project
2023-10-18 11:37:28 -04:00
Now that the project has been configured, click the hammer button on the left sidebar to build the project.
2023-05-09 23:00:50 -04:00
![image ](https://github.com/nomic-ai/gpt4all-chat/assets/10168/43cd7b42-32f0-4efa-9612-d51f85637103 )
## Run project
2023-10-18 11:37:28 -04:00
Click the play button on the left sidebar to run the Chat UI.
2023-05-09 23:00:50 -04:00
![image ](https://github.com/nomic-ai/gpt4all-chat/assets/10168/611ea795-bdcd-4feb-a466-eb1c2e936e7e )
2023-10-18 11:37:28 -04:00
## Updating the downloaded source code
2023-05-09 22:36:02 -04:00
2023-10-18 11:37:28 -04:00
You do not need to make a fresh clone of the source code every time. To update it, you may open a terminal/command prompt in the repository, run `git pull` , and then `git submodule update --init --recursive` .