Error when trying to use mexopencv in matlab - matlab

I am trying to use mexopencv on my system which has:
Ubuntu 12.04.1 LTS
opencv 2.4.2
gcc-4.4
matlab 2012
and they all are working. I also used some c++ codes to test mex and it worked fine.
I used this to install mexopencv. Also did this because of some error I got which mentioned libstdc++.so.6
Now when I try something like:
a = cv.imread('pic.jpg');
I get:
Error using cv.imread
Invalid MEX-file '/home/primepc09/mexopencv/+cv/imread.mexa64': /usr/local/lib/libopencv_highgui.so.2.4:
undefined symbol: _ZNK9QCheckBox15minimumSizeHintEv
Any idea why I get this?

This is an unresolved symbol from QT library. Make sure you have QT installed on your system:
sudo dpkg -l | grep libqt
If you don't have it, you need to install it.

Related

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 in matcaffe installation

The above error showed up when I tried to install matcaffe in ubuntu. I switched to caffe root directory, and ran the following commands:
$ cd /home/naved/Desktop/caffe-master
$ make all matcaffe
$ make mattest
My matlab version is 2011a.
After running make mattest, the error above showed up.
What should I do to solve this problem?
I believe that the functionality for custom unit test caffe(and specifically the package matlab.unittest.TestCase) was introduced in version R2015a of MATLAB, and that if you're on an older version it won't be available

CentOS 7 install Octave 4.0.2 with GUI (OpenGL support)

I'm trying to install Octave 4 from source code in CentOS 7 but I got the warning messages:
configure: WARNING: OpenGL libs (GL and GLU) not found. Native graphics will be disabled.
configure: WARNING: OpenGL libs (GL and GLU) not found -- disabling GUI
configure: WARNING:
configure: WARNING: I didn't find the necessary libraries to compile native
configure: WARNING: graphics. It isn't necessary to have native graphics,
configure: WARNING: but you will need to have gnuplot installed or you won't
configure: WARNING: be able to use any of Octave's plotting commands
configure: WARNING:
configure:
configure: NOTE: Libraries or auxiliary programs may be skipped if they are
configure: NOTE: not found OR if they are missing required features on your
configure: NOTE: system.
I have checked this QUESTION but it didn't help.
I have also done yum install libqt4-opengl-dev but got an error No package libqt4-opengl-dev available.
I have got mesa-libGL and mesa-libGL-devel, but it seems like the configure cannot pick up these libraries.
Edit: answer to my own question
please see comments below the question.
I know that it's an old question, but I wanted to leave it in case if someone is still looking for an easy way of installing Octave 4.x.
The easiest way to install Octave 4 is to use Flatpack. It's installed by default in CentOS 7.
flatpak install flathub org.octave.Octave
flatpak run org.octave.Octave
If you're using Red Hat you need to install flatpak it first:
sudo yum install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

gcc required when installing Bugzilla on diskstation

I'm trying to install Bugzilla but encounter a Perl problem.
When installing required Perl modules, I get the following error message:
ERROR: Using install-module.pl requires that you install a compiler, such as gcc.
gcc 4.2.3 is installed and in the path. I'm using perl v 5.8.6 OS: Linux DiskStation 2.6.32.12
Another thread on Stackoverflow refers to PerlGcc but it seems to work on Solaris only.
How can I make Perl find gcc?
I'm guessing you're talking about this thread. Assuming that the guy talking about the version of gcc being relevant was onto something, could you check that you don't have an older version of gcc lying around somewhere higher in the path with
$ which gcc

Trying to install PostStat, a library to add statistics function into Postgres

I am trying to install Poststat on debian squeeze.
http://poststat.projects.postgresql.org
This project looks not so old (2008), but I am having some difficulties to install it. Although it seems to be a really interesting project, google is empty. I'll try here to sum up what I did (postgres 8.4 is installed) :
apt-get install fort77 postgresql-server-dev-8.4 libblas-dev liblapack-dev gfortran
First, as it is said on the official website, unpack the tar.gz and go in the directory f77stat and 'make'.
Then if you have libpq-dev installed, on debian squeeze it install also its owns pg_config in /usr/bin/ wich report false infos. (see http://postgresql.1045698.n5.nabble.com/Bug-report-Wrong-version-in-pg-config-td2123792.html)
One solution :
mv /usr/bin/pg_config pg_config_bak
ln -s /usr/lib/postgresql/8.4/bin/pg_config pg_config
This is important because the makefile of Poststat is retrieving some info with pg_config.
Then in the main Makefile there is the line :
-lblas -llapack -lg2c
Install those package for blas and lapack :
apt-get install libatlas-base-dev libatlas-dev libatlas-doc libatlas3gf-base
Now my problem is about g2c. According to google, g2c is obsolete so I edited the Makefile and replace -lg2c with -lgfortrant
Last step :
compile and import the new statitics functions in my database.
make && sudo make install
psql -f poststat.sql <database>
Sadly,
psql:poststat.sql:18: ERROR: unable to load the library
« /usr/lib/postgresql/8.4/lib/poststat.so » : /usr/lib/postgresql/8.4/lib/poststat.so:
undefined symbol: s_stop
Any thought ? fortran is not my world, and packages seem to have change a lot in debian about fortran. My switch from -lg2c to -lgfortrant is probably wrong. In fact removing this include does at the end produce the same error.
libg2c belongs to the g77 (http://stackoverflow.com/questions/2406581/what-is-libg2c-library), which is obsolete and unsupported for many years. Switching to a more current compiler involves more than just replacing this library. You need to replace the compiler also, e.g., gfortran. You might need to change the default compiler options of gfortran to be able to compile FORTRAN 77 code. I use: -O2 -ffixed-form -ffixed-line-length-none. If you use gfortran as the linker you won't need to explicitly include the fortran run-time library.
change -lg2c by -lf2c
Add to poststat.c , at the end
int MAIN__(){
return (0);
}