Thread Subject: mexing with free Fortran compilers

Subject: mexing with free Fortran compilers

From: rockybalboa

Date: 8 Oct, 2008 02:32:43

Message: 1 of 11

Hi, is it possible to run mex files with a free fortran compiler, like gfortran?

thanks!

Javier

Subject: mexing with free Fortran compilers

From: Rune Allnor

Date: 8 Oct, 2008 07:08:36

Message: 2 of 11

On 8 Okt, 04:32, rockybalboa <javier.bian...@yahoo.com> wrote:
> Hi, is it possible to run mex files with a free fortran compiler, like gfortran?

I suppose you mean 'compile mex files', since you don't
need the compiler anymore once the mex file has been compiled
and linked.

With that proviso: It might be possible but don't expect
it to be easy.

The problem depends a bit on what you mean by 'free':
A free limited version of a commercial compiler or a
freeware compiler?

Each compiler needs a configuration file to work
properly. The configuration file states what compiler
options to use, where to find libraries, and few other
details, all of which vary from compiler to compiler.

Somebody have to set up those configuration files.
For supported compilers, it's the experts at mathworks
who do that, presumably in cooperation with the experts
at the compiler manufacturer.

So if this is a commercial compiler all the info is
available from the manufacturer. The problem if is
the limited free version is crippled so much that
some essential part is missing. This may or may not
be the case - you just have to try and see.

A different problem occurs when one tries to deal with
noncommercial (freeware) software: Where does one call
to get technical support on the compiler? What is the
response time on such calls? Does a technical
documentation exist? Where is it? How accurate is it?
Who is responsible for keeping it up to date? Which
technician is responsible for what part of the compiler?

Such questions are easily answered with the commercial
software vendors, but not with idealistic projects
where people contribute on an ad hoc basis. (Which,
incidentially, is a hard-earned lesson for people
who want to save a few bucks on software lisences
by using free software - they can't get support
when they need it.)

So chances are that no one have the responsibility
to know all the details needed to get a freeware
compiler to work. Which makes it a nightmare for
the Mathworks to get to this info. Which is a very
strong argument to stay very far away from anything
that has to do with freeware compilers.

Which in turn means you might have to do all of the
configurations, troubleshooting and testing yourself.

Rune

Subject: mexing with free Fortran compilers

From: dpb

Date: 8 Oct, 2008 13:16:02

Message: 3 of 11

rockybalboa wrote:
> Hi, is it possible to run mex files with a free fortran compiler, like gfortran?
...

Unlike Rune, I don't see why not and questions on the details such as
noted there well be quickly responded to on the mail list or at
comp.lang.fortran

I've not done so specifically, but can't think it would be terribly
difficult as widely as gfortran is used (and as well supported, even if
it is pro bono).

--

Subject: mexing with free Fortran compilers

From: Rune Allnor

Date: 9 Oct, 2008 10:02:58

Message: 4 of 11

On 8 Okt, 15:16, dpb <n...@non.net> wrote:
> rockybalboa wrote:
> > Hi, is it possible to run mex files with a free fortran compiler, like gfortran?
>
> ...
>
> Unlike Rune, I don't see why not and questions on the details such as
> noted there well be quickly responded to on the mail list or at
> comp.lang.fortran

Well, to get a useful answer one must first ask the right question.
If you start out from scratch and don't know the correct terminology
etc, you might not find the answer you are looking for simply
because you don't know what question to ask.

And there is the time aspect. How much do you (or your employer)
value your time? $50 per hour? $100 per hour? Or if you do this
on your own time - is there anything else you would prefer to do
instead of wrestling with the computer? How long time do you
need to get the thing up and running? Who will pay, either
economically or by abandoning free time, for the efforts?

> I've not done so specifically,

I knew that already, from your first paragraph...

Rune

Subject: mexing with free Fortran compilers

From: dpb

Date: 9 Oct, 2008 14:15:40

Message: 5 of 11

Rune Allnor wrote:
> On 8 Okt, 15:16, dpb <n...@non.net> wrote:
>> rockybalboa wrote:
>>> Hi, is it possible to run mex files with a free fortran compiler, like gfortran?
>> ...
>>
>> Unlike Rune, I don't see why not and questions on the details such as
>> noted there well be quickly responded to on the mail list or at
>> comp.lang.fortran
>
> Well, to get a useful answer one must first ask the right question.
> If you start out from scratch and don't know the correct terminology
> etc, you might not find the answer you are looking for simply
> because you don't know what question to ask.
>
> And there is the time aspect. How much do you (or your employer)
> value your time? $50 per hour? $100 per hour? Or if you do this
> on your own time - is there anything else you would prefer to do
> instead of wrestling with the computer? How long time do you
> need to get the thing up and running? Who will pay, either
> economically or by abandoning free time, for the efforts?
>
>> I've not done so specifically,
>
> I knew that already, from your first paragraph...


Well, excuuuuse me... :(

--

Subject: mexing with free Fortran compilers

From: Bruno Luong

Date: 9 Oct, 2008 19:34:01

Message: 6 of 11

rockybalboa <javier.bianchi@yahoo.com> wrote in message <79567.1223433194255.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hi, is it possible to run mex files with a free fortran compiler, like gfortran?

Probably not easy. What would be easier (?) is compiling fortran code to object files with gfortran, write a wrap around C-mex (with lcc) and link them together.

I have done that with g77, and it works OK.

Bruno

Subject: mexing with free Fortran compilers

From: Steve Amphlett

Date: 9 Oct, 2008 19:40:18

Message: 7 of 11

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gclmb9$g47$1@fred.mathworks.com>...
> rockybalboa <javier.bianchi@yahoo.com> wrote in message <79567.1223433194255.JavaMail.jakarta@nitrogen.mathforum.org>...
> > Hi, is it possible to run mex files with a free fortran compiler, like gfortran?
>
> Probably not easy. What would be easier (?) is compiling fortran code to object files with gfortran, write a wrap around C-mex (with lcc) and link them together.
>
> I have done that with g77, and it works OK.

I agree with Bruno. If you _must_ use free Fortran compilers, it's probably easiest to wrap the code in local, native C.

But you'll need to know what you are doing and have a good grasp on what's going on behind the scenes, which can be expensive (as Rune points out so well).

Subject: mexing with free Fortran/C compilers

From: rockybalboa

Date: 12 Oct, 2008 01:00:14

Message: 8 of 11

thanks for all the commets!

what about mexing with C or C++, are there any non commercial compilers that have been proved to work?

Javier

Subject: mexing with free Fortran/C compilers

From: Bruno Luong

Date: 12 Oct, 2008 06:28:05

Message: 9 of 11

rockybalboa <javier.bianchi@yahoo.com> wrote in message <5287430.1223773244738.JavaMail.jakarta@nitrogen.mathforum.org>...
> thanks for all the commets!
>
> what about mexing with C or C++, are there any non commercial compilers that have been proved to work?
>

Why not using lcc featured in Matlab itself?

You could also try Visual Studio Express, http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13321&objectType=file.

Bruno

Subject: mexing with free Fortran/C compilers

From: Naor Movshovitz

Date: 14 Nov, 2008 04:52:01

Message: 10 of 11

I'm having the following problem with mexing basic programs, even in c. Maybe someone has been there already?

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gcs5dl$7v4$1@fred.mathworks.com>...

> Why not using lcc featured in Matlab itself?

Because lcc does not exist in the MATLAB 64 bit distribution, at least not in mine.

> You could also try Visual Studio Express

I could. VCExpress 2008 is installed and working ok (i.e., compiling "hello world"), but mex can't find it:
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
 
Would you like mex to locate installed compilers [y]/n? y
 
Select a compiler:
 
[0] None
 
Compiler:


I won't be surprised if the problem lies with lack of support for 64 bit windows. Any ideas on how to workaround?

Thanks,
-naor

Subject: mexing with free Fortran compilers

From: Kristjan Jonasson

Date: 28 Nov, 2008 09:00:06

Message: 11 of 11

rockybalboa <javier.bianchi@yahoo.com> wrote in message <79567.1223433194255.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hi, is it possible to run mex files with a free fortran compiler, like gfortran?
>
> thanks!
>
> Javier

Dear all,

Readers of this thread might be interested in trying out gnumex, which provides gcc, g77, gfortran and g95 mexing on Windows. The package is available from sourceforge (http://sourceforge.net/projects/gnumex).

There is documentation provided with the package, and the web page on source forge (http://gnumex.sourceforge.net/) still provides quite useful additional information even if it is now four years old.

Best of luck with it,
Kristj?n J?nasson

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
microsoft windows Kristjan Jonasson 28 Nov, 2008 04:00:25
mex Kristjan Jonasson 28 Nov, 2008 04:00:25
fortran Kristjan Jonasson 28 Nov, 2008 04:00:25
gcc Kristjan Jonasson 28 Nov, 2008 04:00:25
g95 Kristjan Jonasson 28 Nov, 2008 04:00:25
gfortran Kristjan Jonasson 28 Nov, 2008 04:00:25
gnumex Kristjan Jonasson 28 Nov, 2008 04:00:25
free compiler Kristjan Jonasson 28 Nov, 2008 04:00:25
rssFeed for this Thread

Contact us at files@mathworks.com