|
1 | 1 | # OpenBSD build guide |
2 | 2 |
|
3 | | -The guide below was for autotools and is outdated and deprecated. Folks using OpenBSD may be able to use this and adapt the cmake build procedure in the main build doc, [build.md](build.md) for the Linux Native build target. The Gridcoin Team encourages anyone getting a modern OpenBSD (7.8, for example) to work with Gridcoin to submit an issue on Github documenting what you did to get it to work, or if you are familiar with pull request creation, a PR with changes to this file with the correct procedure that works. |
| 3 | +This guide details how to build Gridcoin on OpenBSD. While this is not checked in CI/CD, it has been verified to work as of the 5.5.0.0 release. |
4 | 4 |
|
5 | | -=================== |
| 5 | +## 1. Install Dependencies |
6 | 6 |
|
7 | | -## Deprecated Guide |
| 7 | +Run the following commands as root (or using `doas`) to install the necessary build tools and libraries. |
8 | 8 |
|
9 | | -(updated for OpenBSD 7.0) |
| 9 | +```ksh |
| 10 | +# Basic build requirements and libraries |
| 11 | +pkg_add git cmake boost curl libzip miniupnpc |
10 | 12 |
|
11 | | -This guide describes how to build gridcoinresearchd, command-line utilities, and GUI on OpenBSD. |
| 13 | +# If you prefer sudo over the native doas (optional) |
| 14 | +pkg_add sudo |
| 15 | +```` |
12 | 16 |
|
13 | | -Preparation |
14 | | ------------ |
| 17 | +### Note on Sudo vs. Doas |
15 | 18 |
|
16 | | -Run the following as root to install the base dependencies for building: |
| 19 | +OpenBSD uses `doas` by default. If you prefer `sudo`: |
17 | 20 |
|
18 | | -```bash |
19 | | -pkg_add cmake vim |
20 | | -# or |
21 | | -pkg_add autoconf automake gmake libtool python |
| 21 | +1. Ensure your user is in the `wheel` group: |
| 22 | + ```ksh |
| 23 | + # Replace 'jco' with your username |
| 24 | + usermod -G wheel jco |
| 25 | + ``` |
| 26 | +2. Edit the sudoers file using `visudo` and find the line: |
| 27 | + `## Uncomment to allow members of group wheel to execute any command` |
22 | 28 |
|
23 | | -pkg_add boost curl libzip leveldb pkgconf |
24 | | -pkg_add qt5 libqrencode # optional for the GUI |
25 | | -``` |
| 29 | + Uncomment the following line, which should be similar to |
| 30 | + `%wheel ALL=(ALL) ALL` |
26 | 31 |
|
27 | | -Resource limits |
28 | | ---------------- |
| 32 | + and save the file with `:wq!` |
29 | 33 |
|
30 | | -If the build runs into out-of-memory errors, the instructions in this section |
31 | | -might help. |
| 34 | +## 2\. Clone the Repository |
32 | 35 |
|
33 | | -The standard ulimit restrictions in OpenBSD are very strict: |
| 36 | +```ksh |
| 37 | +git clone [https://github.com/gridcoin-community/Gridcoin-Research.git](https://github.com/gridcoin-community/Gridcoin-Research.git) |
| 38 | +cd Gridcoin-Research |
| 39 | +git checkout master |
| 40 | +``` |
34 | 41 |
|
35 | | - data(kbytes) 1572864 |
| 42 | +----- |
36 | 43 |
|
37 | | -This is, unfortunately, in some cases not enough to compile some `.cpp` files in the project, |
38 | | -(see [Bitcoin#6658](https://github.com/bitcoin/bitcoin/issues/6658)). |
39 | | -If your user is in the `staff` group the limit can be raised with: |
| 44 | +## 3\. Build Configuration |
40 | 45 |
|
41 | | - ulimit -d 3000000 |
| 46 | +Choose **Option A** (Headless/Daemon) or **Option B** (GUI Wallet). |
42 | 47 |
|
43 | | -The change will only affect the current shell and processes spawned by it. To |
44 | | -make the change system-wide, change `datasize-cur` and `datasize-max` in |
45 | | -`/etc/login.conf`, and reboot. |
| 48 | +### Option A: Headless (Daemon only) |
46 | 49 |
|
47 | | -### Building Gridcoin |
| 50 | +Use this configuration for servers or command-line only environments. |
48 | 51 |
|
49 | | -**Important**: use `gmake`, not `make`. The non-GNU `make` will exit with a horrible error. |
| 52 | +```ksh |
| 53 | +# Configure |
| 54 | +cmake -B build -DENABLE_GUI=off -DENABLE_TESTS=on -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_PIE=on -DENABLE_UPNP=on |
50 | 55 |
|
51 | | -To configure with gridcoinresearchd: |
| 56 | +# Build |
| 57 | +# Replace <# of cpus> with your core count, e.g., -j4 |
| 58 | +cmake --build build -j <# of cpus> |
52 | 59 |
|
53 | | -* With CMake: |
| 60 | +# Install (Optional) |
| 61 | +doas cmake --install build |
| 62 | +``` |
54 | 63 |
|
55 | | - ```bash |
56 | | - mkdir build && cd build |
57 | | - cmake .. |
58 | | - ``` |
| 64 | +### Option B: GUI Wallet (Qt6) |
59 | 65 |
|
60 | | -* With Autotools: |
| 66 | +Use this configuration for a desktop environment. |
61 | 67 |
|
62 | | - ```bash |
63 | | - ./autogen.sh |
64 | | - ./configure --with-gui=no \ |
65 | | - MAKE=gmake |
66 | | - ``` |
| 68 | +**Additional GUI Dependencies:** |
67 | 69 |
|
68 | | -To configure with GUI: |
| 70 | +```ksh |
| 71 | +# Qt6 framework |
| 72 | +pkg_add qt6 |
69 | 73 |
|
70 | | -* With CMake: |
| 74 | +# Desktop Environment extras (Optional - for a full XFCE experience) |
| 75 | +pkg_add xfce xfce-extras |
71 | 76 |
|
72 | | - ```bash |
73 | | - mkdir build && cd build |
74 | | - cmake -DENABLE_GUI=ON |
75 | | - ``` |
| 77 | +# VMware helper (Optional - install only if running OpenBSD in a VMware VM) |
| 78 | +pkg_add vmwh |
| 79 | +``` |
76 | 80 |
|
77 | | -* With Autotools: |
| 81 | +**System Services:** |
| 82 | +Qt6 and modern GUI applications require the message bus (dbus) to be running. |
78 | 83 |
|
79 | | - ```bash |
80 | | - ./autogen.sh |
81 | | - ./configure --with-gui=yes \ |
82 | | - MAKE=gmake |
83 | | - ``` |
| 84 | +```ksh |
| 85 | +rcctl enable messagebus |
| 86 | +rcctl start messagebus |
| 87 | +``` |
84 | 88 |
|
85 | | -Build and run the tests: |
| 89 | +**Build & Install:** |
86 | 90 |
|
87 | | -* With CMake: |
| 91 | +```ksh |
| 92 | +# Configure |
| 93 | +# Note: Remove -DENABLE_QRENCODE=on if you do not have qrencode installed |
| 94 | +cmake -B build -DENABLE_GUI=on -DENABLE_TESTS=on -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_QT6=on -DENABLE_PIE=on -DENABLE_QRENCODE=on -DENABLE_UPNP=on |
88 | 95 |
|
89 | | - ```bash |
90 | | - cmake --build . # use "-j N" here for N parallel jobs |
91 | | - ctest . |
92 | | - ``` |
| 96 | +# Build |
| 97 | +cmake --build build -j <# of cpus> |
93 | 98 |
|
94 | | -* With Autotools: |
| 99 | +# Install (Optional) |
| 100 | +# This will install binaries and assets (icons, desktop files) |
| 101 | +doas cmake --install build |
| 102 | +``` |
95 | 103 |
|
96 | | - ```bash |
97 | | - gmake # use "-j N" here for N parallel jobs |
98 | | - gmake check |
99 | | - ``` |
|
0 commit comments