How to set up Matlab MCR for Ubuntu and Netbeans (UnsatisfiedLinkedError) - matlab

I am deploying a Java EE project in a server that uses the MCR of Matlab for some image processing functions. I've been trying this for months I can't make it work. The problem is when it is going to uses the MCR it cannot find the .so libraries. I got this error:
javax.servlet.ServletException: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or r the current path configuration. The MCR version that this component is trying to use is 7.13.
ROOT CAUSE:
java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB Builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or the current path configuration. The MCR version that this component is trying to use is: 7.13.
The servers uses:
Ubutuntu 64 bits.
Netbeans 7.4
Glassfish
java 6 sdk
first it uses MCR 7.13 now it uses MCR 8.1
Things I've already tried:
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with export:
export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64:$LD_LIBRARY_PATH
export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with setenv:
Command setenv not found
Edit ld.so.conf file and run ldconfig
Add -Djava.library.path=my/path/to/so in glassfish
Add -Djava.library.path=my/path/to/so in Netbeans like says here:
giving 'java.library.path' in netbeans for .dll/.so files
I tried to set environment variables in Netbeans like said in this post: How to set Environment Variable in Netbeans?
But I can't find "Actions"
I tried to set environment variables in Netbeans like said in this post: https://askubuntu.com/questions/267071/ld-library-path-specification
But I can't find "Environment"
I've tried lots of more things that I can't remember and none of them works, it keeps showing the same error (now for version 8.1 instead of 7.13). Please I would I appreciate any help.

I had the same problem working with Linux, Java EE and Matlab. My solution was:
Open a terminal
Log as root $ su and type password
Edit the /etc/enviroment $ gedit /etc/enviroment
Add the needed variables, in our case:
LD_LIBRARY_PATH="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64"
XAPPLRESDIR="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults"
Save the file and reboot.
Start the server as root.
What happened with your other solutions, like the export, was that there was no visibility between the variables that you created and the GlassFish server. Setting variables in the environment will asure you that they are visible from any other program/process.

Related

PostgreSQL driver does not load with PyQt5 [duplicate]

I have some trouble when I want to add a database.
_dataBase = QSqlDatabase::addDatabase("QPSQL");
After calling this method I have an error:
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
I include to PATH variable paths to:
PostgreSQL\9.3\bin
PostgreSQL\9.3\lib
PostgreSQL\9.3\include
Also I copy folder sqldrivers to Debug folder. Also tried to copy dlls drom this folder to Debug. Doesn't work either.
I came here googling because I had the same problem in Windows.
In my case to solve the issue I had to install PostgreSQL for Windows 32 bits since my Qt target was MinGW 32 bits.
Additionally, I had to add the PATH to the PostgreSQL bin and lib directories so Qt could find the right .dlls.
#SET PATH=C:\Program Files (x86)\PostgreSQL\9.6\bin\;C:\Program Files (x86)\PostgreSQL\9.6\lib\;%PATH%
The PATH can be set before launching Qt Creator or using the Qt Creator itself via the Build Environment in the Projects pane.
Add the system variable QT_DEBUG_PLUGINS=1 if you want to get full information of why the QPSQL driver has not been loaded.
Probably you will discover that Qt is not able to find it. Copy and paste the output here to know what exactly happens.
Use depends.exe on qsqlpsql.dll and found that this dll need libpq.dll from PostgreSQL\9.3\libfolder. Add libpq.dll to Debug folder and it works:)
Try pip install PyQt5 event if you already installed it using conda or installer. It helped me.
I got same problem with deploying Qt application (windeployqt didn't help). I had to copy more .dlls (libcrypto-1_1-x64.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libssl-1_1-x64.dll, libwinpthread-1.dll) from postgreSQL bin path (c:\Program Files\PostgreSQL\12\bin) next to .exe file (according to dependency walker).

library error after compiling

Using 2012b on Centos6 I compiled my code using deploytool.
To be sure I'm doing things correctly, I re-install the MCR to make sure I'm using the exact version matlab wants me to use. Following the instructions after installing the MCR (v83) I append the corresponding paths to LD_LIBRARY_PATH and XAPPLRESDIR.
When I use the run_myProgram.sh script. It echos out the library paths and I can see that the MCR paths are correct.
However, at the startup of my compiled program, I'm getting this error:
"error while loading shared libraries: libmwmclmcrrt.so.8.0: cannot open shared object file: No such file or directory"
Anyone out there have a way to fix this? For example, is it a problem with my system configuration or a problem with my deployment?
The plot thickens. I noticed that in the MCR installation, I only have libmwmclmcrrt.so.8.3. How does the deploytool not give me the version I need?
thanks!
You need to download MCR version 8.0 for r2012b. Please see the table here : MCR Version Table

MATLAB 2014a (8.3) Compiler Runtime Errors libmwlaunchermain.so

MATLAB 2014a (8.3) Runtime Compiler (MCR) Errors when trying to launch deployed (using
deploy tool) application in Ubuntu 13.04.
Right after installation of MCR if one runs the deployed application following error appears:
error while loading shared libraries: libmwlaunchermain.so: cannot open shared object file: No such file or directory.
Since I have already found a solution to this problem wasting a day, I just want to share it:
This seems to be a problem of MATLAB MCR installation script designed for Linux by MathWorks. Furthermore, it is a result of a known Ubuntu bug. To fix it, add your MCR to the $PATH as shown below:
First make sure to add the missing files to the right folder, in terminal:
sudo cp /usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/runtime/glnxa64/* /usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/bin/glnxa64
Add the proper library folder to your .profile, such that this change will stay after logout
ubuntu: gedit .profile
In the end of the file add following lines:
#MATLAB MCR
export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/bin/glnxa64
export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v83/X11/app-defaults
export PATH=$PATH:$LD_LIBRARY_PATH
export PATH=$PATH:$XAPPLRESDIR
Invoke following code in the terminal to make sure that Ubuntu bug doesn't re-write your variable:
echo STARTUP=\"/usr/bin/env LD_LIBRARY_PATH=\${LD_LIBRARY_PATH} \${STARTUP}\" | sudo tee /etc/X11/Xsession.d/90preserve_ld_library_path
Reboot
If this solution doesn't work, try to reinstall MATLAB MCR 8.3 from the MathWorks website and repeat the steps.
In my case (Matlab R2016b = v91), the binary generated by Matlab was accompanied by a shell script which sets up the LD_LIBRARY_PATH for me. If I just run
./run_scriptname.sh
it complains about the missing <deployedMCRroot>. So running the script with
./run_scriptname.sh /home/user/MatlabMCR/v91
it worked out of the box.
For me, it was not obvious that the path shown above is the <deployedMCRroot> because I chose /home/user/MatlabMCR as installation directory. And with the wrong path specified, it led to the same error message.

How to setup opencv2.4.0 with mingw in Netbeans?

How to setup opencv2.4.0 with mingw in Netbeans? I want to make the setup in windows xp x86 machine?
Updated:
I made a setup as set in this link SO link. My program get compiled properly but while executing, it got crahed.
I also Posted the same in this link-MyPost
User PATH Variables:
C:\ctags;C:\cscope;C:\MinGW\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;
System PATH variable:
./bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program
Files\Intel\WiFi\bin;C:\Program
Files\TortoiseSVN\bin;C:\WINDOWS\system32\gs\gs7.05\bin;C:\cscope;C:\ctags;C:\Program
Files\Vim\vim73;C:\Program Files\QuickTime\QTSystem\;C:\Program
Files\Java\jre6\bin;C:\Program Files\Windows
Imaging\;C:\MinGW\msys\1.0\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;C:\MinGW\bin;
Update:
I tried compiling and adding TBB path in windows 7. Even after adding the PATH I get the same issue and the snap shot of the error is below:
I tried the same in windows XP and I didnt get the above error but the application get crashed as before.
Did you do this?
Since version 2.1, OpenCV use the TBB library to support parallel processing.
If you use MinGW as a compile suite you should compile TBB yourself
http://opencv.willowgarage.com/wiki/TBB
http://opencv.willowgarage.com/wiki/MinGW
After compilation, you need to add its path to system path.
FYI, OpenCV 2.4.2 provided with compiled TBB dll for MingW.

Unable to acquire Oracle environment handle

Environment: Eclipse Indigo or Eclipse Juno 4.2 on Windows 7. Oracle 11g XE (local install)
When running my Django project in pydev, attempted page access results in the message "Unable to acquire Oracle environment handle".
Normally, all I have to do is set TNS_ADMIN to point to the correct tnsnames.ora directory.
If I run manage.py from the command line, all works as expected. I thought at first that it was probably an environment variable difference, but the TNS_ADMIN values are the same. In any case, explicitly setting TNS_ADMIN in the Eclipse run configuration didn't make a difference.
PYTHONPATH was somewhat different between the two, and I went to the trouble of overriding it in the run config to see if it made the difference. Nope.
Looking at the cx_Oracle source, the error seems to come from a failure in a call to OCIEnvNlsCreate, but I didn't see anything obvious in the Oracle documentation.
Can anyone give me a clue why I'm getting this in Pydev?
I figured it out. I didn't look hard enough at the PATH variable.
Basically, there was a virtual environment that needed its scripts directory (containing OCI.DLL) to be first in the path, but my Oracle installation was ahead of it. So, the error message was basically the result of calling the wrong OCI.DLL (the one associated with my Oracle installation, rather than the one cx_Oracle was bound to).
Activating the virtual environment worked because it changed the path. Pydev works differently, so Eclipse was seeing my standard path with the Oracle install first.