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

Implement FreeBSD support #2007

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions gpt4all-backend/sysinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <sys/sysctl.h>
#elif defined(_WIN32)
#include <windows.h>
#elif defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif

static long long getSystemTotalRAMInBytes()
Expand Down Expand Up @@ -41,6 +43,10 @@ static long long getSystemTotalRAMInBytes()
memoryStatus.dwLength = sizeof(memoryStatus);
GlobalMemoryStatusEx(&memoryStatus);
totalRAM = memoryStatus.ullTotalPhys;
#elif defined(__FreeBSD__)
int mib[2] = {CTL_HW, HW_PHYSMEM};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine with me, but I have no way of testing it. If you verify this works for you I'm happy to add it, but you have to remove the draft, verify it works, and remove the maintenance tool change.

size_t length = sizeof(totalRAM);
sysctl(mib, 2, &totalRAM, &length, NULL, 0);
#endif

return totalRAM;
Expand Down
2 changes: 2 additions & 0 deletions gpt4all-chat/llm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ bool LLM::checkForUpdates() const
QString tool("maintenancetool.exe");
#elif defined(Q_OS_DARWIN)
QString tool("../../../maintenancetool.app/Contents/MacOS/maintenancetool");
#elif defined(Q_OS_FREEBSD)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is not necessary. You don't have an actual installer built from Qt installer framework with FREEBSD so this does nothing.

QString tool("maintenancetool"); //maybe
#endif

QString fileName = QCoreApplication::applicationDirPath()
Expand Down