Wednesday, September 16, 2015

opencv pkgconfig error


To add the correct path to your bashrc you can do the following steps
  1. sudo find / -name "opencv.pc" -type f
  2. notice the directory output from 1. (without filename)
  3. open /etc/bash.bashrc sudo vi /etc/bash/bash.bashrc
  4. find and edit or add the following lines
    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/your/path/from/#1
    export PKG_CONFIG_PATH
  5. save your file :wq
  6. logout and login again to active the changes

Install nvidia driver in Centos 7

I tested it on a fresh CentOS 7 installation (using the GNOME Desktop option) and it was pretty straightforward.

Import the rpm GPG key


rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Install ELRepo


yum install http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Remove Glamor


This is an open source Xorg graphics driver that may cause conflicts with proprietary drivers. If the package is installed it needs to be removed.
yum remove xorg-x11-glamor
  1. Disable Nouveau Driver

  2. open “/etc/modprobe.d/blacklist.conf in your favourite editor and add blacklist nouveau”, ofcourse without double-quotes.

  3. blacklist nouveau

  4. Next create a new initramfs file and taking backup of existing.

  5. # mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
  6. # dracut -v /boot/initramfs-$(uname -r).img $(uname -r)

  7. Reboot the machine. Login into command mode using Alt+F4 / ALT+F5 as root.

Install nvidia-detect [ optional ]


This is a small utility which detects graphic cards, suggests specific driver versions and checks compatibility with Xorg.
yum install nvidia-detect
Sample output:
nvidia-detect -x
Probing for supported NVIDIA devices...
[10de:11c0] NVIDIA Corporation GK106 [GeForce GTX 660]
This device requires the current 340.32 NVIDIA driver kmod-nvidia
[10de:11c0] NVIDIA Corporation GK106 [GeForce GTX 660]
This device requires the current 340.32 NVIDIA driver kmod-nvidia

Checking ABI compatibility with Xorg Server...
Xorg Video Driver ABI detected: 15
ABI compatibility check passed

Install kmod-nvidia


When running a 64bit OS, the 32bit Nvidia libraries may also be needed for compatibility, I always install them. The good thing is that kmod-nvidia also disables nouveauautomatically, so no more manually tweaking modprobe and grub :)
yum install kmod-nvidia nvidia-x11-drv-32bit


Download nvidia driver according to graphic card version


The are only a few commands to learn. First one is lscpi and here is a quick example showing how to fetch details about graphics unit (also called vga card or video card).
$ lspci -vnn | grep VGA -A 12
00:02.0 VGA compatible controller [0300]: Intel Corporation 82G35 Express Integrated Graphics Controller [8086:2982] (rev 03) (prog-if 00 [VGA controller])
        Subsystem: Intel Corporation Device [8086:d701]
        Flags: bus master, fast devsel, latency 0, IRQ 44
        Memory at e0200000 (32-bit, non-prefetchable) [size=1M]
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        I/O ports at 2440 [size=8]
        Expansion ROM at <unassigned> [disabled]
        Capabilities: <access denied>
        Kernel driver in use: i915



Now, we need to drop to text-only console, because the driver cannot install when the graphics thingies are in use. To do this, switch into runlevel 3. This is still done like before, for compatibility purposes, even though CentOS has switched away from traditional RC scripts to code-monkey object-oriented event-based whatever the new stupid thing is called, systemd or such.
init 3
Login as root. Find the downloaded Nvidia driver on your disk. Make the file executable and then run it. Follow the prompts provided by the Nvidia installer text wizard. You should also make sure to install the 32-bit libs.
chmod +x <Nvidia file>.run
./<Nvidia file>.run
Once this step is complete, go back into runlevel 5.
init 5



if after rebooting, the system cannot go to GUI

  1. # X -configure

  2. Copy xorg.conf.new as /etc/X11/xorg.conf.

  3. # cp /root/xorg.conf.new /etc/X11/xorg.conf

  4. Now switch to X Window as root user by typing.

  5. # init 5

  6. Launch NVIDIA configuration window and set the Resolution, manually, and at last click on Save to X Configuration File and quit. For reference, follow the screen shot added below.