How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS

UPDATE 7/7/13: If you want to use Catalyst drivers version 12.8 you will find that X won’t start (error msg: /usr/lib/xorg/modules/drivers/fglrx_drv.so: undefined symbol: noXFree86DRIExtension) if you installed CentOS 6.4. Catalyst > 12.8 will work fine. To fix that, you can downgrade to the Xorg version that ships with CentOS 6.3:

yum --disablerepo=\* --enablerepo=C6.3\* downgrade xorg\*
(You may also need to do: yum remove xorg-x11-drv-modesetting)

Do this before you install Catalyst!
UPDATE END.

Here’s my how-to for cgminer / AMD Radeon drivers under CentOS 6.4, 32bit in this example. You can basically copy & paste every line and you should end up with a working mining rig.

Install required packages:

yum install wget system-config-firewall-tui openssh-clients kernel-devel-2.6.32-358.el6.i686 libcurl-devel ncurses-devel compat-libstdc++-33 screen xterm
yum groupinstall "X Window System" "Development tools"

Download and extract cgminer 3.7.2 – later versions don’t support GPU mining:

cd /root
wget http://ck.kolivas.org/apps/cgminer/3.7/cgminer-3.7.2.tar.bz2
tar xjvf cgminer-3.7.2.tar.bz2

Download AMD APP and ADL SDKs for cgminer compilation from:

AMD APP SDK: http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads
AMD ADL SDK: http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk

Install AMD APP SDK:

cd /opt
tar xvzf /root/AMD-APP-SDK-v2.8-lnx32.tgz
cd /
tar xvzf /opt/icd-registration.tgz
cd /opt
tar xvzf AMD-APP-SDK-v2.8-RC-lnx32.tgz
ln -s /opt/AMD-APP-SDK-v2.8-RC-lnx32/include/CL /usr/include
ln -s /opt/AMD-APP-SDK-v2.8-RC-lnx32/lib/x86/* /usr/lib/

Install AMD ADL SDK:

cd /root
mkdir ADL
mv ADL_SDK_5.0.zip ADL
cd ADL
unzip ADL_SDK_5.0.zip
cp include/*.h /root/cgminer-3.7.2/ADL_SDK

Build cgminer for Litecoin (with scrypt support):

cd /root/cgminer-3.7.2
CFLAGS="-O2 -Wall -march=native -I/opt/AMD-APP-SDK-v2.8-RC-lnx32/include" LDFLAGS="-L/opt/AMD-APP-SDK-v2.8-RC-lnx32/lib/x86" ./configure --enable-scrypt
make
make install
(if you want to run the cgminer binary from everywhere)

Install fglrx AMD graphics card drivers:

AMD Catalyst driver (fglrx) from: http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx

(e.g.

cd /root
wget http://www2.ati.com/drivers/linux/amd-catalyst-13.4-linux-x86.x86_64.zip

)

unzip amd-catalyst-13.4-linux-x86.x86_64.zip
chmod 700 amd-catalyst-13.4-linux-x86.x86_64.run
./amd-catalyst-13.4-linux-x86.x86_64.run --buildpkg RedHat/RHEL6
rpm -Uvh fglrx_p_i_c-12.104-1.i386.rpm

reboot

amdconfig --adapter=all --initial

If your mining rig is headless you can start X in a screen session:

screen
xinit

Detach screen session: CTRL+A+D

Create cgminer.sh and put this into the file:

export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export DISPLAY=:0

cgminer --scrypt ...your parameters go here...

Make it executable:

chmod 700 cgminer.sh

Configure cgminer parameters as needed and start mining (./cgminer.sh). Done!

14 thoughts on “How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS

  1. spineless

    I am getting an error when I install cgminer. I downloaed the drivers and the GCminer and was about to start installing GCminer. I entered the command ./autogen.sh and I get the following error:


    configure.ac:39: error: possibly undefined macro: AC_PROG_LIBTOOL
    If this token and others are legitimate, please use m4_pattern_allow.
    See the Autoconf documentation.
    autoreconf: /usr/bin/autoconf failed with exit status: 1
    Configuring...
    ./autogen.sh: line 10: /root/cgminer/configure: No such file or directory

    Not sure where to start with this one. Any ideas?

    Reply
    1. univ Post author

      Hi! Wow, your comment is the 2nd legitimate comment ever in my blog. :-) Anyway, it seems like not all development tools required for compiling from source were installed. Are you sure you executed the “yum install …” line? In particular: yum install “Development tools”
      Let me know if this helps or not.

      Reply
  2. homer

    Wow! a blogger who is arrogant to its readers!
    Wanna be the third:

    Q: What happened to CPU and GPU mining?
    A: Their efficiency makes them irrelevant in the bitcoin mining world today
    and the author has no interest in supporting alternative coins that are better
    mined by these devices.

    So, how could the Radeon Driver make sense?

    Felix

    Reply
    1. univ Post author

      I think you misunderstood my comment. His comment was the 2nd legitimate comment ever, all other comments were spam so far.

      Reply
  3. Pingback: Help with a Gigabyte GV-R928XOC-3GD REV2 | COINREGIME.COM

  4. Portos

    Ops! Fulfilled your instructions, but starting ./cgminer -n reports:

    FATAL: Module fglrx not found.
    Error! Fail to load fglrx kernel module! Maybe you can switch to root user to load kernel module directly
    FATAL: Module fglrx not found.
    Error! Fail to load fglrx kernel module! Maybe you can switch to root user to load kernel module directly
    [2014-01-18 08:05:22] CL Platform 0 vendor: Advanced Micro Devices, Inc.
    [2014-01-18 08:05:22] CL Platform 0 name: AMD Accelerated Parallel Processing
    [2014-01-18 08:05:22] CL Platform 0 version: OpenCL 1.2 AMD-APP (1214.3)
    [2014-01-18 08:05:22] Error -1: Getting Device IDs (num)
    [2014-01-18 08:05:22] clDevicesNum returned error, no GPUs usable
    [2014-01-18 08:05:22] 0 GPU devices max detected

    Why?

    Reply
    1. univ Post author

      Hm, for some reason the kernel driver fglrx is not being loaded. As root, try

      modprobe fglrx

      and afterwards run

      amdconfig –lsa

      to see if your GPUs are found then.

      Reply
    1. univ Post author

      Hmm. It could be that either fglrx gets not properly loaded, or that fglrx is fine by itself and your GPUs are really not found. Are you 100% sure the GPUs are working in this box? If you have only GPU and that’s the one where you have hooked up your monitor to, then that’s a yes. :) I would boot the box, and then check “dmesg” to see what the output was when fglrx tried to load. Did it even try to load?

      Reply
    2. univ Post author

      PS: The fact that “modprobe fglrx” didn’t produce any output is good. Looks like it was loaded then. But make sure it is really there by running “lsmod” or “lsmod | grep fglrx”.

      Reply
  5. Vital

    hi. i have this:
    [root@p4-36 cgminer-3.7.2]# CFLAGS=”-O2 -Wall -march=native -I/AMD-APP-SDK-v2.8-RC-lnx32/include” LDFLAGS=”-L/AMD-APP-SDK-v2.8-RC-lnx32/lib/x86″ ./configure –enable-scrypt
    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking target system type… x86_64-unknown-linux-gnu
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for a thread-safe mkdir -p… /bin/mkdir -p
    checking for gawk… gawk
    checking whether make sets $(MAKE)… yes
    checking whether make supports nested variables… yes
    checking for style of include used by make… GNU
    checking for gcc… gcc
    checking whether the C compiler works… no
    configure: error: in `/root/cgminer-3.7.2′:
    configure: error: C compiler cannot create executables
    See `config.log’ for more details

    before and after this, evrth was good.

    as a result – I cant run cgminer:
    [root@p4-36 cgminer-3.9.0]# ./cgminer.sh
    ./cgminer.sh: line 5: cgminer: command not found

    any suggestions?

    Reply
    1. univ Post author

      Strange. “checking whether the C compiler works… no” means gcc is there but not working properly. Did you follow my installation instructions about the required packages and were all packages successfully installed? Double-check whether they were all installed! Make sure yum install “Development tools” finishes without problems.

      Is this CentOS 32bit? (Show output of “uname -a” and “cat /etc/issue”)

      Did you really extract the AMD APP SDK in / instead of /opt?

      I noticed when you tried to execute cgminer.sh you are in a directory called cgminer-3.9.0 instead of before cgminer-3.7.2. cgminer-3.9.0 does not support GPU mining, so throw it away.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


6 + six =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>