Ariel Liebman <alieb...@itee.uq.edu.au> wrote: > Hi Bill, > > I have been trying to compile OM from scratch on a Mac too for a > couple of years without full success. I also have found that the > macports option doesn't work for me. Problem is I am not a unix guru > so get really lost eventually. Have you figured out a way that > consistently works? From the emails up to now it seems not but here's > hoping. > > Cheers, > > Ariel
Hi, Ariel. Attached please find my build notes. I've successfully built it on Leopard, Snow Leopard, and Lion. Unfortunately, what I'm doing is extending OMEdit to incorporate some PARC work, and I have a set of diffs which also contain some diffs to the build machinery. The cheat-sheet assumes application of those diffs, which fix some issues having to do with Mac framework builds of qwt and so forth. So the notes aren't complete, but should get you most of the way. Qt is the biggest headache, in my experience. Anyway, here are my notes -- I hope that they're helpful. Bill ---------------------------------------------------------------------- You need to check out the OM sources from their svn repository. I'm assuming that this checkout (of trunk) is in /local/open-modelica/src/, i.e. % cd /local/open-modelica % svn checkout https://openmodelica.org/svn/OpenModelica/trunk src User username "anonymous", password "none". ---------------------------------------------------------------------- You need to previously install pkg-config (from http://pkgconfig.freedesktop.org/). Use version 0.25, because later versions have a fatal dependency on glib-2. ---------------------------------------------------------------------- You need Qt. QtSDK, in fact. For 10.6 and 10.7, *don't* install the latest Qt binary, because it uses Xcode for builds. Instead, download the SDK and unpack it in /local/QtSDK/. For 10.5, you need to use 4.7.4, and build from source. 4.8.1 will build if you specify -no-webkit on the config line, but OMEdit needs WebKit. Here's the config I used on Leopard (Xcode 3.2.6, 32-bit tool chain): % cd /tmp % curl -O ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz % tar xf qt-everywhere-opensource-src-4.7.4.tar.gz % cd qt-everywhere-opensource-src-4.7.4 % ./configure -prefix /local/open-modelica -qt-libtiff -qt-libpng -qt-libjpeg -sdk /Developer/SDKs/MacOSX10.5.sdk -opensource -confirm-license -platform macx-g++42 -arch x86 % make % make install You may need to apply the patch at qt-4.8.1-Leopard.patch (this directory) first. ---------------------------------------------------------------------- You also need qwt for the OMEdit application. Install from http://downloads.sourceforge.net/project/qwt/qwt/6.0.1/qwt-6.0.1.zip, and first thing, edit qwtconfig.pri to specify /local/open-modelica as the install prefix (instead of /usr/local). On the Mac, it installs as a framework build. Use "--configure --prefix=/local/open-modelica/qwt-6.0.1" to install it with OpenModelica. You might want to add a link from /local/open-modelica/qwt-6.0.1/lib/qwt.framework to /Library/Frameworks/qwt.framework. ---------------------------------------------------------------------- You need CORBA for the Qt clients. Use OmniORB. % cd /tmp % curl -k -L -O http://sourceforge.net/projects/omniorb/files/omniORB/omniORB-4.1.6/omniORB-4.1.6.tar.bz2/download % tar xvf download % cd omniORB-4.1.6 % ./configure --prefix=/local/open-modelica % make % make install ---------------------------------------------------------------------- You need StandardML of New Jersey to build RML: % cd /tmp % curl -O http://smlnj.cs.uchicago.edu/dist/working/110.74/smlnj-x86-110.74.dmg % open smlnj-x86-110.74.dmg % cd /Volumes/smlnj-110.74/ % sudo installer -pkg smlnj-x86-110.74.pkg -target / % sudo ln -s /usr/local/smlnj-110.74/bin/sml /usr/bin/sml ---------------------------------------------------------------------- You need to build "rml+mmc": % cd /tmp % svn co https://openmodelica.org/svn/MetaModelica/trunk mmc Username: anonymous Password: none % setenv SMLNJ_HOME /usr/local/smlnj-110.74 % set path = ( $SMLNJ_HOME/bin $path ) % cd /tmp/mmc % ./configure --prefix=/local/open-modelica % make % make install On 10.5, you need to tell it to use the x86 config % ./configure --prefix=/local/open-modelica --build=x86-darwin-gcc Otherwise it will build for x86_64, and OpenModelica won't, and you get a mess. If we're using gcc-4.2, you also need to edit mmc/config/x86-darwin-gcc to say that (instead of gcc), before running configure. ---------------------------------------------------------------------- You need lpsolve, and it has to be called "liblpsolve55_pic.a": % cd /tmp % curl -O http://www.cs.sunysb.edu/~algorith/implement/lpsolve/distrib/lp_solve_5.5.0.11_source.tar.gz % tar xvf lp_solve_5.5.0.11_source.tar.gz % cd lp_solve_5.5 % cp /local/PARC-QM/META/OMedit-with-QM/lpsolve-Makefile.osx . % make -f lpsolve-Makefile.osx % cp lpsolve55/liblpsolve55.a /local/open-modelica/lib/liblpsolve55_pic.a % cp lp_*.h /local/open-modelica/include And you need libcolamd.a, which requires UFconfig: % cd /tmp % curl -O http://www.cise.ufl.edu/research/sparse/UFconfig/UFconfig-3.7.0.tar.gz % tar xvf UFconfig-3.7.0.tar.gz % curl -O http://www.cise.ufl.edu/research/sparse/colamd/COLAMD-2.7.4.tar.gz % tar xvf COLAMD-2.7.4.tar.gz % cd COLAMD % make % cp Lib/libcolamd.a /local/open-modelica/lib ---------------------------------------------------------------------- You need Sundials for the latest version (1.8.1+) of OpenModelica. Irritatingly, Lawrence Livermore requires registration, at https://computation.llnl.gov/casc/sundials/download/download.html, to download. But the direct location is easy to find on the Web: % cd /tmp % curl -L -k -O http://www.llnl.gov/casc/sundials/download/code/sundials-2.5.0.tar.gz % tar xf /tmp/sundials-2.5.0.tar.gz % cd sundials-2.5.0 % ./configure --prefix=/local/open-modelica % make % make install ---------------------------------------------------------------------- You need a newer version of autoconf to regenerate the configure at the OM top level. Pull it down from gnu.org and install it. % cd /tmp % curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz % tar xvf autoconf-2.69.tar.gz % cd autoconf-2.69 % ./configure --prefix=/local/open-modelica % make % make install ---------------------------------------------------------------------- You have to edit trunk/Compiler/runtime/Makefile.in so that it picks up CPPFLAGS. Change CPPFLAGS = -I$(RMLINCLUDE) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I$(srcdir) -I. $(CORBAINCL) to CPPFLAGS = @CPPFLAGS@ -I$(RMLINCLUDE) -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I$(srcdir) -I. $(CORBAINCL) ---------------------------------------------------------------------- On the Mac, you need to edit the OMEdit/OMEditGUI/OMEdit.config and OMPlot/OMPlotGUI/OMPlotGUI.config files. In each, add "-F/usr/local/qwt-6.0.1/lib -framework qwt" to the LIBS line. ---------------------------------------------------------------------- In /local/open-modelica/src/Makefile.in, edit the "qtclients" target to remove OMOptim and OMOptim/OMOptimBasis. They just won't build. ---------------------------------------------------------------------- A lot of environment variables to set before you can configure the build. On the Mac (OS X 10.7), building to /local/open-modelica/, with Qt installed under /local/QtSDK: QTDIR=/local/QtSDK/Desktop/Qt/474 PKG_CONFIG_PATH=/local/QtSDK/Desktop/Qt/474/gcc/lib/pkgconfig DYLD_FALLBACK_LIBRARY_PATH=/local/open-modelica/lib PATH=/local/open-modelica/bin:/local/QtSDK/Desktop/Qt/474/gcc/bin:/local/bin:/bin:/usr/bin:/usr/ucb:/usr/lib:/etc:/usr/etc:/sbin ---------------------------------------------------------------------- Run autoconf on the modelica configure.in file: % cd /local/open-modelica/src % /local/open-modelica/bin/autoconf ---------------------------------------------------------------------- Configure I'm using is: $ ./configure --disable-python-interface --without-paradiseo --with-omniORB=/local/open-modelica --with-qwt=/local/open-modelica/qwt-6.0.1/lib --prefix=/local/open-modelica --with-static-lpsolve=/local/open-modelica CC=gcc-4.2 LDFLAGS=-L/local/open-modelica/lib" CFLAGS="-I/local/open-modelica/include" CXX=g++-4.2 CXXFLAGS="-I/local/open-modelica/include" ---------------------------------------------------------------------- Trying to do three separate makes (as in README.Linux.txt) doesn't work, because the Makefile for "mosh" assumes "moc" is installed. So just do one "make".