Path: news.mathworks.com!not-for-mail
From: "Timothy " <timothy.kam@anu.edu.au>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem with Matlab 2009a on x64 Ubuntu intrepid
Date: Tue, 30 Jun 2009 00:36:03 +0000 (UTC)
Organization: Australian National University
Lines: 71
Message-ID: <h2bmlj$qsi$1@fred.mathworks.com>
References: <gua17m$m72$1@fred.mathworks.com>
Reply-To: "Timothy " <timothy.kam@anu.edu.au>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246322163 27538 172.30.248.38 (30 Jun 2009 00:36:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Jun 2009 00:36:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 346783
Xref: news.mathworks.com comp.soft-sys.matlab:551563


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