From: Robert on
I made the modification:
FC='/usr/local/bin/gfortran'
to my mexopts.sh file and mex can now find the compiler. Thanks Dave!

However, I cannot seem to set the libraries correctly.
I'm running a 64bit intel processor, but have a 32bit version of Matlab installed (2009a, 7.8.0347) because I was getting errors when trying to install 64bit Matlab.

I installed gofortran from the binary here: http://hpc.sourceforge.net/

I tried various combinations of settings for FC_LIBDIR and FC_LIBDIR2, but I keep getting 'file is not of required architecture' errors. There are numerous library folders in various subfolders of /usr/local/lib/. I don't know which one(s) to use.

Any advice? Maybe I'll try the version of gfortran that Dave is using.
From: Rune Allnor on
On 18 Feb, 20:04, "Robert " <llmmnno...(a)hotmail.com> wrote:
> I made the modification:
> FC='/usr/local/bin/gfortran'
> to my mexopts.sh file and mex can now find the compiler.  Thanks Dave!
>
> However, I cannot seem to set the libraries correctly.
> I'm running a 64bit intel processor, but have a 32bit version of Matlab installed (2009a, 7.8.0347) because I was getting errors when trying to install 64bit Matlab.

You probably have to match the compiler and matlab: Either both
32 bit or both 64 bit. You might be able to use 32-bit MEX files
with 64-bit matlab, but not the other way around.

Rune
From: Rune Allnor on
On 18 Feb, 21:15, Rune Allnor <all...(a)tele.ntnu.no> wrote:
> On 18 Feb, 20:04, "Robert " <llmmnno...(a)hotmail.com> wrote:
>
> > I made the modification:
> > FC='/usr/local/bin/gfortran'
> > to my mexopts.sh file and mex can now find the compiler.  Thanks Dave!
>
> > However, I cannot seem to set the libraries correctly.
> > I'm running a 64bit intel processor, but have a 32bit version of Matlab installed (2009a, 7.8.0347) because I was getting errors when trying to install 64bit Matlab.
>
> You probably have to match the compiler and matlab: Either both
> 32 bit or both 64 bit. You might be able to use 32-bit MEX files
> with 64-bit matlab, but not the other way around.

My mind is totally bogged down by the olympics: Check the
compiler docs and see if there is some switch to have it
compile in 32-bit mode. The resulting code ought to be
compatible with 32-bit matlab.

Rune
From: Robert on
> You probably have to match the compiler and matlab: Either both
> 32 bit or both 64 bit.

It's my impression that the compiler itself (as a program) could be 64bit, but that it would need to generate 32bit executables. Thus, I can use a 64bit compiler, as long as I use 32bit libraries. Is this right?

If so, I just need to find the right libraries and set FC_LIBDIR and FC_LIBDIR2 in my mexopts.sh file accordingly. Does this sound right?
From: dpb on
Robert wrote:
>> You probably have to match the compiler and matlab: Either both
>> 32 bit or both 64 bit.
>
> It's my impression that the compiler itself (as a program) could be
> 64bit, but that it would need to generate 32bit executables. Thus, I
> can use a 64bit compiler, as long as I use 32bit libraries. Is this right?

Assuming the compiler has a switch to _generate_ 32-bit code as well as
64, chances are at least reasonable.

> If so, I just need to find the right libraries and set FC_LIBDIR and
> FC_LIBDIR2 in my mexopts.sh file accordingly. Does this sound right?

See above. They'll have to be consistent; I don't think you'll have any
luck mixing.

--