## Installing ECLIB on OS X

### Introduction

ECLIB is a mathematical package for arithmetic on elliptic curves by John Cremona. It has various numerical package prerequisites which must be installed beforehand. These are

In addition, you must ensure that the following programs are available and up-to-date.

• wget1
• Automake
• Autoconf
• Libtool
• GMP
• GNU gcc compilers2
• Git

Since we are concentrating on OS X, we may install these via Homebrew.

Grab a cup of tea while all the above installs; it will take a while!

Afterwards, do ensure that brew doctor is reporting minimal warning messages3

### Installing prerequisite packages

Now we can move onto install the prerequisite packages for ECLIB. Let’s just be lazy and provide the commands verbatim. They should be pretty self-explanatory.

We will install packages into /usr/local, but you may decide to choose a different installation location, e.g. $HOME/Packages. The keen-eyed among us will correctly notice that we do not install MPFR, NTL and PARI/GP (or even MPIR and FLINT via homebrew/-arcane) with Homebrew. This is because Homebrew does not always have the latest version, and we activate some custom command line options which are not exposed via the brew options command. Of course, editing the Homebrew formulae will also work. #### Installing MPFR and MPIR #### Installing NTL Open the DoConfig file with a text editor. Change the LIBTOOL variable (around line 22) to use the version install by Homebrew, which adds a ‘g’ prefix, i.e. We then proceed to build and install NTL If you run into errors regarding libtool, open the makefile file in a text editor and make the following changes • In the ntl.a rule (around line 372), add --tag=CXX after $(LIBTOOL).
• For the definition of the LCOMP variable (around line 375), add --tag=CXX after $(LIBTOOL). • In the .c rule (around line 394), add --tag=CXX after $(LIBTOOL).

Then run make and make install again.

#### Installing FLINT

If you get a missing symbol error referencing the NTL library, add the -lstdc++ flag to the EXTRA_LIBS variable within the Makefile file. Furthermore, update the CXX variable to g++-4.7 if you are using the GNU compilers.

### Installing ECLIB

Finally, we can install ECLIB.

With everything working acording to plan, ECLIB should now be installed and any of its programs can be run via the command line4.

Huzzah!

### Parallel support

As an optional extra, you may install the C++ Boost libraries to gain multi-threaded support in programs which contain parallel sections.

Note that we must now also specify the location of the Boost libraries during the configure stage of ECLIB

### Closing remarks

Installing ECLIB in OS X has its quirks, especially when using Apple’s clang version of the GCC compilers; installation on a Linux system is certainly more straight-forward. Hopefully, the remarks identified in this post will help you in your journey of installing ECLIB.

If there are any problems, do comment below with any error messages you come across.

1. You may use cURL if you prefer it as it is already installed on any Mac.

2. As of writing, we are using version 4.7 of the GNU gcc compilers.

3. If you have permission warnings after running brew doctor, such as

Warning: /usr/local/include isn’t writable. This can happen if you “sudo make install” software that isn’t managed by Homebrew.

Then run sudo chown -R \$USER /usr/local/include to take ownership, replacing the directory location for each warning.

Be sure to link the newly installed packages correctly if Homebrew hasn’t already done so, e.g. brew link autotools.

4. Do ensure your PATH environment variable contains /usr/local/bin.