Thread Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Amin

Date: 11 May, 2009 20:19:02

Message: 1 of 6

I have been using the latest version of matlab(2009a) on x64 ubuntu 8.10 for a couple of weeks now.
Every thing works fine but I can't make the matlab compile my C files into Matlab mex(using mex function). Intrepid is shipped with gcc 4.3.2 while the latest version that matlab supports is still gcc 4.2.3 so I think this should be the source of the problem.
When I mex a script, matlab warns me about the wrong version of the GCC and then the mex-ed file does not work properly. I get odd errors like "out of memory" or the mex ed function returns an incorrect value. The script works fine when I mex it on another computer with an older version of Linux(opensuse 10.3) which has a compatible GCC.

I tried to install an older version of GCC on intrepid but I either did it wrong or it didn't solve my problem.

I would appreciate if anyone have any idea/experience about solving this problem.

amin

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Timothy

Date: 30 Jun, 2009 00:36:03

Message: 2 of 6

Hi Amin,

I have a similar problem too. I run R2009a on a Mac Intel machine and mex-ing my C code with mex wrappers seem to work fine. I also discovered MATLAB supports up to gcc 4.2. Apple's OS X still ships with gcc-4.1 so it worked fine. I tried compiling with mex on another x86 PC running Ubuntu 9.04 Jaunty (having install and changed the symbolic link of gcc to gcc-4.1 and also gcc-4.2 in two separate tests) and this is the verbose error message I get:

# mex -v vech.c
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
   FILE = /root/.matlab/R2009a/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/matlab/R2009a
-> CC = gcc
-> CC flags:
         CFLAGS = -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64
         CDEBUGFLAGS = -g
         COPTIMFLAGS = -O -DNDEBUG
         CLIBS = -Wl,-rpath-link,/usr/local/matlab/R2009a/bin/glnx86 -L/usr/local/matlab/R2009a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++
         arguments = -DMX_COMPAT_32
-> CXX = g++
-> CXX flags:
         CXXFLAGS = -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pthread
         CXXDEBUGFLAGS = -g
         CXXOPTIMFLAGS = -O -DNDEBUG
         CXXLIBS = -Wl,-rpath-link,/usr/local/matlab/R2009a/bin/glnx86 -L/usr/local/matlab/R2009a/bin/glnx86 -lmx -lmex -lmat -lm
         arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
         FFLAGS = -fexceptions -fPIC
         FDEBUGFLAGS = -g
         FOPTIMFLAGS = -O
         FLIBS = -Wl,-rpath-link,/usr/local/matlab/R2009a/bin/glnx86 -L/usr/local/matlab/R2009a/bin/glnx86 -lmx -lmex -lmat -lm
         arguments = -DMX_COMPAT_32
-> LD = gcc
-> Link flags:
         LDFLAGS = -pthread -shared -m32 -Wl,--version-script,/usr/local/matlab/R2009a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined
         LDDEBUGFLAGS = -g
         LDOPTIMFLAGS = -O
         LDEXTENSION = .mexglx
         arguments =
-> LDCXX =
-> Link flags:
         LDCXXFLAGS =
         LDCXXDEBUGFLAGS =
         LDCXXOPTIMFLAGS =
         LDCXXEXTENSION =
         arguments =
----------------------------------------------------------------

-> gcc -c -I/usr/local/matlab/R2009a/extern/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64 -DMX_COMPAT_32 -O -DNDEBUG "vech.c"

vech.c:77:2: warning: no newline at end of file
-> gcc -O -pthread -shared -m32 -Wl,--version-script,/usr/local/matlab/R2009a/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "vech.mexglx" vech.o -Wl,-rpath-link,/usr/local/matlab/R2009a/bin/glnx86 -L/usr/local/matlab/R2009a/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++

/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

    mex: link of ' "vech.mexglx"' failed.

Any luck with advice?

Cheers,
Tim

"Amin " <azandvak@aecom.yu.edu> wrote in message <gua17m$m72$1@fred.mathworks.com>...
> I have been using the latest version of matlab(2009a) on x64 ubuntu 8.10 for a couple of weeks now.
> Every thing works fine but I can't make the matlab compile my C files into Matlab mex(using mex function). Intrepid is shipped with gcc 4.3.2 while the latest version that matlab supports is still gcc 4.2.3 so I think this should be the source of the problem.
> When I mex a script, matlab warns me about the wrong version of the GCC and then the mex-ed file does not work properly. I get odd errors like "out of memory" or the mex ed function returns an incorrect value. The script works fine when I mex it on another computer with an older version of Linux(opensuse 10.3) which has a compatible GCC.
>
> I tried to install an older version of GCC on intrepid but I either did it wrong or it didn't solve my problem.
>
> I would appreciate if anyone have any idea/experience about solving this problem.
>
> amin

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Christopher Hummersone

Date: 5 Nov, 2009 16:51:02

Message: 3 of 6

Hey,

I am having a similar problem. I'm running R2009a on Ubuntu 9.1 (karmic koala). Did you ever fix it? I also tried creating symbolic links, which stopped Matlab moaning about the GCC version, but they would compile and I got strange errors, that I didn't get using R2007a on a Mac running OS X 10.5 and Xcode.

Thanks,

Chris

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Christopher Hummersone

Date: 5 Nov, 2009 16:58:03

Message: 4 of 6

Hey,

I am having a similar problem. I'm running R2009a on Ubuntu 9.1 (karmic koala). Did you ever fix it? I also tried creating symbolic links, which stopped Matlab moaning about the GCC version, but they would compile and I got strange errors, that I didn't get using R2007a on a Mac running OS X 10.5 and Xcode.

Thanks,

Chris

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Christopher Hummersone

Date: 9 Nov, 2009 11:29:02

Message: 5 of 6

Well I've got pretty close: I installed gcc-4.2 etc and changed the symlinks in /usr/bin to point to them (as opposed to gcc-4.4 etc) and created a symlinks named 'glnxa64' pointing to 'glnx86' in the following directories:
$matlabroot/extern/lib
$matlabroot/bin

My main problem now seems to revolve around the 'ld' library in /usr/bin. Specifically I get the following error:

/usr/bin/ld: skipping incompatible $matlabroot/bin/glnxa64/libmx.so when searching for -lmx

which, due to the aforementioned symlink, is actually in
$matlabroot/bin/glnx86/libmx.so

So now I'm stumped! I guess it's some 32/64 bit incompatibility but I have no idea where to begin trying to fix it!

Chris

Subject: problem with Matlab 2009a on x64 Ubuntu intrepid

From: Christopher Hummersone

Date: 9 Nov, 2009 11:39:02

Message: 6 of 6

Oh and I also edited:

~/.matlab/R2009a/mexopts.sh

and commented out the line

CFLAGS='-ansi -D_GNU_SOURCE'

in the 'glnxa64' section, per this post:

http://forums.opensuse.org/programming-scripting/396126-gcc-matlab-opensuse-11-a.html#post1875821

Chris

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
64 Christopher Hummersone 9 Nov, 2009 06:34:06
32 Christopher Hummersone 9 Nov, 2009 06:34:06
karmic Christopher Hummersone 9 Nov, 2009 06:34:06
linux Christopher Hummersone 9 Nov, 2009 06:34:05
mex Christopher Hummersone 5 Nov, 2009 11:54:07
gcc Christopher Hummersone 5 Nov, 2009 11:54:07
91 Christopher Hummersone 5 Nov, 2009 11:54:07
r2009a Christopher Hummersone 5 Nov, 2009 11:54:07
karmic koala Christopher Hummersone 5 Nov, 2009 11:54:07
ubuntu Christopher Hummersone 5 Nov, 2009 11:54:07
mex does not wo... Timothy 29 Jun, 2009 20:39:07
gcc Amin 11 May, 2009 16:24:06
x64 Amin 11 May, 2009 16:24:06
2009a Amin 11 May, 2009 16:24:06
mex Amin 11 May, 2009 16:24:06
ubuntu Amin 11 May, 2009 16:24:06
linux Amin 11 May, 2009 16:24:06
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com