Thread Subject: Compiling MEX files for use on platforms with different versions of GCC

Subject: Compiling MEX files for use on platforms with different versions of GCC

From: James

Date: 22 Mar, 2010 03:59:05

Message: 1 of 1

Hello,

I have MEX code I want to compile for use on RedHat, which uses GCC 4.1 and libgfortran1. I want to do the compile with GCC 4.4.1 on my Ubuntu box, and be able to just copy the MEX file over. (The reasons I want to do this particular set of operations isn't all that important, lets just say I have to do it this way). Right now, GCC 4.4.1 links to shared versions of libgfortran2 or libgfortran3, depending. Is there a way to force the MEX file to use NO shared libraries at all? I've tried a couple GCC options like --no-shared and --static-only (or similar, I don't them in front me as I write this), but this does not do it.

I assume part of the problem could be that I don't have static (lib*.a) versions of libgfortran, any hints on how I can go about getting it? Its not in the repo-provided files, or in the Hardy CD install like it was supposed to be, and I'd rather not end up compiling GCC/gfortran from source.

I also thought about compiling with GCC 4.1 on my Ubuntu box, but of course it does not use libgfortran1 like the RedHat version of GCC 4.1, and I haven't had much luck wading through the GCC CVS to try to find it and then compile it.

Bottom line: How can I compile with only static libraries so that the MEX code is entirely self-contained in terms of libraries, except for maybe the MEX library for use on two computers that don't share GCC/libgfortran versions.

Thanks!

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
gcc James Burkert 22 Mar, 2010 00:04:07
mex James Burkert 22 Mar, 2010 00:04:07
crossplatform James Burkert 22 Mar, 2010 00:04:07
libgfortran James Burkert 22 Mar, 2010 00:04:07
rssFeed for this Thread

Contact us at files@mathworks.com