Hello,
I am trying to compile swIMP on MacOS X, but I am stuck.
I downloaded the latest version of swIMP from the SVN repository. Then I did:
./configure --disable-binbundle CPPFLAGS="-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include -I/opt/local/include"
(I added /opt/local/include because I have installed GLPK using MacPorts.)
Notice I had to edit line 22872 of the configure script to fix what looks like a bug; I replaced
if x$hasMosek = xtrue ; then
with
if test x$hasMosek = xtrue ; then
I am attaching configure.log.
Then I ran make, and I got the following message:
ls: dist/*.jar: No such file or directory
make all-recursive
ls: dist/*.jar: No such file or directory
Making all in iface
Makefile:38: *** missing separator. Stop.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Thank you very much in advance.
OK... I managed to get a bit further, but now I am stuck again.
First, I had to fix the use of if statements in iface/Makefile, which were responsible for the "missing separator" error. That error message was clearly wrong; it should have read something like "syntax error," since if statements do not seem to be supported in makefiles (only ifeq, ifneq, ifdef and ifndef).
Now I am getting the following errors when I run make forcegen:
ls: dist/*.jar: No such file or directory
make -C iface forcegen
rm -f -f *_wrap.cxx
make
rm -f -rf /../java/net/sourceforge/swimp/coin
p /../java/net/sourceforge/swimp/coin
make[2]: p: No such file or directory
make[2]: [coin_wrap.cxx] Error 1 (ignored)
c++ -java \ \ -I.. -Icoin -Icoin/static \ -I/../coin/include -I/coin \ -package net.sourceforge.swimp.coin \ -outdir /../java/net/sourceforge/swimp/coin \ -o coin_wrap.cxx \ coin.i
i686-apple-darwin10-g++-4.2.1: net.sourceforge.swimp.coin: No such file or directory
i686-apple-darwin10-g++-4.2.1: /../java/net/sourceforge/swimp/coin: No such file or directory
i686-apple-darwin10-g++-4.2.1: coin.i: No such file or directory
i686-apple-darwin10-g++-4.2.1: no input files
make[2]: [coin_wrap.cxx] Error 1 (ignored)
p coin/static
make[2]: p: No such file or directory
make[2]: [coin_wrap.cxx] Error 1 (ignored)
coin/static/ -name "*.java" -exec {} /../java/net/sourceforge/swimp/coin \;
/bin/sh: coin/static/: is a directory
make[2]: *** [coin_wrap.cxx] Error 126
make[1]: *** [forcegen] Error 2
make: *** [forcegen] Error 2
It appears some of the variables are not set properly:
$(srcdir) is empty, which results in make attempting to rm -f -rf /../java/net/sourceforge/swimp/coin
$(MKDIR) is empty, which results in make attempting to execute the command "p" instead of the command $(MKDIR) -p
$(SWIGFLAGS), $(AM_CPPFLAGS), and $(CPPFLAGS) are also empty, even though I passed configure the option:
CPPFLAGS="-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include -I/opt/local/include -I/path/to/my/coin/include"
$(LOCALINCLUDE) = "-I/../coin/include -I/coin" even though I explicitly told configure to NOT use the coin binaries; by passing it both options:
--disable-binbundle
and
--enable-binbundle=no
both of which seem to be ignored
By the way, I forgot to mention before that I had to cp iface/Makefile.am iface/Makefile.in, otherwise config would complain about the absence of Makefile.in.
Thanks in advance for you help.
Hi Thomas, thanks for your detailed report. I would be great if you were able to run swIMP on MacOS. Let me see if I can help:
I have fixed the following problems with non-standard compliant expressions in Makefiles:
- Always use an explicit call to 'test' in configure.in
- Use find instead of ls to search for dist/*.jar (avoids the error message if there are no such files yet)
- Use ifdef instead of if in iface/Makefile.am
I think that the problems with undefined variables that should have been set by the configure script has been caused by your manual copy of Makefile.am to Makefile.in. Actually, configure should transform those files. A simple copy will not be enough.
Thus, I suggest that you retry with a fresh version that you download directly from svn. This version will contain all fixes listed above and should thus work without manual intervention. If you encounter problems, please report them before manually trying to solve the problem. If you are successful, I would appreciate a brief update.
New config log
Thank you very much for your quick support!
With a fresh SVN checkout, I am still getting the error message about a missing iface/Makefile.in:
config.status:922: creating Makefile
config.status:908: error: cannot find input file: `iface/Makefile.in'
I have updated the attached config.log.
OK... I just got a few steps further.
configure is complaining about a missing iface/Makefile.in because this file was never generated. Why was it never generated? Bbecause I had skipped a step in the installation process. I hadn't first run prepareGnuBuild.sh. Note: this step is only mentioned in the developer instructions, not in the general installation instructions, which is why I had missed it before.
Now; we're still not quite there yet. First of all, prepareGnuBuild.sh calls libtoolize, which is not installed by default in Mac OS 10.6. One way to install it is to build and install a newer version of libtool using MacPorts. But then libtoolize is actually installed under the name "glibtoolize," where the "g" was probably added so as not to conflict with the default Mac OS X installation. So, I had to add this "g" to prepareGnuBuild.sh.
Furthermore, it is necessary to revert the last changes made to iface/Makefile.am, by changing all ifdefs back to ifs.
Now, the error I am facing is the following:
configure: creating ./config.status
config.status: creating Makefile
config.status: creating iface/Makefile
config.status: creating iface/perftest/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
rm: libtoolT: No such file or directory
Where do we go from here?... Thanks.
Getting there, one step at a time...
So, I now assume that the error "rm: libtoolT: No such file or directory" is benign. I fixed this by editing config.status, replacing $RM with $RM -f in the following lines:
cfgfile="${ofile}T"
trap "$RM -f \"$cfgfile\"; exit 1" 1 2 15
$RM -f "$cfgfile"
Now, when I run make forcegen, I am getting the following error:
make -C iface forcegen
/bin/rm -f *_wrap.cxx
make
Making all in perftest
g++ -DHAVE_CONFIG_H -I. -I../.. -I./../../coin/include -I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include -I/path/to/my/coin/include -g -O2 -MT setVectorPerf.o -MD -MP -MF .deps/setVectorPerf.Tpo -c -o setVectorPerf.o setVectorPerf.cc
In file included from ./../../coin/include/CoinFloatEqual.hpp:10,
from ./../../coin/include/CoinPackedVectorBase.hpp:14,
from ./../../coin/include/CoinPackedVector.hpp:13,
from setVectorPerf.cc:24:
./../../coin/include/CoinFinite.hpp: In function ‘bool CoinIsnan(double)’:
./../../coin/include/CoinFinite.hpp:112: error: ‘isnan’ was not declared in this scope
make[3]: *** [setVectorPerf.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [forcegen] Error 2
make: *** [forcegen] Error 2
What I don't understand is why g++ is passed the option -I./../../coin/include. Shouldn't this option be disabled by --disable-binbundle? I am already passing g++ the option -I/path/to/my/coin/include, which contains the hpp files that were created when I manually installed the latest version of CBC (version 2.7). Or, is it the case that swIMP simply cannot be built against CBC 2.7, and I am forced to use an older version corresponding to the linux binaries distributed with swIMP? What version is it, by the way? Is it version 2.20, as stated in the online swIMP documentation (Section Environment)?
Thanks again for your help
Here is how I fixed the incorrect -I (and -L) options:
In iface/Makefile and iface/perftest/Mafile, I looked for all occurrences of -I and -L, and commented out all those that were redundant with my installation of CBC. Namely:
JAVA_INCLUDE = $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
# LOCALINCLUDE variable is used both for the compiler and for SWIG
LOCALINCLUDE = -I$(srcdir)/../coin/include -I$(srcdir)/coin
INCLUDES = #$(LOCALINCLUDE) $(JAVA_INCLUDE)
LIBS = -lOsi -lCoinUtils #-L$(srcdir)/../coin
INCLUDES = #-I$(srcdir)/../../coin/include
Now, I was able to go much farther than before: I have build all libswIMPOsi*.
But now, it wants to also build for Vol. I don't have Vol. Why isn't it ignored?
Thanks
I can confirm the same issues with the most recent trunk. I changed the Makefile.am -> Makefile.in in iface and iface/perftest
Configured with my standard parameters
./configure F77=gfortran CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ LDFLAGS="-flat_namespace" FFLAGS="-fexceptions -m64 -fbackslash" CFLAGS="-fno-common -m64" CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers" CXXFLAGS="-fno-common -fexceptions -m64" -disable-shared
make gives
ls: dist/*.jar: No such file or directory
make all-recursive
ls: dist/*.jar: No such file or directory
Making all in iface
make[2]: *** No rule to make target `all'. Stop.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
make forcegen gives
ls: dist/*.jar: No such file or directory
make -C iface forcegen
rm -f -f *_wrap.cxx
make
rm -f -rf /../java/net/sourceforge/swimp/coin
p /../java/net/sourceforge/swimp/coin
make[2]: p: No such file or directory
make[2]: [coin_wrap.cxx] Error 1 (ignored)
c++ -java \ \ -I.. -Icoin -Icoin/static \ -I/../coin/include -I/coin \ -package net.sourceforge.swimp.coin \ -outdir /../java/net/sourceforge/swimp/coin \ -o coin_wrap.cxx \ coin.i
i686-apple-darwin10-g++-4.2.1: net.sourceforge.swimp.coin: No such file or directory
i686-apple-darwin10-g++-4.2.1: /../java/net/sourceforge/swimp/coin: No such file or directory
i686-apple-darwin10-g++-4.2.1: coin.i: No such file or directory
i686-apple-darwin10-g++-4.2.1: no input files
make[2]: [coin_wrap.cxx] Error 1 (ignored)
p coin/static
make[2]: p: No such file or directory
make[2]: [coin_wrap.cxx] Error 1 (ignored)
coin/static/ -name "*.java" -exec {} /../java/net/sourceforge/swimp/coin \;
/bin/sh: coin/static/: is a directory
make[2]: *** [coin_wrap.cxx] Error 126
make[1]: *** [forcegen] Error 2
make: *** [forcegen] Error 2
Ideas?
VICTORY!!!
Here is the procedure to compile swIMP on Mac OS X, with support for COIN-OR only (no GLPK nor MOSEK). I am using Eclipse.
0) Install the COIN-OR solvers. The way I did it is I checked out the latest stable version of the CoinAll project (currently version 1.6), and I compiled it (excluding unnecessary projects) by following the procedure described on the following webpage:
https://projects.coin-or.org/CoinBinary
I will denote simply as "my_coin/" the folder in which COIN-OR was built.
1) Check out swIMP into a new Eclipse project.
2) In swIMP/prepareGnuBuild.sh, replace libtoolize with glibtoolize
3) In swIMP/iface/Makefile.am, replace all instances of "ifdef" by "if"
This is to revert incorrect changes that were committed to this file.
4) In swIMP/iface/Makefile.am and swIMP/iface/perftest/Makefile.am, comment out the references to the coin folder containing the binaries distributed with swIMP:
LIBS += -lOsi -lCoinUtils #-L$(srcdir)/../coin
INCLUDES = -I$(srcdir)/coin #$(LOCALINCLUDE) $(JAVA_INCLUDE)
LIBS += #-L$(srcdir)/../../coin
INCLUDES = #-I$(srcdir)/../../coin/include
5) Run ./prepareGnuBuild.sh
6) Run:
./configure --disable-binbundle CPPFLAGS="-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include -Imy_coin/include/coin" LDFLAGS="-Lmy_coin/lib"
7) Run "make forcegen"
8) Don't bother running "make" since it will fail trying to compile Java classes that link to GLPK and MOSEK; instead, use Eclipse to compile the Java classes.