Hi Alexandr,

Thank you for your suggestion. That seems to have solved my problem!

Now, I would just like to understand the subtleness of the situation.

The entire example (taken from Mathlab examples directory) I am working with is:

#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "engine.h"

int main()
{
    Engine *ep;
    if (!(ep = engOpen("\0")))
    {
       fprintf(stderr, "\nCan't start MATLAB engine\n");
       return EXIT_FAILURE;
    }
    else
    {
        // main loop
      while (true)
       {
       // do stuff
       ...
       }
       engClose(ep);
    }
}


I am compiling this with the following command (running this command in linux 
62 or linux 32 produces an identical binary):

gcc -m32 myexaple.c -o myexample -I/mathlab/include/dir -L/usr/lib 
-L/mathlab/lib/dir -leng -lmx

When I run myexample in a 32b booted linux it works fine and the mathlab engine 
is "opened" normally.
When I run the same in a 64b booted linux the engine does not open and I get 
the EXIT_FAILURE condition.

Finally, if I run 'linux32 myexample' under a 64b booted linux it also works 
fine! So it seems, for some applications, just running
a 32b executible under 64b environment is not enough, or am I wrong it trying 
to run *any* 32b executible *without* prefixing it
with "linux32" ?

Any insight would be greatly appreciated!

Vahe Avedissian




--- Original Message ----
From: Alexandr Malusek <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, August 31, 2007 11:10:01 AM
Subject: Re: [opensuse] 32b compiled program not running in 64x environment -  
open SuSE 10.2

On Thursday 30 August 2007 00:31, Vahe Avedissian wrote:
...
> I have open SuSE 10.2 32 and 64 bit installed on the same machine.
>
> I compile a small matlab example under 32b (either by booting 32b linux or
> -m32 compiler flag) and run under 32 and 64 bit linux. The code compiles
> under both environments.
>
> However, the code runs normally under 32b linux, but the 64b linux runtime
> causes an error condition and the sample code exits.

As a workaround, you can install and run the 32-bit version of Matlab under 
64-bit openSUSE.  On our servers, we put the 32-bit version 
into /lw/matlab/7.4 and the 64-bit one into /lw64/matlab/7.4.  The command 
that simulates the 32-bit environment under 64-bit linux is "linux32":

$ /lw64/matlab/7.4/bin/matlab        # start 64-bit matlab
$ linux32 /lw/matlab/7.4/bin/matlab  # start 32-bit matlab

To install the 32-bit version of Matlab, run "linux32 install".

If I remember it right, several Matlab toolboxes were available for the 32-bit 
version only some time ago.  In other words, they were 32-bit and didn't run 
under the 64-bit Matlab---just as your code.  Mathworks may tell you more.

--
A.M.
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






      
____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to