Installing ethminer in Ubuntu and Automatically Mine

Since the ethminer repository is read only and I think docs/build.md is missing some issues, I will go through installation process. I am using Ubuntu 22.04 64-bit x86 architecture and RTX3060 GPU.

1. Clone the repository and submodules:

git clone https://github.com/ethereum-mining/ethminer.git
git submodule update --init --recursive

2. Install tools:

sudo apt install build-essential gcc g++ cmake libglu1-mesa-dev freeglut3-dev

3. Install cuda toolkit and nvidia drivers https://developer.nvidia.com/cuda-downloads

4. Compile the project

mkdir build
cd build
cmake ..
make -j4

5. Run it

/home/mining/ethminer/build/ethminer/ethminer -P stratum+tcp://<your_wallet_address>.ethminer_intel:nopass@asia2.ethermine.org:4444

6. Add a crontab job so that you will mine automatically

# run "crontab -e" to edit file
* * * * * tmux new -d -s tmux_mining "/home/mining/ethminer/build/ethminer/ethminer -P stratum+tcp://<your_wallet_address>.ethminer_intel:nopass@asia2.ethermine.org:4444" &> /dev/null

Error 1

The following error happened when I skipped step 2.

In file included from /home/mining/.hunter/_Base/9b4e732/72e222e/6e42d60/Build/OpenCL/Source/icd_dispatch.c:38:
/home/mining/.hunter/_Base/9b4e732/72e222e/6e42d60/Build/OpenCL/Source/icd_dispatch.h:66:10: fatal error: GL/gl.h: No such file or directory
   66 | #include <GL/gl.h>
      |          ^~~~~~~~~
compilation terminated.
In file included from /home/mining/.hunter/_Base/9b4e732/72e222e/6e42d60/Build/OpenCL/Source/icd.c:39:
/home/mining/.hunter/_Base/9b4e732/72e222e/6e42d60/Build/OpenCL/Source/icd_dispatch.h:66:10: fatal error: GL/gl.h: No such file or directory
   66 | #include <GL/gl.h>
      |          ^~~~~~~~~
compilation terminated.
gmake[5]: *** [CMakeFiles/OpenCL.dir/build.make:90: CMakeFiles/OpenCL.dir/icd_dispatch.c.o] Error 1
gmake[5]: *** Waiting for unfinished jobs....
gmake[5]: *** [CMakeFiles/OpenCL.dir/build.make:76: CMakeFiles/OpenCL.dir/icd.c.o] Error 1
gmake[4]: *** [CMakeFiles/Makefile2:83: CMakeFiles/OpenCL.dir/all] Error 2
gmake[3]: *** [Makefile:136: all] Error 2
gmake[2]: *** [CMakeFiles/OpenCL-Release.dir/build.make:86: OpenCL-Release-prefix/src/OpenCL-Release-stamp/OpenCL-Release-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/OpenCL-Release.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

[hunter ** FATAL ERROR **] Build step failed (dir: /home/mining/.hunter/_Base/9b4e732/72e222e/6e42d60/Build/OpenCL
[hunter ** FATAL ERROR **] [Directory:/home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/projects/OpenCL]

CMake Error at /home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
Call Stack (most recent call first):
  /home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page)
  /home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error)
  /home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/projects/OpenCL/hunter.cmake:43 (hunter_download)
  /home/mining/.hunter/_Base/Download/Hunter/0.23.320/9b4e732/Unpacked/cmake/modules/hunter_add_package.cmake:62 (include)
  libethash-cl/CMakeLists.txt:27 (hunter_add_package)

Error 2

This one happens when the nvidia driver is already installed. We only need the toolkit, so use flags (as suggested here)

--toolkit --silent --override
┌──────────────────────────────────────────────────────────────────────────────┐
│ Existing package manager installation of the driver found. It is strongly    │
│ recommended that you remove this before continuing.                          │
│ Abort                                                                        │
│ Continue                                                                     │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│ Up/Down: Move | 'Enter': Select                                              │
└──────────────────────────────────────────────────────────────────────────────┘


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *