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

Ethminer Nvidia Only build still failing with DBUS enabled #1484

Closed bonedaddy closed 6 years ago

bonedaddy commented 6 years ago

I recently opened an issue complaining about builds failing when attempting to enable nvidia only components. However after getting the latest master commit I'm still facing an issue with DBUS: Previous issue is https://github.com/ethereum-mining/ethminer/issues/1473

In file included from /home/solidity/ethminer/ethminer/main.cpp:22:0:
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h: In constructor ‘DBusInt::DBusInt()’:
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:16:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:21:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:24:9: error: ‘minelog’ was not declared in this scope
         minelog << "DBus initialized!";
         ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h: In member function ‘void DBusInt::send(const char*)’:
/home/solidity/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
bonedaddy commented 6 years ago

Can confirm it is the DBUS flag causing problems. Tried again with keeping DBUS options disabled, and the build worked

jean-m-cyr commented 6 years ago

In main.cpp try moving the dbusint.h #include to after all other #includes.

bonedaddy commented 6 years ago

Build still fails, here's what I tried:

#include <CLI/CLI.hpp>

#include <ethminer/buildinfo.h>

#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif

#include <libethcore/Farm.h>
#if ETH_ETHASHCL
#include <libethash-cl/CLMiner.h>
#endif
#if ETH_ETHASHCUDA
#include <libethash-cuda/CUDAMiner.h>
#endif
#include <libpoolprotocols/PoolManager.h>
#include <libpoolprotocols/getwork/EthGetworkClient.h>
#include <libpoolprotocols/stratum/EthStratumClient.h>
#include <libpoolprotocols/testing/SimulateClient.h>

#if API_CORE
#include <libapicore/ApiServer.h>
#include <libapicore/httpServer.h>
#endif

#if ETH_DBUS
#include <ethminer/DBusInt.h>
#endif

Error message:

[ 96%] Building CXX object ethminer/CMakeFiles/ethminer.dir/main.cpp.o
In file included from /home/solidity/ethminer/ethminer/main.cpp:44:0:
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h: In constructor ‘DBusInt::DBusInt()’:
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:16:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:21:13: error: ‘minelog’ was not declared in this scope
             minelog << "DBus error " << err.name << ": " << err.message;
             ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:24:9: error: ‘minelog’ was not declared in this scope
         minelog << "DBus initialized!";
         ^~~~~~~
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h: In member function ‘void DBusInt::send(const char*)’:
/home/solidity/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

I don't know C++ however from what I can gather it is due to a scoping rule between "minelog" not being available to the DBus package

I tried adding the following to DBusInt.h

#define minelog clog(MiningChannel)

struct MiningChannel : public LogChannel
{
    static const char* name() { return EthGreen " m"; }
    static const int verbosity = 2;
};

Which gave me the error

[ 96%] Building CXX object ethminer/CMakeFiles/ethminer.dir/main.cpp.o
/home/solidity/ethminer/ethminer/main.cpp:53:8: error: redefinition of ‘struct MiningChannel’
 struct MiningChannel : public LogChannel
        ^~~~~~~~~~~~~
In file included from /home/solidity/ethminer/ethminer/main.cpp:44:0:
/home/solidity/ethminer/ethminer/../ethminer/DBusInt.h:10:8: error: previous definition of ‘struct MiningChannel’
 struct MiningChannel : public LogChannel
        ^~~~~~~~~~~~~
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
jean-m-cyr commented 6 years ago

Ah ok, don't redefine minelog and MiningChannel. Just move the dbisint include to after #define minelog clog(MiningChannel), line 56, in main.cpp.

bonedaddy commented 6 years ago

awesome that worked, want me to open up a PR?

jean-m-cyr commented 6 years ago

Just did.

bonedaddy commented 6 years ago

Thanks for the help :grin:

jean-m-cyr commented 6 years ago

Not many use dbus and we don't enable it in continuous integration. So these types of issues pop up once in a while. Thanks for pointing it out.