Re: mex compile probem



dustin wrote:
> Hi, I'm running matlab 7 and trying a simple compilation on a linux
> cluster in my home directory.
>
> mex -v -V5 yprime.c
> produces this output
>
> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
> FILE = /fs/user1/u6/dth128/.matlab/R14/mexopts.sh
> ----------------------------------------------------------------
> -> MATLAB = /usr/local/matlab701
> -> CC = gcc
> -> CC flags:
> CFLAGS = -fPIC -ansi -D_GNU_SOURCE -pthread
> -fexceptions -m32
> CDEBUGFLAGS = -g
> COPTIMFLAGS = -O -DNDEBUG
> CLIBS =
> -Wl,--rpath-link,/usr/local/matlab701/bin/glnx86
> -L/usr/local/matlab701/bin/glnx86 -lmx -lmex -lmat -lm -lm -lstdc++
> arguments = -DV5_COMPAT
> -> CXX = g++
> -> CXX flags:
> CXXFLAGS = -fPIC -ansi -D_GNU_SOURCE -pthread
> CXXDEBUGFLAGS = -g
> CXXOPTIMFLAGS = -O -DNDEBUG
> CXXLIBS =
> -Wl,--rpath-link,/usr/local/matlab701/bin/glnx86
> -L/usr/local/matlab701/bin/glnx86 -lmx -lmex -lmat -lm -lm
> arguments = -DV5_COMPAT
> -> FC = g77
> -> FC flags:
> FFLAGS = -fPIC -fexceptions
> FDEBUGFLAGS = -g
> FOPTIMFLAGS = -O
> FLIBS =
> -Wl,--rpath-link,/usr/local/matlab701/bin/glnx86
> -L/usr/local/matlab701/bin/glnx86 -lmx -lmex -lmat -lm -lm -lstdc++
> arguments =
> -> LD = gcc
> -> Link flags:
> LDFLAGS = -pthread -shared -m32
> -Wl,--version-script,/usr/local/matlab701/extern/lib/glnx86/mexFunctio
> n.map
> LDDEBUGFLAGS = -g
> LDOPTIMFLAGS = -O
> LDEXTENSION = .mexglx
> arguments =
> -> LDCXX =
> -> Link flags:
> LDCXXFLAGS =
> LDCXXDEBUGFLAGS =
> LDCXXOPTIMFLAGS =
> LDCXXEXTENSION =
> arguments =
> ----------------------------------------------------------------
>
> -> gcc -c -I/usr/local/matlab701/extern/include
> -I/usr/local/matlab701/simulink/include -DMATLAB_MEX_FILE -fPIC -ansi
> -D_GNU_SOURCE -pthread -fexceptions -m32 -DV5_COMPAT -O -DNDEBUG
> yprime.c
>
> cc1: Invalid option `32'
>
> mex: compile of 'yprime.c' failed.
>
> ??? Error using ==> mex
> Unable to complete successfully
>
> Does anyone have any idea how to make this compile properly. I'm new
> to mex and to compiling C code. I downloaded some software that
> needed compilation and it's really holding me up.
>
> Thanks a lot,
> Dustin


Obviously your GCC does not support the -m32 option. If it's an older version,
perhaps upgrading it would support -m32? Other than that, edit your mexopts.sh
and remove the -m32 flags.

In case you weren't sure your mexopts file should be:
/fs/user1/u6/dth128/.matlab/R14/mexopts.sh
.



Relevant Pages

  • mex compile probem
    ... I'm running matlab 7 and trying a simple compilation on a linux ... -> CXX flags: ... -> Link flags: ... mex: compile of 'yprime.c' failed. ...
    (comp.soft-sys.matlab)
  • Re: mcc vs mex with OpenMP
    ... I have found that my C code threads correctly when compiled with MEX for use as a MEX code, but the code does not work when compiled with mcc. ... The mex compilation will fail, because the compiler recognizes that this is an invalid OMP directive. ... You are correct, mcc compilation fails to detect the #pragma omp error, whereas MEX successfully detects the #pragma omp error. ...
    (comp.soft-sys.matlab)
  • Re: mex -L option
    ... compilation. ... When I type the matlab command line ... Warning: abc.lib specified with -l option not found on ... seem to work with the mex command. ...
    (comp.soft-sys.matlab)
  • Re: mex-setup for both fortran AND c
    ... Michael Wild wrote: ... the parameters for the compilation ... can easily be found by the -n switch to the "mex" function. ...
    (comp.soft-sys.matlab)
  • RE: precompile
    ... Site precompilation brings a double benefit: ... delay for requests because of compilation and no need of deploying source ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet)