Skip to content

Commit a3ff656

Browse files
committed
Update build docs: DMG usage, arm64 cross-compile, embedded mode
macOS: add DMG installation instructions, SHA256 verification, arm64 cross-compile guide (secp256k1 from source), DMG packaging, cmake PATH fix for SSH sessions. Linux: update running section for embedded SPV mode (no daemon needed), fix default ports table, add data directory section. Windows: add --embedded-ltc/--embedded-doge flags, SHA256 verification, running from build instructions.
1 parent f82debc commit a3ff656

3 files changed

Lines changed: 166 additions & 38 deletions

File tree

doc/build-macos.md

Lines changed: 104 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,46 @@ This guide covers building c2pool from source on macOS.
1818
> major versions are the most common source of build failures on untested
1919
> configurations.
2020
21-
## Option 1: Pre-built binary
21+
## Option 1: Pre-built DMG (recommended)
2222

2323
Download from the [Releases page](https://github.com/frstrtr/c2pool/releases):
24-
- **Intel Mac**: `c2pool-VERSION-macos-x86_64.zip`
25-
- **Apple Silicon (M1/M2/M3/M4)**: `c2pool-VERSION-macos-arm64.zip`
24+
- **Intel Mac**: `c2pool-VERSION-macos-x86_64.dmg`
25+
- **Apple Silicon (M1/M2/M3/M4)**: `c2pool-VERSION-macos-arm64.dmg`
2626

2727
```bash
28-
unzip c2pool-*-macos-*.zip
29-
cd c2pool-*-macos-*
28+
# Mount the DMG
29+
hdiutil attach c2pool-*-macos-*.dmg
30+
31+
# Copy to your preferred location
32+
cp -R /Volumes/c2pool-*/ ~/c2pool
33+
34+
# Unmount
35+
hdiutil detach /Volumes/c2pool-*
36+
37+
# Run
38+
cd ~/c2pool
3039
./start.sh
3140
```
3241

3342
Dashboard: `http://localhost:8080` — Stratum: `stratum+tcp://YOUR_IP:9327`
3443

35-
> **macOS Gatekeeper**: On first run, macOS may block the binary. Open System Settings > Privacy & Security and click "Allow Anyway", or run: `xattr -d com.apple.quarantine c2pool`
44+
The DMG contains everything needed: the binary, bundled `libsecp256k1`, web dashboard,
45+
config templates, block explorer, and a start script. No additional dependencies required.
46+
47+
> **macOS Gatekeeper**: On first run, macOS may block the binary. Open
48+
> System Settings > Privacy & Security and click "Allow Anyway", or run:
49+
> ```bash
50+
> xattr -dr com.apple.quarantine ~/c2pool
51+
> ```
52+
53+
### Verifying the download
54+
55+
Each release includes a `SHA256SUMS` file. Verify your download:
56+
57+
```bash
58+
shasum -a 256 c2pool-*-macos-*.dmg
59+
# Compare output with the published SHA256SUMS
60+
```
3661
3762
---
3863

@@ -167,23 +192,90 @@ c2pool stores its data in `~/.c2pool/`:
167192

168193
---
169194

170-
## Universal binary (optional)
195+
## Cross-compiling for arm64 on an Intel Mac
196+
197+
If you have an Intel Mac and want to build an arm64 binary (e.g. for distribution):
171198

172-
To build a fat binary that runs natively on both Intel and Apple Silicon:
199+
### 1. Build secp256k1 for arm64
200+
201+
Homebrew's secp256k1 is native-only. Cross-compile from source:
202+
203+
```bash
204+
git clone --depth 1 --branch v0.7.1 https://github.com/bitcoin-core/secp256k1.git
205+
cd secp256k1
206+
mkdir build && cd build
207+
cmake .. -DCMAKE_OSX_ARCHITECTURES=arm64 \
208+
-DCMAKE_INSTALL_PREFIX=$HOME/arm64-deps \
209+
-DSECP256K1_BUILD_TESTS=OFF \
210+
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \
211+
-DSECP256K1_BUILD_BENCHMARK=OFF \
212+
-DSECP256K1_BUILD_EXAMPLES=OFF
213+
cmake --build . -j$(sysctl -n hw.ncpu)
214+
cmake --install . --prefix $HOME/arm64-deps
215+
```
216+
217+
### 2. Build c2pool for arm64
173218

174219
```bash
175-
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
220+
cd c2pool
221+
mkdir build-arm64 && cd build-arm64
222+
cmake .. -DCMAKE_BUILD_TYPE=Release \
223+
-DCMAKE_OSX_ARCHITECTURES=arm64 \
224+
-DSECP256K1_INCLUDE_DIRS=$HOME/arm64-deps/include \
225+
-DSECP256K1_LIBRARIES=$HOME/arm64-deps/lib/libsecp256k1.dylib
176226
cmake --build . --target c2pool -j$(sysctl -n hw.ncpu)
177227
```
178228

179-
> **Note**: Universal builds require that all Homebrew dependencies are also
180-
> available for both architectures. This may require additional setup.
181-
> For most users, building natively for your Mac's architecture is simpler.
229+
Binary: `build-arm64/src/c2pool/c2pool` (Mach-O arm64)
230+
231+
> **Important**: Use a persistent location for `arm64-deps` (not `/tmp/`).
232+
> The arm64 secp256k1 library is needed at build time and bundled into the DMG.
233+
234+
### 3. Build the DMG
235+
236+
```bash
237+
bash installer/macos/create-dmg.sh build-arm64/src/c2pool/c2pool arm64
238+
```
239+
240+
---
241+
242+
## Building a DMG package
243+
244+
The `installer/macos/create-dmg.sh` script packages a binary with all
245+
required assets into a distributable `.dmg` file:
246+
247+
```bash
248+
# Native architecture
249+
bash installer/macos/create-dmg.sh build/src/c2pool/c2pool
250+
251+
# Specific architecture
252+
bash installer/macos/create-dmg.sh build/src/c2pool/c2pool x86_64
253+
bash installer/macos/create-dmg.sh build-arm64/src/c2pool/c2pool arm64
254+
```
255+
256+
The DMG includes: binary, `libsecp256k1.6.dylib` (with `install_name_tool`
257+
fixup for `@executable_path`), web-static, explorer, config, start.sh, README.
182258

183259
---
184260

185261
## Troubleshooting
186262

263+
### `cmake` not found over SSH
264+
265+
Homebrew binaries are at `/usr/local/bin` (Intel) or `/opt/homebrew/bin` (Apple Silicon).
266+
Non-login SSH sessions may not load your shell profile. Prefix commands:
267+
268+
```bash
269+
export PATH=/usr/local/bin:$PATH # Intel
270+
export PATH=/opt/homebrew/bin:$PATH # Apple Silicon
271+
```
272+
273+
Or add to `~/.zshenv` (loaded by all zsh sessions, including non-login):
274+
275+
```bash
276+
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zshenv
277+
```
278+
187279
### `brew` not found after installation
188280

189281
Add Homebrew to your PATH:

doc/build-unix.md

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -152,36 +152,37 @@ ctest --output-on-failure -j$(nproc)
152152

153153
All examples assume you are in the repository root.
154154

155-
### Integrated mode — full pool (LTC + DOGE merged mining)
155+
### Integrated mode — embedded SPV (no daemon required)
156+
157+
The default mode uses embedded LTC and DOGE SPV nodes. No litecoind or
158+
dogecoind installation needed.
156159

157160
```bash
158-
./build/src/c2pool/c2pool \
159-
--integrated \
160-
--net litecoin \
161-
--coind-address 127.0.0.1 --coind-rpc-port 9332 \
162-
--coind-p2p-port 9333 \
163-
--merged DOGE:98:127.0.0.1:44556:dogerpc:rpcpass \
164-
--address YOUR_LTC_ADDRESS \
165-
--give-author 2 \
166-
litecoinrpc RPCPASSWORD
161+
./build/src/c2pool/c2pool --integrated --net litecoin --dashboard-dir web-static
167162
```
168163

169-
### Testnet smoke-test
164+
- Dashboard: `http://localhost:8080`
165+
- Stratum: `stratum+tcp://YOUR_IP:9327` (miners set LTC address as username)
166+
- P2P: port 9326 (sharechain peers)
167+
168+
### With external coin daemon (optional)
169+
170+
If you run a local litecoind, add it as a priority peer for faster sync:
170171

171172
```bash
172-
./build/src/c2pool/c2pool --integrated --testnet
173+
./build/src/c2pool/c2pool --integrated --net litecoin \
174+
--dashboard-dir web-static \
175+
--coind-p2p-port 9333
173176
```
174177

175-
### Sharechain-only node
178+
### With YAML config file
176179

177180
```bash
178-
./build/src/c2pool/c2pool \
179-
--sharechain \
180-
--net litecoin \
181-
--coind-address 127.0.0.1 --coind-rpc-port 9332 \
182-
litecoinrpc RPCPASSWORD
181+
./build/src/c2pool/c2pool --config config/c2pool_mainnet.yaml --dashboard-dir web-static
183182
```
184183

184+
See `config/c2pool_mainnet.yaml` for all available options with documentation.
185+
185186
### Full option reference
186187

187188
```bash
@@ -192,15 +193,33 @@ All examples assume you are in the repository root.
192193

193194
| Port | Purpose |
194195
|------|--------|
195-
| 9338 | P2Pool sharechain peer-to-peer |
196-
| 9327 | Stratum mining server + HTTP API |
196+
| 9326 | P2Pool sharechain peer-to-peer |
197+
| 9327 | Stratum mining server |
198+
| 8080 | Web dashboard / JSON-RPC API |
199+
| 9333 | LTC P2P (embedded SPV) |
200+
| 22556 | DOGE P2P (embedded SPV) |
197201

198202
---
199203

200-
## 7. Configuration file (optional)
204+
## 7. Data directory
205+
206+
c2pool stores its data in `~/.c2pool/`:
207+
208+
```
209+
~/.c2pool/
210+
debug.log # Main log file (rotated at 100MB)
211+
sharechain_leveldb/ # Persistent sharechain storage
212+
litecoin/embedded_headers/ # LTC SPV header cache
213+
dogecoin/embedded_headers/ # DOGE SPV header cache
214+
litecoin/utxo_leveldb/ # LTC UTXO set
215+
dogecoin/utxo_leveldb/ # DOGE UTXO set
216+
crash.log # Crash log (if any, at /tmp/c2pool_crash.log)
217+
```
218+
219+
## 8. Configuration file (optional)
201220

202-
Pass `--config path/to/config.yaml` to load settings from YAML.
203-
Templates are in `doc/configs-templates/`.
221+
Pass `--config path/to/config.yaml` to load settings from YAML.
222+
See `config/c2pool_mainnet.yaml` for all available options with documentation.
204223

205224
---
206225

doc/build-windows.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,22 @@ installed separately.
2020
### Running
2121

2222
```
23-
c2pool.exe --integrated --net litecoin --dashboard-dir web-static
23+
c2pool.exe --integrated --net litecoin --embedded-ltc --embedded-doge --dashboard-dir web-static
2424
```
2525

26-
Dashboard: `http://localhost:8080`
27-
Stratum: `stratum+tcp://YOUR_IP:9327` (miners set LTC address as username)
26+
No litecoind or dogecoind needed — embedded SPV nodes sync via P2P.
27+
28+
- Dashboard: `http://localhost:8080`
29+
- Stratum: `stratum+tcp://YOUR_IP:9327` (miners set LTC address as username)
30+
31+
### Verifying the download
32+
33+
Each release includes a `SHA256SUMS` file. Verify your download:
34+
35+
```powershell
36+
Get-FileHash c2pool-*-windows-*.exe -Algorithm SHA256
37+
# Compare output with the published SHA256SUMS
38+
```
2839

2940
---
3041

@@ -94,6 +105,12 @@ Binary: `build\src\c2pool\Release\c2pool.exe`
94105

95106
> **First build**: ~20-30 min (Boost compiles from source via Conan).
96107
108+
### Running from build
109+
110+
```cmd
111+
build\src\c2pool\Release\c2pool.exe --integrated --net litecoin --embedded-ltc --embedded-doge --dashboard-dir web-static
112+
```
113+
97114
### Building the installer
98115

99116
Install [Inno Setup 6](https://jrsoftware.org/isdl.php), then:

0 commit comments

Comments
 (0)