Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethminer: init at 0.18.0-rc.0 #55422

Merged
merged 5 commits into from May 1, 2019
Merged

ethminer: init at 0.18.0-rc.0 #55422

merged 5 commits into from May 1, 2019

Conversation

nand0p
Copy link
Contributor

@nand0p nand0p commented Feb 7, 2019

  • updates jsoncpp
  • adds ethash and cli11
  • tested on NixOS

@symphorien
Copy link
Member

Have you tried without hunter ? https://github.com/ethereum-mining/ethminer/blob/master/docs/BUILD.md#disable-hunter

The dependencies they list (cmake and others) seem reasonable.

@nand0p
Copy link
Contributor Author

nand0p commented Feb 9, 2019

Have you tried without hunter ? https://github.com/ethereum-mining/ethminer/blob/master/docs/BUILD.md#disable-hunter

i was not successful in decoupling hunter. it appears DHUNTER_ENABLED=OFF did not work for me. perhaps someone more skilled in nix could fixup this code iteratively.

@symphorien
Copy link
Member

symphorien commented Feb 9, 2019

You mean:

cmakeFlags = [ "-DHUNTER_ENABLED=OFF" ];

?

@nand0p
Copy link
Contributor Author

nand0p commented Feb 13, 2019

CMake Error at CMakeLists.txt:64 (find_package):
  Could not find a package configuration file provided by "jsoncpp" with any
  of the following names:

    jsoncppConfig.cmake
    jsoncpp-config.cmake

  Add the installation prefix of "jsoncpp" to CMAKE_PREFIX_PATH or set
  "jsoncpp_DIR" to a directory containing one of the above files.  If
  "jsoncpp" provides a separate development package or SDK, be sure it has
  been installed.

perhaps i need to introduce a new jsoncpp package version that provides a jsoncpp-config.cmake file?

@symphorien
Copy link
Member

here is an expression which contains jsoncpp-config.cmake:

jsoncpp.overrideAttrs(old: {
  cmakeFlags= (old.cmakeFlags or []) ++ ["-DJSONCPP_WITH_CMAKE_PACKAGE=ON"];
})

This change seems benign enough to me that you can change it globally in pkgs/development/libraries/jsoncpp/default.nix instead of overriding it only for ethminer.

@nand0p
Copy link
Contributor Author

nand0p commented Feb 16, 2019

$ nix-build -A ethminer     
these derivations will be built:
  /nix/store/jy4m3y3bvwj1v0vm7ciy3ydrbj4svi2j-ethminer-0.17.0.drv
building '/nix/store/jy4m3y3bvwj1v0vm7ciy3ydrbj4svi2j-ethminer-0.17.0.drv'...
unpacking sources
unpacking source archive /nix/store/myajjwbj782daxz6h69j9c6m4dq9b1m8-source
source root is source
patching sources
configuring
/build/source/build /build/source
-- [cable ] Cable 0.2.14 initialized
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /nix/store/bzxfiz7l38g7b4d8rdlf4wc43fklah5h-gcc-wrapper-7.4.0/bin/gcc
-- Check for working C compiler: /nix/store/bzxfiz7l38g7b4d8rdlf4wc43fklah5h-gcc-wrapper-7.4.0/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /nix/store/bzxfiz7l38g7b4d8rdlf4wc43fklah5h-gcc-wrapper-7.4.0/bin/g++
-- Check for working CXX compiler: /nix/store/bzxfiz7l38g7b4d8rdlf4wc43fklah5h-gcc-wrapper-7.4.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [cable ] Build type: Release
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.67.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   chrono
--   date_time
--   atomic
----------------------------------------------------------------------------
-- CMake 3.12.1
-- Build Release / Linux
----------------------------------------------------------------- components
-- ETHASHCL         Build OpenCL components                      ON
-- ETHASHCUDA       Build CUDA components                        ON
-- ETHASHCPU        Build CPU components (only for development)  OFF
-- ETHDBUS          Build D-Bus components                       ON
-- APICORE          Build API Server components                  ON
-- BINKERN          Install AMD binary kernels                   ON
-- DEVBUILD         Build with dev logging                       OFF
----------------------------------------------------------------------------

-- Performing Test ffunction-sections
-- Performing Test ffunction-sections - Success
-- Performing Test fdata-sections
-- Performing Test fdata-sections - Success
-- Performing Test Wl,--gc-sections
-- Performing Test Wl,--gc-sections - Success
-- Found Git: /nix/store/qyp22r9zfhpiykkj57rj6jcd6iwgdccy-git-2.19.2/bin/git (found version "2.19.2")
-- Found CUDA: /nix/store/qqpzxqw5nxxqyxlbjb9rw4sx8m2nfy8m-cudatoolkit-9.2.148.1 (found version "9.2")
-- Found OpenSSL: /nix/store/zxi65ww7bws5lqlxgljq0p2j6pd4waiv-openssl-1.0.2q/lib/libcrypto.so (found version "1.0.2q")
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - found
-- Found OpenCL: /nix/store/cp6nlngvrhs5fbbkjh4c4dpafxzrxr8d-ocl-icd-2.2.10/lib/libOpenCL.so (found version "2.2")
-- Found PkgConfig: /nix/store/zq9pg3xg7d1v48ac10icw2li8qyjwqiz-pkg-config-0.29.2/bin/pkg-config (found version "0.29.2")
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.12.12
-- Configuring done
CMake Error in libethcore/CMakeLists.txt:
  Imported target "ethash::ethash" includes non-existent path

    "/nix/store/4bhcm2l7385z8rpbl1lkjpq61r6pppip-ethash-0.4.2/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in libethcore/CMakeLists.txt:
  Imported target "ethash::ethash" includes non-existent path

    "/nix/store/4bhcm2l7385z8rpbl1lkjpq61r6pppip-ethash-0.4.2/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in libpoolprotocols/CMakeLists.txt:
  Imported target "ethash::ethash" includes non-existent path

    "/nix/store/4bhcm2l7385z8rpbl1lkjpq61r6pppip-ethash-0.4.2/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in libpoolprotocols/CMakeLists.txt:
  Imported target "ethash::ethash" includes non-existent path

    "/nix/store/4bhcm2l7385z8rpbl1lkjpq61r6pppip-ethash-0.4.2/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in ethminer/CMakeLists.txt:
  Imported target "CLI11::CLI11" includes non-existent path

    "/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in ethminer/CMakeLists.txt:
  Imported target "CLI11::CLI11" includes non-existent path

    "/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



-- Generating done
-- Build files have been written to: /build/source/build
builder for '/nix/store/jy4m3y3bvwj1v0vm7ciy3ydrbj4svi2j-ethminer-0.17.0.drv' failed with exit code 1
error: build of '/nix/store/jy4m3y3bvwj1v0vm7ciy3ydrbj4svi2j-ethminer-0.17.0.drv' failed

ethash and cli11 are apparently not exporting the correct include path. any ideas here?

@symphorien
Copy link
Member

I think the problem is that you override the default configure, build and or installPhase.
As soon as cmake is in nativeBuildInputs (or buildInputs, but don't do that) the default phases will
use cmake automagically for configuring, building and installing. This will result in the correct hierarchy in $out:
with this diff

diff --git a/pkgs/development/tools/misc/cli11/default.nix b/pkgs/development/tools/misc/cli11/default.nix
index 47c5b7e2a9d..258e5af0ee7 100644
--- a/pkgs/development/tools/misc/cli11/default.nix
+++ b/pkgs/development/tools/misc/cli11/default.nix
@@ -13,22 +13,11 @@ stdenv.mkDerivation rec {
     #fetchSubmodules = true;
   };
 
-  buildInputs = [
+  nativeBuildInputs = [
     cmake
   ];
 
   cmakeFlags = [
     "-DCLI11_TESTING=OFF"
   ];
-
-  buildPhase = ''
-    cmake . $cmakeFlags
-  '';
-
-  installPhase = ''
-    mkdir -pv $out
-    cp -rv * $out
-    cp -v CMakeFiles/Export/lib/cmake/CLI11/CLI11Config.cmake $out/cli11-config.cmake
-  '';
-
 }

I get the very clean hierarchy

result
├── include
│   └── CLI
│       ├── App.hpp
│       ├── CLI.hpp
│       ├── ConfigFwd.hpp
│       ├── Config.hpp
│       ├── Error.hpp
│       ├── FormatterFwd.hpp
│       ├── Formatter.hpp
│       ├── Macros.hpp
│       ├── Optional.hpp
│       ├── Option.hpp
│       ├── Split.hpp
│       ├── StringTools.hpp
│       ├── Timer.hpp
│       ├── TypeTools.hpp
│       ├── Validators.hpp
│       └── Version.hpp
└── lib
    └── cmake
        └── CLI11
            ├── CLI11Config.cmake
            └── CLI11ConfigVersion.cmake

for cli11 instead of

result
├── cli11-config.cmake
├── CLI11ConfigVersion.cmake
├── CLI11Targets.cmake
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.12.1
│   │   ├── CMakeCXXCompiler.cmake
│   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   ├── CMakeSystem.cmake
│   │   └── CompilerIdCXX
│   │       ├── a.out
│   │       ├── CMakeCXXCompilerId.cpp
│   │       └── tmp
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeOutput.log
│   ├── CMakeTmp
│   ├── Export
│   │   └── lib
│   │       └── cmake
│   │           └── CLI11
│   │               └── CLI11Config.cmake
│   ├── feature_tests.bin
│   ├── feature_tests.cxx
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── CPackConfig.cmake
├── CPackSourceConfig.cmake
├── examples
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── enum.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── formatter.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── groups.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── inter_argument_order.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── modhelp.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── nested.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── prefix_command.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── progress.marks
│   │   ├── simple.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── subcom_help.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   ├── subcommands.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   └── progress.make
│   │   └── validators.dir
│   │       ├── build.make
│   │       ├── cmake_clean.cmake
│   │       ├── DependInfo.cmake
│   │       ├── depend.make
│   │       ├── flags.make
│   │       ├── link.txt
│   │       └── progress.make
│   ├── cmake_install.cmake
│   ├── Makefile
│   └── subcom_in_files
│       ├── CMakeFiles
│       │   ├── CMakeDirectoryInformation.cmake
│       │   ├── progress.marks
│       │   └── subcommand_main.dir
│       │       ├── build.make
│       │       ├── cmake_clean.cmake
│       │       ├── DependInfo.cmake
│       │       ├── depend.make
│       │       ├── flags.make
│       │       ├── link.txt
│       │       └── progress.make
│       ├── cmake_install.cmake
│       └── Makefile
└── Makefile

Note how the automatic phases have installed the missing /include directory.

I expect that if you remove all your custom buildPhases, configurePhases and installPhases, everything should work well.
In case the default installPhase misses a file (for example) check if cmake has flags to install it, or use postInstall to install the file manually, instead of overriding the whole installPhase.
I hope this is helpful.

Copy link
Member

@symphorien symphorien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. Looks good to me.

@nand0p
Copy link
Contributor Author

nand0p commented Feb 27, 2019

@cpages @ttuegel @infinisil @symphorien Anything i can do to help get this merged in? Thanks!

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have a separate commit for each package you add, and a final commit for the NixOS module.

pkgs/tools/misc/ethminer/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/ethminer/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/misc/cli11/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/ethash/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/ethminer/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
@nand0p nand0p changed the title ethminer: init at 0.18.0-alpha.3 WIP ethminer: init at 0.18.0-rc.0 Mar 8, 2019
@nand0p nand0p force-pushed the ethminer branch 3 times, most recently from 9385a28 to 8a5fa5b Compare March 11, 2019 02:53
@nand0p nand0p force-pushed the ethminer branch 2 times, most recently from 14c6733 to 4e387b2 Compare March 21, 2019 21:50
@nand0p nand0p changed the title WIP ethminer: init at 0.18.0-rc.0 ethminer: init at 0.18.0-rc.0 Mar 21, 2019
@nand0p
Copy link
Contributor Author

nand0p commented Mar 21, 2019

@infinisil ready_for_review

nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/ethash/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
@infinisil
Copy link
Member

Oh and the last commit should be named nixos/ethminer: init

Fernando J Pando added 4 commits April 20, 2019 09:23
- Tested on NixOS
- Tested on NixOS
- Tested on NixOS
@nand0p
Copy link
Contributor Author

nand0p commented Apr 20, 2019

@infinisil ready_for_review

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't just mark things as resolved if you haven't resolved them!

nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/ethminer.nix Outdated Show resolved Hide resolved
@nand0p
Copy link
Contributor Author

nand0p commented Apr 26, 2019

@infinisil ready_for_review

- Tested on NixOS
@infinisil infinisil merged commit b6a6162 into NixOS:master May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants