NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.42k stars 14.37k forks source link

Update cgminer #25039

Closed chris-martin closed 4 years ago

chris-martin commented 7 years ago

Our cgminer package is way out of date. Cgminer has dropped support for CPU and GPU mining since they're now irrelevant to Bitcoin, and is now only an ASIC/FPGA miner. So we'll need to remove all the GPU options from the cgminer service.

When you build cgminer, you have to specify what kind of hardware you're building for by passing exactly one of these compile flags:

  --enable-ants1          Compile support for Antminer S1 Bitmain (default
                          disabled)
  --enable-ants2          Compile support for Antminer S2 Bitmain (default
                          disabled)
  --enable-avalon         Compile support for Avalon (default disabled)
  --enable-avalon2        Compile support for Avalon2/3 (default disabled)
  --enable-avalon4        Compile support for Avalon4/4.1/6 (default disabled)
  --enable-avalon7        Compile support for Avalon7 (default disabled)
  --enable-bab            Compile support for BlackArrow Bitfury (default
                          disabled)
  --enable-bflsc          Compile support for BFL ASICs (default disabled)
  --enable-bitforce       Compile support for BitForce FPGAs (default
                          disabled)
  --enable-bitfury        Compile support for BitFury ASICs (default disabled)
  --enable-bitmine_A1     Compile support for Bitmine.ch A1 ASICs (default
                          disabled)
  --enable-blockerupter   Compile support for ASICMINER BlockErupter Tube/Prisma
              (default disabled)
  --enable-cointerra      Compile support for Cointerra ASICs (default disabled)
  --enable-drillbit       Compile support for Drillbit BitFury ASICs (default
                          disabled)
  --enable-hashfast       Compile support for Hashfast (default disabled)
  --enable-icarus         Compile support for Icarus (default disabled)
  --enable-klondike       Compile support for Klondike (default disabled)
  --enable-knc            Compile support for KnC miners (default disabled)
  --enable-minion         Compile support for Minion BlackArrow ASIC (default
                          disabled)
  --enable-modminer       Compile support for ModMiner FPGAs(default disabled)
  --enable-sp10           Compile support for Spondoolies SP10 (default
                          disabled)
  --enable-sp30           Compile support for Spondoolies SP30 (default
                          disabled)

So I don't know, does it makes sense to have a cgminer derivation for each of these?

Mic92 commented 7 years ago

Are you sure, they are mutual exclusive?

archlinux> cgmanager --help
cgminer 4.9.2
Built with avalon avalon2 avalon4 bflsc bitfury cointerra drillbit hashfast icarus klondike mining support.

It seems it support multiple targets.

chris-martin commented 7 years ago

Oh, I must be wrong. I tried compiling with a handful of them and it failed. Perhaps only a few of them are mutually exclusive, or perhaps I misunderstood entirely.

FRidh commented 7 years ago

If they are not mutually exclusive, then don't bother with these flags, and just use the defaults. If users want to support other hardware, they can override the configureFlags. But, if you really do want to make it even easier, I could imagine a compileFlags ? [ ] which is a list of strings (e.g. [ "ants1" "ants2" "icarus"]).

Also, from their README

Q: What should I build in for a generic distribution binary?
A: There are a number of drivers that expect to be used on dedicated standalone
hardware. That said, the drivers that are designed to work generically with
USB on any hardware are the following:

--enable-avalon
--enable-avalon2
--enable-avalon4
--enable-avalon7
--enable-bflsc
--enable-bitfury
--enable-cointerra
--enable-drillbit
--enable-hashfast
--enable-hashratio
--enable-icarus
--enable-klondike
ambrop72 commented 5 years ago

I just stumbled across cgminer while looking for things that set LD_LIBRARY_PATH=/run/opengl-driver/lib in order to turn it into RUNPATH (related to #60985). I then saw that the current cgminer package uses amdappsdk and on my NVidia system this doesn't do anything useful (cgminer --ndevs fails). Replacing the AMD dependencies with ocl-headers and ocl-icd fixed that (at least --ndevs works, testing actual functions seems nontrivial):

/cgminer/bin/cgminer --ndevs
 [2019-05-21 19:22:02] CL Platform 0 vendor: NVIDIA Corporation                    
 [2019-05-21 19:22:02] CL Platform 0 name: NVIDIA CUDA                    
 [2019-05-21 19:22:02] CL Platform 0 version: OpenCL 1.2 CUDA 10.1.173                    
 [2019-05-21 19:22:02] Platform 0 devices: 1                    
 [2019-05-21 19:22:02]  0       GeForce GTX 1060                    
 [2019-05-21 19:22:02] 1 GPU devices max detected

Should I submit a PR to replace AMD deps? Also cgminer is the only package in nixpkgs using amdappsdk and amdadlsdk which are deprecated anyway, so we could remove those then.

Does anyone even use this version of cgminer at all? If we think not we could remove the current cgminer package.

prusnak commented 4 years ago

Fixed in https://github.com/NixOS/nixpkgs/pull/61823