Skip to content

Latest commit

 

History

History
150 lines (88 loc) · 5.49 KB

installation-library-sources-macos.md

File metadata and controls

150 lines (88 loc) · 5.49 KB

Installation of LAL and its dependencies (Mac OS)

In this file is detailed step by step the compilation and installation process of this library and all its dependencies from sources.

Installing the dependencies

Compiler

We have tested LAL's compilation on MacOS with GNU's gcc (version 11.2.0). In order to install it on your computer, we suggest these instructions, summarized here. Simply run the command:

$ brew install gcc

CMake

As it is pointed out here, install cmake issuing the following command

$ brew install cmake

GMP

The GMP can be installed very easily from sources. First, download the source files in the form of a compressed file. Uncompress it, and open a command line terminal in the new directory. There, issue the following commands

$ CC=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11 CXX=/usr/local/Cellar/gcc/11.2.0/bin/g++-11 ./configure --enable-cxx
$ make -j4
$ make check -j4   # GMP developers strongly recommend to run these commands, and so do we.
$ make install

Make sure to write down the directory where the header (.h) and library (.dylib) files have been installed. These will most likely be /usr/local/include/ and /usr/local/lib.

Git

You can install git in Mac OS issuing the following command

$ brew install git

Compiling and installing LAL

The following commands provide an easy and quick way of downloading, compiling and installing the library. First, download LAL's sources from its github page

$ git clone https://github.com/LAL-project/linear-arrangement-library.git

The following commands are used to compile the library in both debug and release builds. The cmake command is configured by default to install the compiled files in the /usr directory. In order to change this, simply specify the desired installation directory by adding this

-DCMAKE_INSTALL_PREFIX=directory

to the cmake command. See below for examples.

We recommend all users to create the library's release and debug builds.

Release build

First, create the build directory.

Make the build directory

$ cd linear-arrangement-library
$ mkdir lal-release
$ cd lal-release

The next step is to create the Makefile file.

CMake with the predefined settings

We recommend the following default settings. This should be enough for most users; in case some of the default have to be changed see the example in the next section.

$ cmake \
	-DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/g++-11 \
	-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11 \
	../lal

If this command did not fail, users can continue reading.

CMake with other settings

This is an example that shows how to generate the Makefile with a different installation prefix directory. Users who do not need to change the installation directory can move on to compiling and installing the library.

$ cmake \
	-DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/g++-11 \
	-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11 \
	-DCMAKE_INSTALL_PREFIX=~/Desktop \
	../lal

Compile and install

Issue the following commands to compile and install the library.

$ make -j4
$ make install

See Known issues for a list of known issues.

Debug build

First, create the build directory.

Make the build directory

$ cd linear-arrangement-library
$ mkdir lal-debug
$ cd lal-debug

The next step is to create the Makefile file.

CMake with the predefined settings

We recommend the following default settings. This should be enough for most users; in case some of the default have to be changed see the example in the next section.

$ cmake \
	-DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/g++-11 \
	-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11 \
	-DCMAKE_BUILD_TYPE=Debug \
	../lal

If this command did not fail, users can continue reading.

CMake with other settings

This is an example that shows how to generate the Makefile with a different installation prefix directory. Users who do not need to change the installation directory can move on to compiling and installing the library.

$ cmake \
	-DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/g++-11 \
	-DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11 \
	-DCMAKE_BUILD_TYPE=Debug \
	-DCMAKE_INSTALL_PREFIX=~/Desktop \
	../lal

Compile and install

Issue the following commands to compile and install the library.

$ make -j4
$ make install

See Known issues for a list of known issues.

Known issues

There are several known issues when compiling LAL:

  • The compiler cannot find the header file gmp.h: in this case we suggest adding the installation of gmp's header files to the environment variable CPLUS_INCLUDE_PATH, like so:

      $ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include
    

Notice that /usr/local/include has to be replaced with the actual directory where gmp's header files were installed.

  • The compiler cannot find the gmp library when linking: in this case we suggest adding the directory gmp's library to the environment variable LIBRARY_PATH, like so:

      $ export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
    

Notice that /usr/local/lib has to be replaced with the actual directory where gmp's library files were installed.