<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello everybody,<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
I am having issues in compiling the source files in the
$IPOPTDIR/Ipopt/contrib/MatlabInterface/src folder.<br>
<br>
Here the Makefile:<br>
<br>
<blockquote><small># Copyright (C) 2007, 2009 Peter Carbonetto. All
Rights Reserved.<br>
# This code is published under the Eclipse Public License.<br>
#<br>
# Author: Peter Carbonetto<br>
# Dept. of Computer Science<br>
# University of British Columbia<br>
# May 19, 2007<br>
<br>
# INSTRUCTIONS: Please modify the following few variables. See
the<br>
# Ipopt documentation (Ipopt/doc/documentation.pdf) for more
details.<br>
<br>
# This variable corresponds to the base directory of your MATLAB<br>
# installation. This is the directory so that in its 'bin/'<br>
# subdirectory you see all the matlab executables (such as
'matlab',<br>
# 'mex', etc.)<br>
MATLAB_HOME = /usr/local/MATLAB/R2012b<br>
<br>
# Set the suffix for matlab mex files. The contents of the<br>
# $(MATLAB_HOME)/extern/examples/mex directory might be able to
help<br>
# you in your choice.<br>
MEXSUFFIX = mexa64<br>
<br>
# This is the command used to call the mex program. Usually, it
is<br>
# just "mex". But it also may be something like<br>
# /user/local/R2006b/bin/mex if "mex" doesn't work.<br>
MEX = $(MATLAB_HOME)/bin/mex<br>
#MEX = "$(MATLAB_HOME)/sys/perl/win32/bin/perl" "`$(CYGPATH_W)
"$(MATLAB_HOME)/bin/mex.pl"`"<br>
<br>
#############################################################################<br>
# Do not modify anything below unless you know what you're
doing.<br>
exec_prefix = ${prefix}<br>
prefix = /home/gianpaolo/Ipopt/install<br>
libdir = ${exec_prefix}/lib<br>
<br>
CXX = g++<br>
CXXFLAGS = -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses
-Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings
-Wconversion -Wno-unknown-pragmas -Wno-long-long -DIPOPT_BUILD
-DMATLAB_MEXFILE # -DMWINDEXISINT<br>
LDFLAGS = $(CXXFLAGS) -Wl,--rpath
-Wl,/home/gianpaolo/Ipopt/install/lib #-static-libgcc
-static-libstdc++<br>
<br>
# Include directories (we use the CYGPATH_W variables to allow
compilation with Windows compilers)<br>
INCL =
`PKG_CONFIG_PATH=/home/gianpaolo/Ipopt/install/lib64/pkgconfig:/home/gianpaolo/Ipopt/install/lib/pkgconfig:/home/gianpaolo/Ipopt/install/share/pkgconfig:
pkg-config --cflags ipopt`<br>
#INCL = -I`$(CYGPATH_W)
/home/gianpaolo/Ipopt/install/include/coin` <br>
<br>
# Linker flags<br>
LIBS =
`PKG_CONFIG_PATH=/home/gianpaolo/Ipopt/install/lib64/pkgconfig:/home/gianpaolo/Ipopt/install/lib/pkgconfig:/home/gianpaolo/Ipopt/install/share/pkgconfig:
pkg-config --libs ipopt | sed -e 's/-framework vecLib//g'`<br>
##LIBS = -link -libpath:`$(CYGPATH_W)
/home/gianpaolo/Ipopt/install/lib` libipopt.lib -lm -ldl<br>
#LIBS = -L/home/gianpaolo/Ipopt/install/lib -lipopt `echo -lm
-ldl | sed -e 's/-framework vecLib//g'`<br>
LIBS_STATIC = $(LIBS)<br>
#LIBS_STATIC = $$(echo " $(LIBS) " | sed -e "s| -lgfortran |
`gfortran -print-file-name=libgfortran.a` |g" -e "s| -lquadmath
| `gfortran -print-file-name=libquadmath.a` |g")<br>
##LIBS_STATIC = $$(echo " $(LIBS) " | sed -e 's|
-Wl,-Bdynamic,-lmwma57,-Bstatic | -lmwma57 |g')<br>
# mex doesn't understand -Wl,-Bdynamic,-lmwma57,-Bstatic on
Windows<br>
<br>
# The following is necessary under cygwin, if native compilers
are used<br>
CYGPATH_W = echo<br>
<br>
#MEXFLAGCXX = <br>
MEXFLAGCXX = -cxx<br>
MEXFLAGS = -v $(MEXFLAGCXX) -O CC="$(CXX)" CXX="$(CXX)"
LD="$(CXX)" \<br>
COPTIMFLAGS="$(CXXFLAGS)"
CXXOPTIMFLAGS="$(CXXFLAGS)" \<br>
LDOPTIMFLAGS="$(LDFLAGS)" <br>
<br>
TARGET = ipopt.$(MEXSUFFIX)<br>
OBJS = matlabexception.o \<br>
matlabfunctionhandle.o \<br>
matlabjournal.o \<br>
iterate.o \<br>
ipoptoptions.o \<br>
options.o \<br>
sparsematrix.o \<br>
callbackfunctions.o \<br>
matlabinfo.o \<br>
matlabprogram.o \<br>
ipopt.o<br>
<br>
SRCDIR = .<br>
VPATH = $(SRCDIR)<br>
<br>
all: $(TARGET)<br>
<br>
install: $(TARGET)<br>
if test -d $(libdir); then : ; else mkdir $(libdir); fi<br>
cp $(SRCDIR)/../ipopt.m $(SRCDIR)/../ipopt_auxdata.m
$(TARGET) $(libdir)<br>
<br>
uninstall:<br>
rm -f $(libdir)/ipopt.m $(libdir)/ipopt_auxdata.m
$(libdir)/ipopt.$(MEXSUFFIX)<br>
<br>
$(TARGET): $(OBJS)<br>
make mexopts<br>
$(MEX) $(MEXFLAGS) $(LIBS_STATIC) -output $@ $^<br>
<br>
%.o: %.cpp<br>
../../../../libtool --tag=CXX --mode=compile \<br>
$(CXX) $(CXXFLAGS) $(INCL) -I"$(MATLAB_HOME)/extern/include"
\<br>
-o $@ -c $^<br>
<br>
clean:<br>
rm -f $(OBJS) *.lo $(TARGET)<br>
<br>
distclean: clean<br>
<br>
GM_ADD_LIBS_STATIC = <br>
#GM_ADD_LIBS_STATIC = GM_ADD_LIBS="-static $$GM_ADD_LIBS";<br>
<br>
# make mexopts applies a set of fixes to mexopts.sh on Mac,<br>
# or mexopts.bat on Windows (if that file was generated<br>
# by Gnumex to use gcc via Cygwin or MinGW)<br>
mexopts:<br>
case `uname` in \<br>
Darwin*) \<br>
if ! test -e mexopts.sh; then \<br>
sed -e 's/-arch $$ARCHS//g' \<br>
$(MATLAB_HOME)/bin/mexopts.sh > mexopts.sh; \<br>
SDKROOT=`grep -m1 'SDKROOT=' mexopts.sh | sed -e
's/SDKROOT=//g'`; \<br>
if ! test -d $$SDKROOT; then \<br>
sed -e 's/-arch $$ARCHS//g' \<br>
-e 's/-isysroot $$SDKROOT//g' \<br>
-e 's/-Wl,-syslibroot,$$SDKROOT//g' \<br>
$(MATLAB_HOME)/bin/mexopts.sh > mexopts.sh; \<br>
fi; \<br>
fi \<br>
;; \<br>
MINGW*) \<br>
if ! test -e mexopts.bat; then \<br>
echo Warning: no mexopts.bat found. You will probably
need to run Gnumex to generate this file. Call \"make gnumex\"
then try again.; \<br>
else \<br>
libdirwin=$$(cd $(libdir); cmd /c 'for %i in (.) do
@echo %~fi' | sed 's|\\|/|g'); \<br>
mingwlibdirwin=$$(cd /mingw/lib; cmd /c 'for %i in (.)
do @echo %~fi' | sed 's|\\|/|g'); \<br>
GM_ADD_LIBS=$$(echo "-llibmx -llibmex -llibmat $(LIBS)
" | \<br>
sed -e "s| -L$(libdir) | -L$$libdirwin |g" \<br>
-e "s| -L/mingw/lib | -L$$mingwlibdirwin |g"); \<br>
$(GM_ADD_LIBS_STATIC) \<br>
cp mexopts.bat mexopts.bat.orig; \<br>
sed -e 's|COMPILER=gcc|COMPILER=g++|' -e
's|GM_MEXLANG=c$$|GM_MEXLANG=cxx|' \<br>
-e "s|GM_ADD_LIBS=-llibmx -llibmex
-llibmat$$|GM_ADD_LIBS=$$GM_ADD_LIBS|" \<br>
mexopts.bat.orig > mexopts.bat; \<br>
fi \<br>
;; \<br>
CYGWIN*) \<br>
if ! test -e mexopts.bat; then \<br>
echo Warning: no mexopts.bat found. You will probably
need to run Gnumex to generate this file. Call \"make gnumex\"
then try again.; \<br>
else \<br>
libdirwin=`cygpath -m $(libdir)`; \<br>
cyglibdirwin=`cygpath -m /usr/lib`; \<br>
GM_ADD_LIBS=$$(echo "-llibmx -llibmex -llibmat $(LIBS)
" | \<br>
sed -e "s| -L$(libdir) | -L$$libdirwin |g" \<br>
-e "s| -L/usr/lib/| -L$$cyglibdirwin/|g"); \<br>
$(GM_ADD_LIBS_STATIC) \<br>
cp mexopts.bat mexopts.bat.orig; \<br>
sed -e 's|COMPILER=gcc|COMPILER=g++|' -e
's|GM_MEXLANG=c$$|GM_MEXLANG=cxx|' \<br>
-e "s|GM_ADD_LIBS=-llibmx -llibmex
-llibmat$$|GM_ADD_LIBS=$$GM_ADD_LIBS|" \<br>
mexopts.bat.orig > mexopts.bat; \<br>
fi \<br>
;; \<br>
esac<br>
<br>
# make gnumex opens a Matlab session and calls the Gnumex tool
to<br>
# generate mexopts.bat set up for using gcc via Cygwin or MinGW<br>
gnumex:<br>
if ! test -d "$(SRCDIR)/../gnumex"; then \<br>
echo "Warning: no gnumex folder found. Run \"cd `dirname
$(SRCDIR)`; ./get.Gnumex\" first."; \<br>
else \<br>
GM_COMMANDS="oldpwd=pwd; cd $(SRCDIR)/../gnumex;
gnumex('startup'); \<br>
gnumexopts=gnumex('defaults');
gnumexopts.precompath=[pwd '\libdef']; \<br>
gnumexopts.optfile=[oldpwd '\mexopts.bat'];"; \<br>
case `uname` in \<br>
MINGW*) \<br>
echo Use gnumex in Matlab to create mexopts.bat file,
then close this new instance of Matlab.; \<br>
"$(MATLAB_HOME)/bin/matlab" -wait -r "$$GM_COMMANDS \<br>
gnumexopts.mingwpath=fileparts(gnumexopts.gfortpath);
gnumex('struct2fig',gnumexopts)" \<br>
;; \<br>
CYGWIN*) \<br>
echo Use gnumex in Matlab to create mexopts.bat file,
then close this new instance of Matlab.; \<br>
"$(MATLAB_HOME)/bin/matlab" -wait -r "$$GM_COMMANDS
gnumexopts.environ=3; gnumex('struct2fig',gnumexopts)" \<br>
;; \<br>
esac \<br>
fi<br>
</small></blockquote>
Here the problem:<br>
<br>
<blockquote><small>----------------------------------------------------------------</small><br>
<br>
<br>
<small>Warning: You are using gcc version "4.8.2-19ubuntu1)". The
version</small><br>
<small> currently supported with MEX is "4.4.6".</small><br>
<small> For a list of currently supported compilers see: </small><br>
<small>
<a class="moz-txt-link-freetext" href="http://www.mathworks.com/support/compilers/current_release/">http://www.mathworks.com/support/compilers/current_release/</a></small><br>
<br>
<br>
<small> <b>mex: matlabexception.o not a normal file or does
not exist.</b></small><br>
<br>
<small>make: *** [ipopt.mexa64] Error 1</small><br>
</blockquote>
I have just followed the guide at the link:
<a class="moz-txt-link-freetext" href="http://www.coin-or.org/Ipopt/documentation/node18.html">http://www.coin-or.org/Ipopt/documentation/node18.html</a> and all the
previous steps were successful.<br>
<br>
Can you help me?<br>
<br>
Thank you,<br>
<br>
Gianpaolo Gulletta<br>
</body>
</html>