Monday, September 26, 2011

Finally, cgminer install tutorial

I think that cgminer is the most advanced miner to date.  It doesn't push the hardware as far as I would like (it doesn't use 100% of the GPU) but it can manage multiple pool and use the longpoll from the fastest pool, so you will have a better mining uptime with this miner than with the other! I never experienced any "queue empty, miner is idle" with this miner.  Today the bitcoin value is 5$ so you need to get every hash as possible! The little drawback is that I was not yet successfull to make cgminer to use 99% of each gpu.

But, cgminer can set the fan, the clock and even overclock your GPU.  This is very nice!

So let's begin!

1. To manage your gpu fanspeed and clocking, you will need the ADL SDK (AMD Display Library)

2. Install missing softwares
$ sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm libtool

3. get the latest cgminer sourcecode :
$ git clone git:// cgminer

4. enable ADL (control of the inner functions of the gpu like clocking, voltage, fan speed...)
$ mkdir ADL_SDK
$ cd ADL_SDK
$ mv ../ .
$ unzip
$ cp include/* ../cgminer/ADL_SDK

5. Compilation
$ cd cgminer

$ ./
$ CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure

if you get the following error :
/usr/bin/ld: cgminer-adl.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: note: 'dlclose@@GLIBC_2.2.5' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/ so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/ could not read symbols: Invalid operation

remove the ADL directory, you must disable ADL.

! be sure the GPU and ADL are enabled !

$ make

6. Testing (to see the number of gpu the software sees)
$ export DISPLAY=:0   #(use this command only if you have more than one card)
$ ./cgminer -n

If the number does not represent the number of gpu you own, there is a problem, you should have miss a step.  Or the git repository could be broken.  Try an older tag here :

7. be up to date!
$ stop the miner
$ cd ~/cgminer
$ git pull
and then recompile (follow the step 5)

There is a lot of commands for this software.  The best way to learn is to read the documentation from the git repository, it is one of the best documentation I've read!


  1. Thanks for this tutorial. It was very helpful.

    After step 5, some people may need to do the following:

    $ export DISPLAY=:0

    or, alternatively, replace step 6 with the following, which has the same effect:

    $ DISPLAY=:0 ./cgminer -n

    1. Thank you, this was explained in the steps to setup the computer. I have added the command in the post :-) Thank you for your feedback!

  2. I am having issues getting this to work.
    I followed your instructions and with these,

    Here are the commands I run and my results. Can you direct me to a solution to solve this. Thanks.
    RUN $CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure --enable-bitforce --enable-avalon

    Configuration Options Summary:

    curses.TUI...........: FOUND: -lncurses
    OpenCL...............: FOUND. GPU mining support enabled
    scrypt...............: Disabled
    ADL..................: SDK found, GPU monitoring support enabled

    Avalon.ASICs.........: Enabled
    BFL.ASICs............: Disabled
    BitForce.FPGAs.......: Enabled
    Icarus.FPGAs.........: Disabled
    ModMiner.FPGAs.......: Disabled
    Ztex.FPGAs...........: Disabled

    Compilation............: make (or gmake)
    CFLAGS...............: -O2 -Wall -march=native -I /opt/AMDAPP/include/ -I/usr/include/libusb-1.0
    LDFLAGS..............: -L/opt/AMDAPP/lib/x86_64 -lpthread
    LDADD................: -ldl -lcurl compat/jansson/libjansson.a -lpthread -lOpenCL -lm -lusb-1.0

    Installation...........: make install (as root if needed, with 'su' or 'sudo')
    prefix...............: /usr/local

    RUN $make

    RUN $ DISPLAY=:0 ./cgminer -n
    [2013-08-13 16:45:02] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2013-08-13 16:45:02] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2013-08-13 16:45:02] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)
    [2013-08-13 16:45:02] Error -1: Getting Device IDs (num)
    [2013-08-13 16:45:02] clDevicesNum returned error, no GPUs usable
    [2013-08-13 16:45:02] 0 GPU devices max detected
    [2013-08-13 16:45:02] USB all: found 18 devices - listing known devices
    [2013-08-13 16:45:02] No known USB devices

    1. Bill,

      To help you, I would need to know your hardware. Are you using GPU mining or asic / fpga mining ?

      Thank you

  3. I got

    xubuntu@xubuntu:~/cgminer$ ./cgminer -n
    Segmentation fault (core dumped)

    any idea?

    1. JS,

      On your blog I can see that you solved your problem. For my reader I will add details. You are right that in latest catalyst driver they remove support for older hardware.

      As seen on :
      ATI Radeon Card for 5XXX to 6XXX
      Use: AMD-APP-SDK v2.5 and Catalyst 11.11

  4. when running ./ I got the following error: error: possibly undefined macro: AC_PROG_LIBTOOL

    fixed it by running the following command first:

    sudo apt-get install libtool

    1. Thank you for your comment. I will add to install libtool to my tutorial.