andreasvarga / DescriptorSystemTools

Descriptor System Tools for Matlab
Other
7 stars 1 forks source link

Help wanted to generate mex-files for Linux and Mac. #1

Open andreasvarga opened 3 years ago

andreasvarga commented 3 years ago

The mex-files for Windows have been generated by Vasile Sima, based on the latest developments of the SLICOT library. However, versions of mex-files for Linux and Mac are presently missing. I would highly appreciate any help in generating versions of mex-files for Linux and Mac. This is now possible, since the last version of SLICOT is available on GitHub under a BSD license. To allow the generation of mex-file, the source codes are also freely available (see the mexfiles directory.)

bluesun212 commented 1 month ago

Hey Andreas,

I'm trying to generate the mex files on Ubuntu right now, but I'm having trouble compiling the Fortran files. I built all of the required libraries already, and I believe I've made proper makefiles to build the Fortran source for DSTools. When I run make, the following appears in the terminal while it's attempting to compile sl_glme.F:

( cd src; make -f makefile )
make[1]: Entering directory '[libs]/DescriptorSystemTools-main/mexfiles/src'
gfortran -O2 -fPIC -fdefault-integer-8 -I[matlabroot]/extern/include/ -c CHCKID.F
gfortran -O2 -fPIC -fdefault-integer-8 -I[matlabroot]/extern/include/ -c sl_glme.F
sl_glme.F:183:70:

  183 |       IF ( mxGetM( PRHS(1) ).NE.1 .OR. mxGetN( PRHS(1) ).NE.1 ) THEN
      |                                                                      1
Error: Cannot assign to a named constant at (1)

Unfortunately, I don't know Fortran, so I can't really understand why this error is occurring. Am I not linking the MATLAB header files correctly? Any help would be appreciated. I'd be happy to submit a PR containing the mex files for Linux and Mac if I can get this working.

EDIT 1: I just saw the .m included to generate the mex calls. Running those commands gives the same error unfortunately.

EDIT 2: Alright, nevermind. After some playing around, I got everything to compile properly, and everything seems to work. I had to use the -ffixed-line-length-none option to get it to compile. I'll submit a PR with the Linux and Mac mex files in the coming few weeks!

andreasvarga commented 1 month ago

Thanks for your efforts. I look forward for completion of your work.