title: Installation and maintenance of multiple versions of OpenCV (applicable to any other 3rd party library as well)
body: <p>I have been trying to do build and use OpenCV 2.3.0 on my Fedora15 Lovelock 64bit machine.</p>
  
  <p>Background:  </p>
  
  <p>First, on my 64bit Fedora15, OpenCV2.2.0 seems to be in the locations namely  </p>
  
  <pre><code>/usr/share/opencv  
  /usr/doc  
  /usr/lib64 &amp;  
  /usr/bin  
  </code></pre>
  
  <p>I do not find the include files though (in /usr/include). This means that the development package was n t installed. My package manager does not list the development packages when i try to Add/remove software.</p>
  
  <p>I have a need to create applications, some of which just link to 2.2 and others which link to 2.3.O of the OpenCV library.So, I thought the best solution would be to have a separate location for 3rd party libraries that i use for my development . So I created a directory in /local named soft and created an OpenCV directory. A directory structure like this one.  </p>
  
  <pre><code> /local/soft/
              OpenCV/ 
                     OpenCV2.2.0/  
                                source-files
                                build 
                     OpenCV2.3.0/
                                source-files  
                                build
                                installation  
                                            share/opencv 
                                            doc
                                            include
                                            lib
  </code></pre>
  
  <p>Now, i tried building OpenCV2.3.0 and i succeeded. I configure CMake to use CMAKE_INSTALL_PREFIX to the directory named "installation" (see above), instead of the default /usr/local/. Clean. huh?</p>
  
  <p>I tried building and installing OpenCv 2.2.0 in the same way. Alas 2.2.0 complains something during the build. So i thought i ll link to the already existing version in the standard locations. BUT, when i try to install the dev packages for 2.2 using my package manager,the development files for x86_64 are not found :-) which means i dont have the headers to link to the libraries in the standard location.</p>
  
  <p>I cant build my executable since linker <strong>ld</strong> would not find the OpenCV that i have installed in the non-standard location.(although i point it to the exact location using the -L and -l options with gcc in my Eclipse). </p>
  
  <p>Question 1: Am i doing the right thing in maintaining installations in non-standard  locations?  Is /usr/ the standard location where the package manager will always do the installation?</p>
  
  <p>Question2 : What is the right way of linking to these libraries installed in non-standard locations? Why would not ld recognize my .so files in the lib folder?  </p>
  
  <pre><code>sudo g++ logpolar.cpp -o logpolar.o -I /local/soft/OpenCV/opencv2.3.1/installation/include/ -l/local/soft/OpenCV/opencv2.3.1/build/lib/libopencv_core.so
  </code></pre>
  
  <p>But ld canot find -l/local/soft/OpenCV/opencv2.3.1/build/lib/libopencv_core.so</p>
  
  <p>I checked the lib folder and there sure is a beautiful symbolic link to  libopencv_core.so.2.3</p>