LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   MATLAB GUI on Fedora Core 2 fixed? long post. (https://www.linuxquestions.org/questions/fedora-35/matlab-gui-on-fedora-core-2-fixed-long-post-183462/)

paulo 05-19-2004 06:18 PM

MATLAB GUI on Fedora Core 2 fixed? long post.
 
I upgraded Linux and MATLAB didn't work.
saw errors like:
Warning: Disabling Java support.
But, after much searching and reading this newb got it to work.

if you need to matlab up fast and don't mind text mode only
enter the following at the prompt:
matlab -nojvm
If you like the GUI of matlab and want to undertake the
challenge (for newbies like me) of resurrecting it read on

The errors on attempting to run MATLAB 12.1 student version on Fedora Core2
were really frustrating. I got warnings about GLIBC_2.0 and the Java Runtime Evironment.
Also I had problems with linking the java libraries. Basically, many things that I didn't
fully understand. But, I now have MATLAB working in gui mode and it doesn't keep crashing
when I open new windows and that sort of thing (as others have reported).
I combined the steps from several different postings on users groups (searched:mathworks/LQ/google)

This one was really helpful from Jakub at bugzilla.redhat.com
posted 11/21/2003 Bug # 110610
<start post>
Try using some less buggy JVM.
Latest Sun JDK should work just fine for example.

Or, as a workaround for the buggy JVM, you can try:

gcc -O2 -shared -o ~/libcwait.so -fpic -xc - <<\EOF
#include <errno.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
pid_t
__libc_wait (int *status)
{
int res;
asm volatile ("pushl %%ebx\n\t"
"movl %2, %%ebx\n\t"
"movl %1, %%eax\n\t"
"int $0x80\n\t"
"popl %%ebx"
: "=a" (res)
: "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
"S" (0));
return res;
}
EOF

and run the program with
LD_PRELOAD=~/libcwait.so LD_ASSUME_KERNEL=2.4.19
in environment.
<end post>

I copied and pasted the gcc -02 ...
to EOF
(don't ask me to explain that code I just ran it)
(make sure you are su when you run it, though)
(I think the code makes a file that stops matlab
from choking on not finding the clibrary until after
it knows which java environment is active)

and then typed the following at the prompts:

export LD_PRELOAD=~/libcwait.so
export LD_ASSUME_KERNEL=2.4.19

Then I typed matlab and I was happy to see the GUI load properly,
but sad if I opened a .m file in its editor
MATLAB crashed. This is a big problem.

What Jakub didn't know and poster David Kewley (2/19/04 same thread) did
is that MATLAB 12.X doesn't play nice with Sun Java version 1.4.2. And this
libcwait.so file above could be a good fix for RH8 but not for versions that
used most recent versions of Java. When I did just this fix - I got that
crash problem when opening other windows.

So, I was looking at another posting this time from the Mathworks site.
(solution number 1 -1 AFHN) which suggested to get the 1.3 version of Java
from www.blackdown.org and install that and then have MATLAB link to this version
of JAVA.

ln -s /where-you-install-blackdownjava/j2se/1.3/jre /local-matlab-dir/sys/java/jre

(of course replace the hyphenated directories with your particular directories)

I did not change the environment variable like the rest of that mathworks post said.
do not type this part: (export MATLAB_JAVA=/path-to-blackdown-java/jre)

I guess that I made MATLAB "think" its using an older kernel version (2.4.19) with
a newer Java version (with appropriate C libraries). While, avoiding forcing MATLAB
to use the latest Java version which can crash the MATLAB GUI. delicate program, eh?

I have opened and closed MATLAB several times even logged out and back on and it still works
I think it stuck. now, i just have to make a shell script to run matlab that contains the following three lines and always use that script to run matlab.

export LD_PRELOAD=~/libcwait.so
export LD_ASSUME_KERNEL=2.4.19
matlab -nosplash

good luck, don't give up. I got help from using the search at LQ and other places.
I am a bigger newb than you trust me.

binki 06-17-2004 01:52 PM

hi,

I think I don't encounter exactly the same problem but something similar.
My Matlab (Version 6.5.1.199709 Release 13 (Service Pack 1)) works o.k. with Fedora Core 2 even with the Java GUI for some simple tasks such as reading in data and producing scatterplots.

But as soon as I try to make a mesh or surf type of plot in crashes completely (java and non-java mode).
I tried the examplary codes from mathworks:

[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)

---> this causes a crash


but for example:

n = 6;
r = (0:n)'/n;
theta = pi*(-n:n)/n;
X = r*cos(theta);
Y = r*sin(theta);
C = r*cos(2*theta);
pcolor(X,Y,C)

works wheras this:

pcolor(hadamard(20))
colormap(gray(2))
axis ij
axis square

causes a horrible crash again.

Now I am rather confused and can't find of a way out anymore - if there are any comments to this I would be extreeemely happy!!!

paulo 06-17-2004 02:03 PM

mesh and surf plots I would bet use the java environment (even in non-java mode).
so trying some of the work-arounds I suggested above may help. I wrote that post perhaps too soon. I had a crash the other day re-sizing a plot (alhtouhg it had worked before). The suggested quick fix may not be perfect.

I would try and find out which version of java MATLAB 6.5 uses. Then I would try to get all of those java libraries and follow the instructions in the above post.

Alternatively, are you going to get Matlab 14 soon (through work or school server)? maybe an upgrade would fix the problem.

binki 06-17-2004 02:46 PM

I got a hint from the mathworks forum saying that it might be something with openGL.
trying "opengl info" in matlab causes it to crash - there you go.

( http://www.mathworks.com/support/tec...html#Section_4 )

but it seems not to be one of the nicest problems one can have. it has something to do with my nvidia graphics card which is not the best friend of Fedora as I learned from several postings....

I'll have to try to fix this thing.

binki 06-18-2004 03:41 AM

...now I found a work-around on mathworks.com:
"opengl neverselect"

its maybe not a clean solution but it seems to work now.


All times are GMT -5. The time now is 07:27 AM.