Discussion:
[Meep-discuss] Notes on installing guile-meep on macOS Sierra--version 3 July 2017
John Weiner
2017-07-23 06:59:17 UTC
Permalink
Dear Meep Users and Developers,
I have been able to install meep-1.3 on two different iMacs (one in Washington DC( Sierra 10.12.5) and the other in Paris (Sierra 10.12.6) during the month of July 2017. This message recounts what I did. I hope it works for you, but even in these two very similar machine environments the tactics for a successful build were not exactly the same. I hope these steps prove useful to users who want to install meep on macOS.
The point of departure was the “installation guide for Sierra based on HomeBrew" in meep-discuss,
I also used HomeBrew to install some of the prerequisite packages.
1. First install home-brew if you don’t already have it. You can download it from the home-brew web site, http://docs.brew.sh/Installation.html <http://docs.brew.sh/Installation.html>. It is a package handler analogous to apt or apt-get in Ubuntu Linux.
2. Open a terminal session and, once home-brew is installed, on the command line,
brew doctor (analyses the system for potential conflicts and problems)
brew update (update all the home-brew packages).
3. brew install the following packages: libunistring, pkg-config, libffi, bdw-gc, readline, hdf5, openblas, fftw, gsl, automake, and autoconf. Some of these packages might be already on your system.
4. The Washington iMac seemed to require the installation of gettext as well the packages above, so you might as well install getttext. Also on the Washington iMac, I initially got errors about missing xxx.m4 files in the guile-2.0.11/m4 directory. I simply copied the m4 directory from a later guile version in the guile-2.0.11/m4 directory, and the problem disappeared. I did not get this error on the Paris machine.
6. The build of guile-2.0.11 was the hardest part of this task. The overall method is the typical unix install procedure: ./configure, make, sudo make install
but compiler and linker flags must be specified on the ./configure command line. After extracting the tarball with tar-xvd, cd to the guile-2.0.11 directory.
You should find an executable configure file. The command is ./configure. By default the installation will be in /usr/local. If you want it somewhere else, on the ./configure command line: prefix=/your/install_directory. My advice is to stick with /usr/local unless you have some compelling reason not to.
On the same ./configure command line set LDFLAGS=“-L/path/to/lib -L/path/to/other/lib" and CPPFLAGS=“-I/path/to/include -I/path/to/other/include” for all the relevant paths for the previously installed prerequisites so that the compiler and linker will be able to find the lib and include directories. For those packages that require static and dynamic libraries the LDFLAGS has to have both the -L and -l options. Thus: LDFLAGS=“-L/path/to/libfoo/lib -lfoo”. Home-brew creates a symlink in /usr/local/opt for most (but not all) of the installed programs. The home-brew installation well print a message alerting you to where the libraries and include files can be found.
You also should specify on the ./configure command line LIBFFI_CFLAGS for the include directory and LIBFFI_LIBS for the static and dynamic libraries where ffi can be found. For some reason ffi seems to require these additional environmental variables in order to find the latest version of ffi.
7. Once you have everything on the ./configure line, take a deep breath and press return. If the configure script runs to completion, breath a sigh of relief and type the make command at the system prompt. If you get errors while running ./configure, you can
cat config.log|grep “some key words of the error message”
to try to deduce what went wrong.
8. If you get to make, take another deep breath; hit return. You will see lots of warnings, but the make will only stop with errors. At first I got a lot of errors about various “missing symbols”, but it was because I had forgotten to add an -l flag (for dynamic libraries) to the LDFLAGS="-L/path/to/ffi. It should be LDFLAGS=-L/path/to/ffi -lffi”.
9. A persistant error was due to the stime.c file in 
/libguile/stime.c that comes with the guile-2.0.11 tarball. This is a documented bug in guile-2.0.11(http://lists.gnu.org/archive/html/bug-guile/2017-03/msg00000.html <http://lists.gnu.org/archive/html/bug-guile/2017-03/msg00000.html>) and has been fixed for guile versions >=2.0.15. There is also a patch on GitHub site. However, I just downloaded and extracted the current version of guile (2.2.2) and copied the stime.c file in the more recent version to my 
/guile-2.0.11/libguile directory and did the configure and make sequence again. That solved the problem for me. The make command can be run with make V=1 to see the details of what is going on at each step. For linker problems I found it useful to actually see what lib and include paths the linker was using and in what sequence.
10. The last step is sudo make install. I had no problems with this step, once I was able to get that far.
11. A quick check that you have the required guile version installed correctly is to type at the prompt, guile - - version. You should get the guile prompt with the version information. It should be 2.0.11.
12. Once the guile hurdle was overcome the rest was relatively straightforward.
13. From the meep ab initio site you can get the tarballs for h5utils, harminv, libctl, mpb, and meep. You need to get the libpng-1.4.20 package from its download site. Then
configure, make, sudo make install
went smoothly without supplemental LDFLAGS and CPPFLAGS specifications. That of course assumes the default installation path, /usr/local.
14. Finally, after having installed all of the above, I typed meep and got the prompt and the correct version, meep-1.3. Then I went through the meep abi initio tutorials and, so far, everything is working as expected. When meep runs you get a “some stuff is deprecated” message at the end, but for now at least it does not interfere with meep’s functioning.
So there it is
I hope it helps. There are probably better ways to accomplish the same end, but for non-developers and non-maintainers the goal is to get meep working. The procedure is for macOS Sierra and guile-meep, not python-meep. Let me know if you have any enlightening comments and corrections.
John Weiner
Loading...