Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: C program works on 32-bit machine but corresponding mex file doesn't
on 64-machine.

Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
sunny

Posts: 5
Registered: 1/10/08
C program works on 32-bit machine but corresponding mex file doesn't
on 64-machine.

Posted: Dec 5, 2008 6:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

1. I have some C programs which were written on 32-bit machines and
work very well on those machines. Of late, for some specific
applications, I would like to use same programs on MATLAB (as mex
files). The problem is in my work environment I can access MATLAB on
64-bit CentOS 5.2 Linux machines only where my programs yield errors
in their outputs in MATLAB (though they do compile; I have set MATLAB
to use gcc compiler; gcc version on these amchines is 4.1.2).

2. However, if I compile and run same programs on these 64-bit
machines using gcc (on command line) with -m32 option (in my
Makefile), they all give correct output.

3. Even if I add -m32 option in CFLAGS under glnxa64 section in
mexopts.sh, the mex files don't compile and give following error:
(when the name of my c mex file is test_mex.c)
/usr/bin/ld: warning: i386 architecture of input file `test_mex.o' is
incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `mexversion.o'
is incompatible with i386:x86-64 output

Is there a way I can make MATLAB use 32-bit compiler on this 64-bit
machine and make my programs work?

Any help would be greatly appreciated.

Sincerely,
Sunny Mishra.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.