New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple compilation procedure with MATLAB R2014a #2
Comments
Hi, Compiling these MEX files is notoriously difficult, especially when combining Fortran and C++ code. Unfortunately, developing an install script that works for all computers is beyond my capabilities. I'm glad to hear that you eventually found a solution. I will include your suggestion in the README file in case anyone else encounters a similar problem. Thanks again for your feedback. |
Hi, As a shortcut to compile and use lbfgsb, here is what I did to compile your code on linux terminal. First compile .f files with ' gfortran -c -fPIC solver30.f linpack.f timer.f blas.f ' |
Nice! That's a great tip. Thanks for sharing. |
Hi, Using the command: mex -c -outdir objfiles/ solver_3_0.f blas.f linpack.f timer.f gives the following error: I used this: and also mex -setup Fortran and got Could you please help how to solve this issue? I am using trial Matlab 2020a. Thanks in advance, |
@emadenany Please follow the instructions given at https://www.mathworks.com/support/compilers. |
@pcarbo Thank you very much. I have installed the MATLAB Support for MinGW-w64 C/C++ Compiler. I couldn't find a FORTRAN compiler, could you help me find it? When tried the command: mex -v -g -c -f mexopts_fortran.bat solver30.f I got: Could you help me on how to fix this issue? Thank you, |
Hi @emadenany, I'm sorry, I am not familiar with the Fortran compilers available on Windows; I work mainly in Linux and Mac environments. |
Hi @pcarbo thank you. Please, if I chose to install Linux, do I need to install Matlab on Linux too? |
Yes, you would. |
Thank you very much. |
Hi,
with my MATLAB version (R2014a) it was not possible to compile lbfgsb using:
mex -output lbfgsb *.cpp solver.f
Error using mex
Cannot compile both C++ and FORTRAN source files in a single call to MEX.
Spending the better half of a day I figured out I can compile it by first compiling the fortran files to object files and linking them to the cpp files with a second run of mex:
mkdir objfiles
mex -c -outdir objfiles/ solver30.f blas.f linpack.f timer.f
mex -lgfortran -output lbfgsb *.cpp objfiles/blas.o objfiles/linpack.o objfiles/solver30.o objfiles/timer.o
rmdir('objfiles','s')
I tested that it works with examplehs038.m
The text was updated successfully, but these errors were encountered: