ethereum-mining / ethminer

Ethereum miner with OpenCL, CUDA and stratum support
GNU General Public License v3.0
5.96k stars 2.28k forks source link

Build on Ubuntu 18.04 with DBUS and other custom cmake configuration options fails #1473

Closed bonedaddy closed 6 years ago

bonedaddy commented 6 years ago

Describe the bug Attempting to build ethminer with the -DETHDBUS=ON cmake flag fails due to the following error

In file included from /home/rtrade/ethminer/ethminer/main.cpp:22:0:
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h: In constructor ‘DBusInt::DBusInt()’:
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h:16:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h:21:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h:24:9: error: ‘minelog’ was not declared in this scope
         minelog << "DBus initialized!";
         ^~~~~~~
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h: In member function ‘void DBusInt::send(const char*)’:
/home/rtrade/ethminer/ethminer/../ethminer/DBusInt.h:33:13: error: ‘minelog’ was not declared in this scope
             minelog << "Message is null!";
             ^~~~~~~
ethminer/CMakeFiles/ethminer.dir/build.make:62: recipe for target 'ethminer/CMakeFiles/ethminer.dir/main.cpp.o' failed
make[2]: *** [ethminer/CMakeFiles/ethminer.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:489: recipe for target 'ethminer/CMakeFiles/ethminer.dir/all' failed
make[1]: *** [ethminer/CMakeFiles/ethminer.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

To Reproduce Install ubuntu 18.04 desktop, and install nvidia with the following script

#! /bin/bash

# This installation method requires at least one GPU being plugged into the system
# before you run this script so that we may utilize the ubuntu-drivers utility
# to install the recommended version for each rig.

DISTRO=$(lsb_release -sc)
if [[ "$DISTRO" != "bionic" ]]; then
    echo "[ERROR] Installation only supported for 18.04"
    exit 1
fi

echo "[INFO] Updating system"
sudo apt update -y
echo "[INFO] Upgrading system"
sudo apt upgrade -y
echo "[INFO] Installing openssh-server"
sudo apt install openssh-server -y
echo "[INFO] Installing git"
sudo apt install git -y
echo "[INFO] Installing vim"
sudo apt install vim -y
echo "[INFO] Downloading mining-bootstrap repo"

cd ~ || exit

git clone https://github.com/RTradeLtd/mining-bootstrap.git

echo "[INFO] Beginning nvidia driver installation"
RECOMMENDED_VERSION=$(sudo ubuntu-drivers devices | grep -i driver | grep -i nvidia | awk '{print $3}')
echo "[INFO] Installing driver version $RECOMMENDED_VERSION"
sudo apt install "$RECOMMENDED_VERSION" -y
echo "[INFO] Nvidia drivers installed. installing cuda toolkit"
sudo apt install nvidia-cuda-toolkit
echo "[INFO] Setting default boot target to multi-user.target"
sudo systemctl set-default multi-user.target
echo "[INFO] Ubuntu 18.04 mining bootstrap finished, sleeping for 15 seconds before rebooting"
echo "[INFO] Hit CTRL+C to cancel reboot"
sleep 15
sudo shutdown -r now

Then build ethminer with the following script

#! /bin/bash

# Used to install ethminer from source optimized for nvidia

cd ~ || exit

echo "[INFO] Downloading ethminer"
git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer || exit

echo "[INFO] Installing dbus development libraries"
sudo apt install libdbus-1-dev
echo "[INFO] Installing cmake"
sudo apt install cmake

echo "[INFO] Running GCC fix for ubuntu 18.04"
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10

echo "[INFO] Updating submodules"
git submodule update --init --recursive
echo "[INFO] Creating build dir"
mkdir build
cd build || exit

echo "[INFO] Configuring cmake with options -DETHASHCUDA=ON -DETHASHCL=OFF -DAPICORE=ON -DETHDBUS=ON -DBINKERN=OFF"
cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF -DAPICORE=ON -DETHDBUS=ON -DBINKERN=OFF

echo "[INFO] Building ethminer project"
cmake --build .

Hardware CPU: Intel(R) Pentium(R) CPU G4400 @ 3.30GHz GPU: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1) * 2 Driver Version: 390

bonedaddy commented 6 years ago

Omitting the -DETHDBUS=ON flag got me a little further, however I'm not getting a new error:

[ 96%] Building CXX object ethminer/CMakeFiles/ethminer.dir/main.cpp.o
[100%] Linking CXX executable ethminer
../libapicore/libapicore.a(ApiServer.cpp.o): In function `dev::eth::Farm::spawn_file_in_bin_dir(char const*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)':
ApiServer.cpp:(.text._ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE[_ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE]+0x7e): undefined reference to `boost::filesystem::detail::read_symlink(boost::filesystem::path const&, boost::system::error_code*)'
ApiServer.cpp:(.text._ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE[_ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE]+0x127): undefined reference to `boost::filesystem::path::parent_path() const'
ApiServer.cpp:(.text._ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE[_ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE]+0x244): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
ApiServer.cpp:(.text._ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE[_ZN3dev3eth4Farm21spawn_file_in_bin_dirEPKcRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISA_EE]+0x2cc): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
ethminer/CMakeFiles/ethminer.dir/build.make:119: recipe for target 'ethminer/ethminer' failed
make[2]: *** [ethminer/ethminer] Error 1
CMakeFiles/Makefile2:489: recipe for target 'ethminer/CMakeFiles/ethminer.dir/all' failed
make[1]: *** [ethminer/CMakeFiles/ethminer.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
bonedaddy commented 6 years ago

Omitting everything and just goign with the default using cmake .. caused no problems and I was to successfully build ethminer

jean-m-cyr commented 6 years ago

Fixed

bonedaddy commented 6 years ago

@jean-m-cyr stil lgetting Dbus failures unfortunately: https://github.com/ethereum-mining/ethminer/issues/1484