Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Help with build: ethminer for Win64 in Linux using mingw32 #703

Closed
efrasyad opened this issue Feb 5, 2018 · 8 comments
Closed

Help with build: ethminer for Win64 in Linux using mingw32 #703

efrasyad opened this issue Feb 5, 2018 · 8 comments

Comments

@efrasyad
Copy link

efrasyad commented Feb 5, 2018

I've been trying building ethminer for win64 in Linux using mingw32-w64 with the following changes in toolchain file:

$ cat ../cmake/toolchain.cmake
SET(CMAKE_SYSTEM_NAME Windows)

SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS True)

but i always failed on cmake --build . step with the following error:

$ cmake --build .
Scanning dependencies of target BuildInfo.h
Files "/home/pureload/ethminer/build/BuildInfo.h.tmp" to "/home/pureload/ethminer/build/BuildInfo.h" are different.
[ 0%] Built target BuildInfo.h
Scanning dependencies of target devcore
[ 3%] Building CXX object libdevcore/CMakeFiles/devcore.dir/CommonData.cpp.obj
[ 6%] Building CXX object libdevcore/CMakeFiles/devcore.dir/FixedHash.cpp.obj
[ 9%] Building CXX object libdevcore/CMakeFiles/devcore.dir/Log.cpp.obj
In file included from /home/pureload/ethminer/libdevcore/Log.cpp:28:0:
/home/pureload/ethminer/libdevcore/Guards.h:31:20: error: ‘mutex’ in namespace ‘std’ does not name a type
using Mutex = std::mutex;
^~~~~
/home/pureload/ethminer/libdevcore/Guards.h:32:31: error: ‘mutex’ is not a member of ‘std’
using Guard = std::lock_guardstd::mutex;
^~~
/home/pureload/ethminer/libdevcore/Guards.h:32:31: error: ‘mutex’ is not a member of ‘std’
/home/pureload/ethminer/libdevcore/Guards.h:32:41: error: template argument 1 is invalid
using Guard = std::lock_guardstd::mutex;
^
/home/pureload/ethminer/libdevcore/Guards.h:33:38: error: ‘mutex’ is not a member of ‘std’
using UniqueGuard = std::unique_lockstd::mutex;
^~~
/home/pureload/ethminer/libdevcore/Guards.h:33:38: error: ‘mutex’ is not a member of ‘std’
/home/pureload/ethminer/libdevcore/Guards.h:33:48: error: template argument 1 is invalid
using UniqueGuard = std::unique_lockstd::mutex;
^
In file included from /home/pureload/ethminer/libdevcore/Log.cpp:28:0:
/home/pureload/ethminer/libdevcore/Guards.h:64:10: error: ‘Mutex’ does not name a type
mutable Mutex m_mutex;
^~~~~
/home/pureload/ethminer/libdevcore/Guards.h:65:15: error: ‘condition_variable’ in namespace ‘std’ does not name a type
mutable std::condition_variable m_cv;
^~~~~~~~~~~~~~~~~~
In file included from /home/pureload/ethminer/libdevcore/Log.cpp:28:0:
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘dev::Notified& dev::Notified::operator=(const N&)’:
/home/pureload/ethminer/libdevcore/Guards.h:49:37: error: ‘UniqueGuard’ was not declared in this scope
Notified& operator=(N const& _v) { UniqueGuard l(m_mutex); m_value = _v; m_cv.notify_all(); return this; }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:49:75: error: ‘m_cv’ was not declared in this scope
Notified& operator=(N const& _v) { UniqueGuard l(m_mutex); m_value = _v; m_cv.notify_all(); return this; }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘dev::Notified::operator N() const’:
/home/pureload/ethminer/libdevcore/Guards.h:51:23: error: ‘UniqueGuard’ was not declared in this scope
operator N() const { UniqueGuard l(m_mutex); return m_value; }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait() const’:
/home/pureload/ethminer/libdevcore/Guards.h:53:31: error: ‘UniqueGuard’ was not declared in this scope
void wait() const { N old; { UniqueGuard l(m_mutex); old = m_value; } waitNot(old); }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait(const N&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:54:33: error: ‘UniqueGuard’ was not declared in this scope
void wait(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value == _v;}); }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:54:57: error: ‘m_cv’ was not declared in this scope
void wait(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value == _v;}); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:54:67: error: ‘l’ was not declared in this scope
void wait(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value == _v;}); }
^
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::waitNot(const N&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:55:36: error: ‘UniqueGuard’ was not declared in this scope
void waitNot(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value != _v;}); }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:55:60: error: ‘m_cv’ was not declared in this scope
void waitNot(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value != _v;}); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:55:70: error: ‘l’ was not declared in this scope
void waitNot(N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait(l, &{return m_value != _v;}); }
^
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait(const F&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:56:52: error: ‘UniqueGuard’ was not declared in this scope
template void wait(F const& _f) const { UniqueGuard l(m_mutex); m_cv.wait(l, _f); }
^~~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:56:76: error: ‘m_cv’ was not declared in this scope
template void wait(F const& _f) const { UniqueGuard l(m_mutex); m_cv.wait(l, _f); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:56:86: error: ‘l’ was not declared in this scope
mplate void wait(F const& _f) const { UniqueGuard l(m_mutex); m_cv.wait(l, _f); }
^
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait(std::chrono::duration<_Rep, _Period>) const’:
/home/pureload/ethminer/libdevcore/Guards.h:58:89: error: ‘UniqueGuard’ was not declared in this scope
e <class R, class P> void wait(std::chrono::duration<R, P> _d) const { N old; { UniqueGuar l(m_mutex); old = m_value; } waitNot(_d, old); }
^~~~~~~~~~
In file included from /home/pureload/ethminer/libdevcore/Log.cpp:28:0:
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait(std::chrono::duration<_Rep, _Period>, const N&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:59:93: error: ‘UniqueGuard’ was not declared in this scope
lass R, class P> void wait(std::chrono::duration<R, P> _d, N const& _v) const { UniqueGuar l(m_mutex); m_cv.wait_for(l, _d, &{return m_value == _v;}); }
^~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:59:117: error: ‘m_cv’ was not declared in this scope
it(std::chrono::duration<R, P> _d, N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, &{return m_value == _v;}); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:59:131: error: ‘l’ was not declared in this scope
::duration<R, P> _d, N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, &{return m_value == _v;}); }
^
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::waitNot(std::chrono::duration<_Rep, _Period>, const N&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:60:96: error: ‘UniqueGuard’ was not declared in this scope
s R, class P> void waitNot(std::chrono::duration<R, P> _d, N const& _v) const { UniqueGuar l(m_mutex); m_cv.wait_for(l, _d, &{return m_value != _v;}); }
^~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:60:120: error: ‘m_cv’ was not declared in this scope
ot(std::chrono::duration<R, P> _d, N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, &{return m_value != _v;}); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:60:134: error: ‘l’ was not declared in this scope
::duration<R, P> _d, N const& _v) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, &{return m_value != _v;}); }
^
/home/pureload/ethminer/libdevcore/Guards.h: In member function ‘void dev::Notified::wait(std::chrono::duration<_Rep, _Period>, const F&) const’:
/home/pureload/ethminer/libdevcore/Guards.h:61:102: error: ‘UniqueGuard’ was not declared in this scope
lass P, class F> void wait(std::chrono::duration<R, P> _d, F const& _f) const { UniqueGuar l(m_mutex); m_cv.wait_for(l, _d, _f); }
^~~~~~~~~~
/home/pureload/ethminer/libdevcore/Guards.h:61:126: error: ‘m_cv’ was not declared in this scope
it(std::chrono::duration<R, P> _d, F const& _f) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, _f); }
^~~~
/home/pureload/ethminer/libdevcore/Guards.h:61:140: error: ‘l’ was not declared in this scope
::duration<R, P> _d, F const& _f) const { UniqueGuard l(m_mutex); m_cv.wait_for(l, _d, _f); }
^
/home/pureload/ethminer/libdevcore/Log.cpp: At global scope:
/home/pureload/ethminer/libdevcore/Log.cpp:36:1: error: ‘mutex’ does not name a type
mutex x_logOverride;
^~~~~
/home/pureload/ethminer/libdevcore/Log.cpp: In constructor ‘dev::LogOutputStreamBase::LogOutputStreamBase(const char
, const std::type_info
, unsigned int, bool)’:
/home/pureload/ethminer/libdevcore/Log.cpp:63:2: error: ‘Guard’ was not declared in this scope
Guard l(x_logOverride);
^~~~~
libdevcore/CMakeFiles/devcore.dir/build.make:113: recipe for target 'libdevcore/CMakeFiles/devcore.dir/Log.cpp.obj' failed
make[2]: *** [libdevcore/CMakeFiles/devcore.dir/Log.cpp.obj] Error 1
CMakeFiles/Makefile2:154: recipe for target 'libdevcore/CMakeFiles/devcore.dir/all' failed
make[1]: *** [libdevcore/CMakeFiles/devcore.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Does anyone has experience building ethminer using mingw32 or can point out what did I do wrong?

Thanks.

@DeadManWalkingTO
Copy link
Contributor

DeadManWalkingTO commented Feb 5, 2018

Hi...
NVidia does not support MinGW.

From NVidia CUDA Forum:
CUDA with MinGW How to get CUDA running under MinGW?

You need Microsoft Build Tools 2015 and CUDA Toolkit 9.1 to compile ethminer.

If you do not want to leave the MinGW environment first you have to install the above and then you can run the following script.

build-ethminer.sh

#Start
clear
echo "Start"
#goto Home
cd ~/
#Remove Project Directory
rm -rf ethminer
#Download ethminer
git clone /~https://github.com/ethereum-mining/ethminer.git
#Enter Project Directory
cd ethminer/
#Make Build Directory
mkdir build
#Enter Build Directory
cd build/
#CMAKE
echo "Build"
cmake .. -G "Visual Studio 14 2015 Win64" -T v140,host=x64 -DETHASHCUDA=ON -DETHASHCL=ON -DETHSTRATUM=ON -DAPICORE=ON 
#Build
echo "Release"
cmake --build . --config Release
echo "End Build-Release"
#Copy EXE to Home Directory
cp ./ethminer/Release/*.exe ~/
#Enter Home Directory
cd ~/
#End

@efrasyad
Copy link
Author

efrasyad commented Feb 5, 2018

Thanks for the advice, but I'm running the build from linux machine using default OpenCL settings.
Looking at your script which requires VS2015 which is true if building in windows system.

@chfast
Copy link
Contributor

chfast commented Feb 26, 2018

I'm not sure if this is possible, but check out this toolchain file for this case from Polly: /~https://github.com/ruslo/polly/blob/master/linux-mingw-w64.cmake.

@efrasyad
Copy link
Author

I have test with Polly as well, but i still have the same error. Tested in ubuntu and debian.
I'll just get the build from AppVeyor as it will always includes the latest commit.

Thanks for all the help. And Thank you for making ethminer better on every release!

@DeadManWalkingTO
Copy link
Contributor

Try this script ETHminerBuildScriptDmW

  • Windows version (ETHminerBuildScriptDmW.bat)
  • Linux version (ETHminerBuildScriptDmW.bash)
  • MinGW version (ETHminerBuildScriptDmW.sh)

@efrasyad
Copy link
Author

efrasyad commented Feb 28, 2018

Hi @DeadManWalkingTO ,
this is what i got after running mingw script in Ubuntu system:

`:~/ETHminerBuildScriptDmW-1.0.0$ ./ETHminerBuildScriptDmW.sh
###############################################################################
#                                                                             #
#  ETHminerBuildScriptDmW Version 1.2.5                                       #
#                                                                             #
#  AUTHOR: DeadManWalking  (DeadManWalkingTO-GitHub)                          #
#                                                                             #
###############################################################################

ETHminerBuildScriptDmW
1. Auto Remove old Ethminer's Directory
2. Auto Clone (Download) latest Master of Ethminer
3. Auto Configure Ethminer
4. Auto Build Ethminer

Press any key to continue...

==================================================
Change Directory to Home
Done
==================================================

==================================================
Remove old Ethminer's Directory
Done
==================================================

==================================================
Download Ethminer
Cloning into 'ethminer'...
remote: Counting objects: 74555, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 74555 (delta 4), reused 8 (delta 3), pack-reused 74533
Receiving objects: 100% (74555/74555), 51.32 MiB | 1.42 MiB/s, done.
Resolving deltas: 100% (55488/55488), done.
Done
==================================================

==================================================
Change Directory to Ethminer's
Done
==================================================

==================================================
Make Build Directory
Done
==================================================

==================================================
Change Directory to Build
Done
==================================================

==================================================
Configure Ethminer
CUDA build ON -- DETHASHCUDA=ON
OpenCL build ON -- DETHASHCL=ON
Stratum build ON -- DETHSTRATUM=ON
API build ON -- DAPICORE=ON
CMake Error: Could not create named generator Visual Studio 14 2015 Win64

Generators
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  KDevelop3                    = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles   = Generates KDevelop 3 project files.

Done
==================================================

==================================================
Build Ethminer
Error: could not load cache
Done
==================================================

==================================================
Copy ethminer.exe to Home Directory
cp: cannot stat './ethminer/Release/*.exe': No such file or directory
Done
==================================================

==================================================
Change Directory to Home
Done
==================================================

==================================================
ETHminerBuildScriptDmW was completed
==================================================
Press any key to continue...
`

I know you didn't mention about which system this script should be run in the github page.

@DeadManWalkingTO
Copy link
Contributor

@efrasyad after cable add MinGW have issues with compile.
I try to fix it.
Check #817. Please reply there.
Thank you.

@efrasyad
Copy link
Author

efrasyad commented Mar 1, 2018

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants