How to uninstall opencv in Ubuntu? - eclipse

I have the following system:
Linux 64 bit LTS 12.04
I have multiple installations of opencv library on the system.
I want to know the procedure to remove all opencv libraries from the system.
I am having trouble while executing my program through Eclipse IDE.
Though I can build the project when I try to execute it, it gives the following error:
OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in release, file /build/buildd /opencv-2.3.1/modules/core/src/matrix.cpp, line 1364
terminate called after throwing an instance of 'cv::Exception'
what(): /build/buildd/opencv-2.3.1/modules/core/src/matrix.cpp:1364: error: (-215) k == STD_VECTOR_MAT in function release
Confusing thing is I am not able to find the path specified in the error i.e.
/build/buildd/opencv-2.3.1/modules/core/src/matrix.cpp
I am able to compile the same source code using command line tool gcc and using pkg-config.
However I am unable to do the same through eclipse IDE.

You can also uninstall by going to the "build" folder directory of opencv from terminal, and execute the following
make uninstall
cd ..
sudo rm -r build
sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*

I remember I used this command a while ago to remove all opencv related things. It is interactive which promote you to remove the file. choose y or n depending.Take your time and be-careful
$> sudo find / -name "*opencv*" -exec rm -i {} \;

The correct way is cd /path/to/cv/build then sudo make uninstall. Of course you will have to have the source code with you
I tried the exec rm thing but nothing changed. Also FYI, sudo apt-get remove libopencv-* did not remove openCV for me

Related

How do I fix DWM "make clean install" command error?

I was setting up DWM window manager on debian, but when conpiling it, it came up with an error.
I installed it, then tried to run it with make clean install, but it did not have the make command. I installed it with sudo apt-get install -y make. I tried to run make clean install, but it came up with the error:
make: cc: No such file or directory
make: *** [Makefile:18: drw.o] Error 127
Help?
Doing just make install (sudo if required) the first time should fix the error.
As to why it happens — you probably have a custom Makefile or your rm binary does not understand the -f flag. The upstream Makefile has the following under the clean target:
clean:
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
Ensure that your Makefile also passes the -f flag to rm (which means "ignore nonexistent files").

How to force MATLAB 2016a to use gcc-4.7.x instead of the one I have (gcc-5.4.1)?

There are some posts about this for the older releases of MATLAB, but they don't seem to work for R2016a.
I'm trying to install MatConvNet on Ubuntu 16.04. When I run the vl_compilenn command as described here, it gives me a warning as follows:
Building with 'gcc'.
Warning: You are using gcc version '5.4.1'. The version of gcc is not supported.
The version currently supported with MEX is '4.7.x'. For a list of currently supported
compilers see: http://www.mathworks.com/support/compilers/current_release.
I have already installed gcc-4.7 and g++-4.7 using apt-get install gcc-4.7 g++-4.7. How can I force MATLAB to use these versions and not the default ones?
Few hints, not a complete tutorial how to do it.
Probably the simplest would be to edit the MATLAB's Mex XML configuration file:
mex -setup C
cc = mex.getCompilerConfigurations('C', 'Selected')
edit(cc.MexOpt)
The mex setup usually creates a copy in your home folder (~/.matlab/<version>/mex_C_glnca64.xml), so you should be able to edit it without root.
There you probably need to change the section:
<GCC>
<cmdReturns name="which gcc" />
</GCC>
which I guess searches for the location of the gcc command to your gcc version and assigns it to the $GCC variable. Plus you can change the version name in the header.
Additionally you need to do the same for the C++ language.
This works with R2016b:
Install the required GCC version with apt install (gcc-4.9 and g++-4.9 in my case).
Create a bin folder in your home, i.e. ~/bin.
Create the following links with ln:
ln -s /usr/bin/gcc-4.9 ~/bin/gcc
ln -s /usr/bin/g++-4.9 ~/bin/g++
If using CUDA, create a file called nvcc in the ~/bin folder, with the following contents (don't forget to make it executable: chmod +x ~/bin/nvcc):
Contents:
#!/bin/sh
exec /usr/lib/nvidia-cuda-toolkit/bin/nvcc -ccbin gcc-4.9 "$#"
If necessary replace /usr/lib/nvidia-cuda-toolkit/bin/nvcc with the correct location of the nvcc binary.
Open MATLAB and follow the instructions for compiling MatConvNet.

Error: version `GLIBCXX_3.4.21' not found

I am trying to compile matconvnet-1.0-beta20 with Matlab 2016a on Ubuntu 16.04. Initial phase of compilation works fine:
untar('http://www.vlfeat.org/matconvnet/download/matconvnet-1.0-beta20.tar.gz') ;
cd matconvnet-1.0-beta20
run matlab/vl_compilenn
The error happens when I run vl_simplenn(network, image) which gives following error:
Invalid MEX-file '/home/matconvnet-1.0-beta20/matlab/mex/vl_nnconv.mexa64':
/usr/local/MATLAB/R2016a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version
`GLIBCXX_3.4.21' not found (required by /home/matconvnet-1.0-beta20/matlab/mex/vl_nnconv.mexa64)
To understand the cause of problem, I run /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC which doesn't give any output bash: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: Permission denied
Also more /usr/lib/x86_64-linux-gnu/libstdc++.so.6 gives no output:
******** /usr/lib/x86_64-linux-gnu/libstdc++.so.6: Not a text file ********
I did some research and found some possible solutions:
http://it.mathworks.com/matlabcentral/newsreader/view_thread/162466
The problem is that MATLAB secretly changes LD_LIBRARY_PATH on startup
to point to the MATLAB version of GLIBC++, so that GLIBC++ 3.4.9 can
no longer be found. The solution is to modify matlab/bin/.matlab7rc.sh
so that "LDPATH_PREFIX" contains the path to the version of GLIB
installed with your compiler, then this is found before the
matlab-supplied library.
so I edited /usr/local/MATLAB/R2016a/bin/.matlab7rc.sh and modified LDPATH_PREFIX='' in 195th line to LDPATH_PREFIX='/usr/lib/x86_64-linux-gnu'.
After applying this change, the problem still exist.
As suggested here, I copied .matlab7rc.sh to current working directory of project, but still error persist.
https://askubuntu.com/questions/719028/version-glibcxx-3-4-21-not-found
According to first answer, running this command
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6
gives an error:
ln: failed to create symbolic link 'usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6': No such file or directory
Seems like second solution suggests changes of LD_PRELOAD path in .matlab7rc.sh, but it is not anywhere inside the file.
How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?
From Matlab directory in /usr/local/MATLAB/R2016a/bin$ I run
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libstdc++.so.6
but the problem still exist.
Maybe there I didn't apply the solution in the correct way Or maybe there is another solution elsewhere that I didn't find. Please let me know, I am very confused!!!
You need before execute (matlab in my case) add path of library:
In console execute this:
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab
I had the same problem.
In my case, to solve it, I first ran "locate" to list all the possible versions of the library in the system.
locate libstdc++
As an example, I report the result on my system
I then set the most recent version of "lib" by exporting the environment variable:
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21"
So, the fullpath of the library to be set depends on where it is allocated in your system.
There are 2 possible solutions:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libstdc++.so.6
Install this package:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
MAYBE the second solution you mentioned really works, but you have done it before. So you cannot operate in the same way again because you have ever linked /usr/lib/x86_64-linux-gnu/libstdc++.so.6 to usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6. TRY rebooting?
Also, you use MATLAB R2016a, but this command applies to R2014a. Was it that you ignore this point?

no matlab executable were found

I tried to install the "MATLAB - Scientific computing environment" from the software center but failed, because I got the error message "No MATLAB executables were found in the directories you specified. This package requires at least one local installation of MATLAB." My linux version is ubuntu 12.10. Any help will be appreciated.
Try the following:
cd /usr/local/bin/
# Replace R2012a by your version:
sudo ln -s /usr/local/MATLAB/R2012a/bin/matlab matlab
Otherwise you can also try sudo apt-get install matlab-support, which is basically an assistant for configuring MATLAB.
Now the command matlab should launch MATLAB.

How to install XML::Parser without expat-devel?

XML::Parser fails to build on a quite fresh 64-bit Debian box. After issuing cpan XML::Parser, cpan fails with lots of errors about Expat.c and Expat.xs:
[...]
Expat.xs:2182: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2904: error: ‘XML_Parser’ undeclared (first use in this function)
Expat.c:2904: error: expected ‘;’ before ‘parser’
Expat.xs:2194: error: ‘parser’ undeclared (first use in this function)
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.41-rpV6ok/Expat'
make: *** [subdirs] Error 2
TODDR/XML-Parser-2.41.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Message at the start of the output explains that expat-devel is needed for building.
Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.
But expat-devel is not in Debian repository.
Is it possible to get over this without need to build/install expat from source?
The package you want to install is named libexpat1-dev. You could also just install libxml-parser-perl via apt-get. Or if you really want to install via CPAN try installing the Debian packages dependencies first via apt-get build-dep libxml-parser-perl.
libexpat1-dev contains both libexpat and expat.h, which are both mentioned in the message as well:
If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:
EXPATLIBPATH=... To set the directory in which to find libexpat
EXPATINCPATH=... To set the directory in which to find expat.h
Installing libexpat1-dev seems to solve the problem:
$ aptitude install libexpat1-dev
There is always the manual method - to build/install expat from source.
(This example shows installing to an alternative location for XAMPP | LAMPP)
Download from:
http://sourceforge.net/projects/expat/files/expat/
tar zxf /[where-ever]/expat-2.1.0.tar.gz -C /tmp
cd /tmp/expat-2.1.0
/opt/lampp/bin/perl ./configure --prefix=/opt/lampp LDFLAGS=-L/opt/lampp/lib
make
make install
http://search.cpan.org - search for and download - XML::Parser
tar zxf /[where-ever]/XML-Parser-2.41.tar.gz -C /tmp
cd /tmp/XML-Parser-2.41
/opt/lampp/bin/perl ./Makefile.PL EXPATLIBPATH=/opt/lampp/lib EXPATINCPATH=/opt/lampp/include
make
make test
make install
Work like a charm in Ubuntu 15.04. The only thing that I need is install Perl XML Parser with:
sudo apt-get install libxml-parser-perl
And following the instructions here, I was able to import successfully all my ratings into Rhythmbox. Now, the only work that I need to do is create again the smart play lists, that is nothing compared with my entire libray ratings.
Today I had the same issue wanting to complile the new GIMP 2.9.4 beta on OSX 10.8 and the aid of homebrew.
First install perl
brew install perl
Then the XML::Parser module by going into the perl shell with
perl -MCPAN -e shell
And inside the shell install XML::Parser by typing
install XML::Parser
Exit shell
exit
Now, verify it has been installed successfully. If everything is ok, you will not see an error.
perl -e "require XML::Parser"
If the ./configure still fails missing XML::Parser, then intltools is not using the perl you have installed. Looking at the script tells me it does the test with $INTLTOOL_PERL -e "require XML::Parser". Trying a echo $INTLTOOL_PERL gave out nothing, so the magic is to set it with
export $INTLTOOL_PERL=perl
Now run ./configure again.
None of the above methods worked for me. I had the right environment variables setup but they were somehow not picked up by cpanm that I use to install perl modules. Expat was also installed.
Here is what I did to overcome the same problem that OP is reporting.
This is very close to what #LadyBuzz suggested.
Download the XML::Parser from cpan.org
Extract the tarball into directory and descend to it.
Open the Makefile.pl and edit the first lines to actually have the absolute paths to both: EXPATLIBPATH and EXPATINCPATH
Save the Makefile.pl, go up one level and create a new tarball with the Makefile.pl that you just edited.
Execute cpanm on the newly created tarball.
This resulted in successful installation of the module.