Azzera filtri
Azzera filtri

Question regarding an error when building a mex file for Levenberg-Marquardt algorithm: ERROR: '/Applicat​ions/MATLA​B_R2015a.a​pp/bin/mac​i64: No such file or directory' - even though there is

6 visualizzazioni (ultimi 30 giorni)
Hi there,
I'm trying to build a mex file from a Levenberg-Marquardt algorithm written in C by Manolis Lourakis ( Available here). I've done a lot of searching and haven't been able to find a similar problem or a solution to this yet (lots from this forum!).
The author included a C gateway function and I've managed to solve the errors I was getting from the makefile. Now, when I try to build the makefile I am presented with the following error:
/var/folders/w6/c4f9x2qn7zb2srs97ngpvflh0000gn/T//mex_112796979375_74657:
line 2: -L/Applications/MATLAB_R2016b.app/bin/maci64: No such file or directory
Error using mex The command '/usr/bin/xcrun' exited with a return value '0'
Which seems to say that /Applications/MATLAB_R2016b.app/bin/maci64, is not a path to the file 'maci64'. This is strange as when you follow the path, this file is definitely there. The code I used to build the file was used as instructing in the README file:
mex -DHAVE_LAPACK -I.. -O -L</Users/martinmackinnon/Documents/MATLAB/levmar-2.6/levvy> levmar.c -llevmar -lclapack -lblas -lf2c
Where the path with option L, is just the path to all of the files included in the 'levmar' library supplied by the author.
My OS is mac OS 10.12.1 and MATLAB version is MATLAB_R2016b.
I've also tried this on a system operating on OS X 10.11.6 and MATLAB_R2015b, but get the equivalent error.
Any help would be much appreciated.
Thanks a lot.

Risposta accettata

Walter Roberson
Walter Roberson il 5 Gen 2017
/Applications/MATLAB_R2016b.app/bin/maci64 should be a directory not a file.
A complaint about -L/Applications/MATLAB_R2016b.app/bin/maci64 not existing might mean that it has parsed that entire string as if it is a file name to compile instead of as being an option indicating where to find libraries.
mex -DHAVE_LAPACK -I.. -O -L</Users/martinmackinnon/Documents/MATLAB/levmar-2.6/levvy> levmar.c -llevmar -lclapack -lblas -lf2c
The < and > should not be part of the command.

Più risposte (1)

Martin MacKinnon
Martin MacKinnon il 5 Gen 2017
Modificato: Martin MacKinnon il 5 Gen 2017
Just an update. The problem was solved starting with Walter's recommendation. By doing that and taking out -lf2c from the argument, the MEX file was successfully built. Incase anybody is having a similar problem, the Makefile I used for a Mac OS (10.12.1) was:
#
# Unix/Linux GCC Makefile for Levenberg - Marquardt minimization
# Under windows, use Makefile.vc for MSVC
#
CC=gcc
CONFIGFLAGS=#-ULINSOLVERS_RETAIN_MEMORY
#ARCHFLAGS=-march=pentium4 # YOU MIGHT WANT TO UNCOMMENT THIS FOR P4
CFLAGS=$(CONFIGFLAGS) $(ARCHFLAGS) -O3 -funroll-loops -Wall #-ffast-math #-pg
LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
LDFLAGS=-L$(LAPACKLIBS_PATH) -L.
LIBOBJS=lm.o Axb.o misc.o lmlec.o lmbc.o lmblec.o lmbleic.o
LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
DEMOBJS=lmdemo.o
DEMOSRCS=lmdemo.c
AR=ar
RANLIB=ranlib
LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK.
# On systems with a FORTRAN (not f2c'ed) version of LAPACK, -lf2c is
# not necessary; on others, -lf2c is equivalent to -lF77 -lI77
#LAPACKLIBS=-L/usr/local/atlas/lib -llapack -lcblas -lf77blas -latlas -lf2c # This works with the ATLAS updated lapack and Linux_P4SSE2
# from http://www.netlib.org/atlas/archives/linux/
#LAPACKLIBS=-llapack -lgoto2 -lpthread -lf2c # This works with GotoBLAS
# from http://www.tacc.utexas.edu/research-development/tacc-projects/
#LAPACKLIBS=-L/opt/intel/mkl/8.0.1/lib/32/ -lmkl_lapack -lmkl_ia32 -lguide -lf2c # This works with MKL 8.0.1 from
# http://www.intel.com/cd/software/products/asmo-na/eng/perflib/mkl/index.htm
LIBS=$(LAPACKLIBS)
all: liblevmar.a lmdemo
liblevmar.a: $(LIBOBJS)
$(AR) crv liblevmar.a $(LIBOBJS)
$(RANLIB) liblevmar.a
lmdemo: $(DEMOBJS) liblevmar.a
$(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm
lm.o: lm.c lm_core.c levmar.h misc.h compiler.h
Axb.o: Axb.c Axb_core.c levmar.h misc.h
misc.o: misc.c misc_core.c levmar.h misc.h
lmlec.o: lmlec.c lmlec_core.c levmar.h misc.h
lmbc.o: lmbc.c lmbc_core.c levmar.h misc.h compiler.h
lmblec.o: lmblec.c lmblec_core.c levmar.h misc.h
lmbleic.o: lmbleic.c lmbleic_core.c levmar.h misc.h
lmdemo.o: levmar.h
clean:
@rm -f $(LIBOBJS) $(DEMOBJS)
cleanall: clean
@rm -f lmdemo
@rm -f liblevmar.a
depend:
makedepend -f Makefile $(LIBSRCS) $(DEMOSRCS)
# DO NOT DELETE THIS LINE -- make depend depends on it.
and the code to build the mex file is:
mex -DHAVE_LAPACK -I.. -O -L<levmar library dir> levmar.c -llevmar -lclapack -lblas

Categorie

Scopri di più su Write C Functions Callable from MATLAB (MEX Files) in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by