build cpuminer for windows - connectivity problems no curl

This commit is contained in:
Dobromir Popov
2025-09-08 08:53:17 +03:00
parent 9a2d14de90
commit a545714b34
7 changed files with 603 additions and 25 deletions

View File

@@ -8,6 +8,34 @@ sudo apt update
sudo apt install build-essential autotools-dev autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev zlib1g-dev git automake libtool docker.io
```
### 🛠️ VS Code Integration (Recommended)
If you're using VS Code, the project now includes pre-configured tasks for easy building:
1. **Open in VS Code:**
```bash
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
code .
```
2. **Use Build Tasks:**
- Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac)
- Type "Tasks: Run Task"
- Select "Build Windows CPU Miner (Smart)" - **RECOMMENDED**
- Or choose other build options as needed
**Available VS Code Tasks:**
- **Build Windows CPU Miner (Smart)** ⭐ - Automatically detects curl and builds optimally
- **Build Windows CPU Miner (Original Curl)** - Forces original curl implementation
- **Build Windows CPU Miner (NO_CURL Fallback)** - Direct socket fallback
- **Clean Windows Build** - Clean build artifacts
- **Test Windows Executable** - Verify build results
**Benefits:**
- ✅ No need to remember complex Docker commands
- ✅ Automatic curl detection and optimal build selection
- ✅ Integrated terminal output in VS Code
- ✅ One-click building from the IDE
### 1. Build GPU Library (ROCm/HIP)
```bash
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner/gpu/RinHash-hip
@@ -26,17 +54,41 @@ sudo cp rocm-direct-output/gpu-libs/librinhash_hip.so /usr/local/lib/
sudo ldconfig
```
### 2. Build Windows CPU Miner (Docker Cross-Compilation)
### 2. Build Windows CPU Miner (Docker Cross-Compilation) - RECOMMENDED
```bash
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner
# Build Windows executable using Docker (recommended method)
sudo docker run --rm -v "$(pwd):/work" -v "$(pwd)/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/"
# Build Windows executable with original curl implementation (recommended)
./build-windows-smart.sh
# Or use the manual command:
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
sudo docker run --rm -v "$(pwd):/work" -v "$(pwd)/build/win:/output" cpuminer-windows-builder bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 --with-curl=/usr/x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DCURL_STATICLIB' LDFLAGS='-L/usr/x86_64-w64-mingw32/lib' LIBS='-lcurl -lbcrypt -ladvapi32 -lcrypt32 -lz -lws2_32 -pthread' && make -j4 && cp cpuminer.exe /output/cpuminer-curl.exe && cp /work/cpuminer.exe /output/"
# Verify build success
ls -la build/win/cpuminer.exe
ls -la build/win/cpuminer*.exe
```
**✅ SUCCESS:** The smart build script now automatically:
- Detects curl availability in the Docker container
- Builds with original curl implementation (better performance)
- Falls back to NO_CURL only if curl linking fails
- Produces `cpuminer-curl.exe` (4.4MB) with full stratum features
- Also creates `cpuminer-nocurl.exe` (3.9MB) as fallback
### Why Use Original Curl Implementation?
- **Better Performance:** Native curl library is optimized for networking
- **Full Stratum Support:** Complete stratum protocol implementation
- **Stability:** Less prone to connection drops and timeouts
- **Compatibility:** Works with all mining pools and proxies
- **Security:** Uses proven, battle-tested networking code
### Build Output Comparison:
- **cpuminer-curl.exe** (4.4MB): Original implementation with full features
- **cpuminer-nocurl.exe** (3.9MB): Fallback with direct socket implementation
**Recommendation:** Always use `cpuminer-curl.exe` for production mining!
### 3. Alternative: Build Linux CPU Miner
```bash
cd /home/db/Downloads/rinhash/cpuminer-opt-rin