Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install opencv in my system by following this link. It says that after installing we need to do some configuration by opening


and typing a particular address. And then in another one


we are writing


It will be great if someone can explain how does it help the process.

share|improve this question

You're telling various parts of the system how to find the opencv support libraries.

What the code does

The instructions that you cite say to add the following line to /etc/


Notice that /usr/local is in the bash config as well. When you build an application from source, the default install location is in the /usr/local subtree. The two configuration pieces you mention are there to make sure that the rest of the operating system knows to look in /usr/local/... in addition to the other usual places, for various libraries, etc. If you were to install into another location, say /usr or /opt, you'd want to change all those paths accordingly.

Why bother?

/etc/ (and /etc/ are there to tell where to find shared libraries. Since opencv installs in /usr/local/..., we need to have look in /usr/local/lib to find the support libraries for the app. Similarly for pkgconfig, we need to be sure the pkg-config app can find its support files.

Do you need to do this?

Now, you may not need to make the change suggested by the documentation. If you look at the other files in /etc/, you may find that another file already includes /usr/local/lib:

grep /usr/local/lib /etc/*

On my system, this returns


Because this is here, I wouldn't need a second entry, although it's safe to have it in twice. You may not need the PKG_CONFIG setup either, since the pkg-config(1) man page states:

On most systems, pkg-config looks in /usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig and /usr/local/share/pkgconfig for these files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.