Matlab 2007b, Leopard, and c mex files

I recently switched from Windows to an (intel) Macbook with Leopard pre-installed. I installed Matlab 2007b and had no problems (X11 was already installed with Leopard) until I tried to compile a mex file from some simple c code (which compiled properly on my windows box). I had this error:

>> mex PrecomputationLoop3dFlex.c
/Applications/MATLAB_R2007b/bin/mex: line 1025: gcc-4.0: command not found
/Applications/MATLAB_R2007b/bin/mex: line 1004: gcc-4.0: command not found
/Applications/MATLAB_R2007b/bin/mex: line 930: gcc-4.0: command not found

mex: compile of 'PrecomputationLoop3dFlex.c' failed.

First, I was astonished that a c compiler wasn't provided in the pre-installation, but then I saw that gcc is included in Xcode, so I simply went through the Xcode installation from the disk that came with my Macbook (Xcode 3.0). When I tried to bring up Matlab after the Xcode installation, multiple X11 windows popped up and Matlab crashed. I called Matlab support and they pointed me to Apple (since Matlab only supports Xcode 2.4.1...which can't be installed on Leopard), and Apple support simply had me reinstall the OS...so now I'm back to having Matlab and no mex capability. How do I properly install Xcode so that Matlab starts properly AND can compile C mex files?

Ok, I started with a fresh

Ok, I started with a fresh version of Leopard and installed xcode (xcodetools.mpkg). Now I can compile my C mex files, but I am getting this warning:

ld: warning, duplicate dylib /Applications/MATLAB_R2007b/bin/maci/libz.1.dylib

Since my code seems to be running fine anyway, I won't worry about it.

Re: Matlab 2007b, Leopard, and c mex files

Hi,

The duplicate warning is because that library is present as part of the OS as well. It's relatively harmless as long as the version that is actually linked against is the one that is loaded (which it should be).

Dave

Re: Matlab 2007b, Leopard, and c mex files

Thanks! I haven't noticed any problems, so it looks completely harmless.