Home My Page Projects MPTK: The Matching Pursuit ToolKit
Summary Activity Forums Tracker Lists Docs News SCM Files

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Emily Stephen on 2010-04-21 23:27
[forum:104448]
It's working!

1) I added the #include "block.h" line
2) I set an environment variable MACI64 to 0 (as recommended in the help file you linked)
3) I started matlab from the shell using: matlab -maci

Thanks so much!

Emily

RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Ronan Le Boulch on 2010-04-21 07:23
[forum:104439]
Emily,

I managed to get rid of this error "'MP_Block_c' was not declared in this scope" by including :#include "block.h" in the block_factory.h file. It seems that this file cannot be reached by the compiler.

For the second problem, i am actually using Matlab R2009a which is with maci configuration. If errors keep happening, i suggest you to get this one while i am updating mine to see what's happening.

I've also founded an interesting help if you're interested:
http://www.mathworks.de/matlabcentral/newsreader/view_thread/262164


RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Emily Stephen on 2010-04-20 23:28
[forum:104438]
Update:

I successfully built and ran mpd from the command line without BUILD_MATLAB_MEX_FILES but with CMAKE_OSX_ARCHITECTURES set to i386. So I believe the fftw-3.2.2 and libsndfile-1.0.21 libraries are working fine using 32 bits, even given the error that I got for libsndfile.

So the only thing holding me up is building the mex files.

RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Emily Stephen on 2010-04-20 21:28
[forum:104437]
Thanks, Ronan -- I think I'm much closer to getting it to work now, but I'm still having a couple of issues:

1) I needed to recompile fftw-3.2.2 and libsndfile-1.0.21 for a 32 bit architecture. fftw worked fine using:

./configure --with-gcc-arch=i386

but I'm having trouble with libsndfile. I'm using:

./configure --build=i386-apple-darwin10.3.0

then when I run make, it gives me the error:

ld: warning: in ../src/.libs/libsndfile.dylib, file was built for i386 which is not the architecture being linked (x86_64)

but it also generates a libsndfile.a and libsndfile.la -- should I use one of these in the cmake parameter setup?


2) When I run cmake on mptk (given the error in libsndfile), I get errors that don't seem to be a result of the libsndfile issue. I have CMAKE_OSX_ARCHITECTURES set to i386, and the make runs as far as running 'CMake Rules', and then it crashes with a bunch of errors starting with: "'MP_Block_c' was not declared in this scope"

Looking at the output, I think the issue is related to the way mexopts.sh is being used, because it looks like it still uses the x86_64 architecture in the CXX Flags and it points to a nonexistent maci64 directory:

-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
FILE = /Applications/MATLAB_R2009b.app/bin/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /Applications/MATLAB_R2009b.app
-> CC = gcc-4.0
-> CC flags:
CFLAGS = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5 -fexceptions
CDEBUGFLAGS = -g
COPTIMFLAGS = -O2 -DNDEBUG
CLIBS = -L/Applications/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DHAVE_FFTW3 -DMX_COMPAT_32
-> CXX = g++-4.0
-> CXX flags:
CXXFLAGS = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -L/Applications/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DHAVE_FFTW3 -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -m64 -fbackslash
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -L/Applications/MATLAB_R2009b.app/bin/maci64 -lmx -lmex -lmat -L -lgfortran -L -lgfortranbegin
arguments = -DHAVE_FFTW3 -DMX_COMPAT_32
-> LD = gcc-4.0
-> Link flags:
LDFLAGS = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2009b.app/extern/lib/maci64/mexFunction.map
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexmaci64
arguments = -L/Users/Emily/Documents/BU/2010_Spring/MA751/Final_Project/MPTK/lib/Release -lmptk -lmptk4matlab
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -L/Users/Emily/Documents/BU/2010_Spring/MA751/Final_Project/MPTK/lib/Release -lmptk -lmptk4matlab
----------------------------------------------------------------


I'm guessing it's pointing to the maci64 section of mexopts.sh rather than the maci section. Any idea what needs to change?

Thanks,
Emily

RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Ronan Le Boulch on 2010-04-20 07:24
[forum:104424]
Hi Emily,

There are few tricks that i can give you:

1) I suggest you to use the latest version of Cmake (2.8.1) because i recently had problems with olders versions of Cmake which didn't took in account the CMAKE_OSX_ARCHITECTURES, as default setting for gcc version 4.2.1 is now x86_64.

2) What is the ccmake value of CMAKE_OSX_ARCHITECTURES? Because in fact, if this is empty, the default value is setting to x86_64. So set it to i386.

3) When you does a "ls -ll" command terminal for "c++" and "gcc" under /usr/bin, if the symbolic link is to "c++-4.x" and "gcc-4.x" versions beyond 4.2.0, the MEX compilation won't work because the earliest gcc version supported with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
So i suggest you to change it using ln command in order to have a symbolic link with "c++-4.0" and "gcc-4.0"

Cheers

Ronan

RE: Trouble installing Matlab Mex files on Mac [ Reply ]
By: Emily Stephen on 2010-04-19 23:06
[forum:104423]
I think the issue is that I'm running a 32-bit Matlab on a 64-bit machine. Is there a way to trick it into generating 32-bit maci files?

Trouble installing Matlab Mex files on Mac [ Reply ]
By: Emily Stephen on 2010-04-19 22:05
[forum:104422]

Make Output.rtf (276) downloads
Hi,

I've managed to install and use the command-line interface using BUILD_EXECUTABLE and BUILD_SHARED_LIBS, but when I add on BUILD_MATLAB_MEX_FILES I get an error. The Matlab variables are set to:
MATLAB_ENG_LIBRARY=/Applications/MATLAB_R2009b.app/bin/maci/libeng.dylib
MATLAB_INCLUDE_DIR=/Applications/MATLAB_R2009b.app/extern/include
MATLAB_MEX_LIBRARY=/Applications/MATLAB_R2009b.app/bin/maci/libmex.dylib
MATLAB_MX_LIBRARY=/Applications/MATLAB_R2009b.app/bin/maci/libmx.dylib
MEX_COMPILER=/Applications/MATLAB_R2009b.app/bin/mex

The error I'm getting is when I run make, and I think the important lines are:
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libmex.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libmx.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libeng.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libmex.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libmx.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /Applications/MATLAB_R2009b.app/bin/maci/libeng.dylib, file was built for i386 which is not the architecture being linked (x86_64)



I've attached the entire output in case that's helpful.