Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

Anthony Gitter

Hello,

I am attempting to compile a mex file from third-party Fortran code.  I receive the error message:

error: glmnetControl: /SCINGE/glmnet_matlab/glmnetMex.mex: failed to load: /SCINGE/glmnet_matlab/glmnetMex.mex: undefined symbol: mxcopyreal8toptr_

 

To proceed with my debugging, I am trying to determine whether this is a problem with MATLAB and Octave compatibility, the Fortran code, the way I am calling mkoctfile, or something else.

 

This MATLAB page suggests that mxCopyReal8ToPtr is a MATLAB function  https://www.mathworks.com/help/matlab/apiref/mxcopyreal8toptr.html   I found an old thread discussing mxcopyreal8toptr in Octave, but it was not resolved https://lists.gnu.org/archive/html/octave-maintainers/2007-01/msg00052.html

 

I am running Octave inside the mtmiller/octave:5.1.0 Docker container, which uses Ubuntu.  My current compilation attempt is:

mkoctfile --verbose --mex glmnetMex.F GLMnet.f

 

with the full script available at https://github.com/gitter-lab/SCINGE/blob/d1af7d85b879efe11e4e7dd55cb0fe74b2f18de5/install_glmnet_docker.sh and the full error available at https://travis-ci.com/gitter-lab/SCINGE/builds/107149572#L1039

 

The Fortran code, which was written for MATLAB, comes from http://web.stanford.edu/~hastie/glmnet_matlab/download.html

 

I would be grateful for any advice on what to debug next.

 

Thank you,
Anthony



Reply | Threaded
Open this post in threaded view
|

Re: Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

Mike Miller-4
On Fri, Apr 05, 2019 at 14:31:53 +0000, Anthony Gitter wrote:
> I am attempting to compile a mex file from third-party Fortran code. I
> receive the error message:
> error: glmnetControl: /SCINGE/glmnet_matlab/glmnetMex.mex: failed to load: /SCINGE/glmnet_matlab/glmnetMex.mex: undefined symbol: mxcopyreal8toptr_

This function, and all of the other functions in 'fintrf.h' include file,
are not currently part of Octave's mex interface. In general, Octave does
not implement the Matlab Fortran mex interface at all, only the C
interface.

If this is the only undefined function in your project, you could try
compiling in the example implementation in the old mailing list thread
that you pointed to.

Is the Fortran mex interface important to your use of Octave? Would you
like to help to add that capability to Octave?

--
mike


Reply | Threaded
Open this post in threaded view
|

RE: Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

Anthony Gitter
Hi Mike,
Thanks, that is very informative and will guide my next steps.  I expect there are other undefined functions in this code and will need to investigate that further.

The Fortran mex interface is important in order to use this particular third-party package that was originally written for MATLAB.  I'm haven't written Fortran code before, so I don't think I could successfully contribute to adding this support to Octave.

Thanks,
Anthony

P.S. Thanks also for the Octave Docker containers you maintain.  They are perfect for continuous integration testing.

-----Original Message-----
From: Mike Miller [mailto:[hidden email]]
Sent: Friday, April 5, 2019 12:34 PM
To: Anthony Gitter <[hidden email]>
Cc: [hidden email]
Subject: Re: Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

On Fri, Apr 05, 2019 at 14:31:53 +0000, Anthony Gitter wrote:
> I am attempting to compile a mex file from third-party Fortran code. I
> receive the error message:
> error: glmnetControl: /SCINGE/glmnet_matlab/glmnetMex.mex: failed to
> load: /SCINGE/glmnet_matlab/glmnetMex.mex: undefined symbol:
> mxcopyreal8toptr_

This function, and all of the other functions in 'fintrf.h' include file, are not currently part of Octave's mex interface. In general, Octave does not implement the Matlab Fortran mex interface at all, only the C interface.

If this is the only undefined function in your project, you could try compiling in the example implementation in the old mailing list thread that you pointed to.

Is the Fortran mex interface important to your use of Octave? Would you like to help to add that capability to Octave?

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

xfsm1912
In reply to this post by Mike Miller-4
Hi, Mike

I try to copy a fintrf.h file by running 'install fintrf.h
/Applications/Octave-5.1.0.app/Contents/Resources/usr/Cellar/octave-octave-app@5.1.0/5.1.0/include/octave-5.1.0/octave'.
But after running this command, I still cannot compile the glmnetMex.F:

>> mkoctfile --verbose --mex glmnetMex.F GLMnet.f
glmnetMex.F:2:2:

 C     glmnetMex.F
  1~~~~~~~~~
Fatal Error: fintrf.h: No such file or directory
compilation terminated.
/Applications/Octave-5.1.0.app/Contents/Resources/usr/bin/gfortran -c -fPIC
-g -O2 -std=legacy   -I.  -DMEX_DEBUG  glmnetMex.F -o /var/tmp//oct-tSO9FL.o
warning: mkoctfile: building exited with failure status

when I try to locate the fintrf.h, the terminal returns nothing, can you
have an idea about it? Can we directly copy the fintrf.h file to the Octave
directly?

Thank you



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Debugging mex error in Octave: undefined symbol: mxcopyreal8toptr_

Mike Miller-4
On Tue, Aug 20, 2019 at 12:14:00 -0500, xfsm1912 wrote:
> when I try to locate the fintrf.h, the terminal returns nothing, can you
> have an idea about it? Can we directly copy the fintrf.h file to the Octave
> directly?

I believe this has been answered in the previous message. This is not a
feature that Octave provides.

--
mike