Skip to content
Benjamin Audren edited this page Oct 29, 2014 · 5 revisions

Class

  • On Mac OS X 10.9, 10.10, I have problems with openMP, lgomp,

Namely, all the .c files compile, but at the linking stage, to create the class executable file, there is the following error:

ld: library not found for -lgomp

clang: error: linker command failed with exit code 1 (use -v to see
invocation)

The problem is that you are using clang, the default C Compiler on modern Mac OS X distributions. This compiler unfortunately does not support OpenMP, and deals with parallelization differently.

Simple solution: in the Makefile, please modify the following line:

# your openmp flag (comment for compiling without openmp)
OMPFLAG   = -fopenmp
#OMPFLAG   = -mp -mp=nonuma -mp=allcores -g
#OMPFLAG   = -openmp

by

# your openmp flag (comment for compiling without openmp)
#OMPFLAG   = -fopenmp
#OMPFLAG   = -mp -mp=nonuma -mp=allcores -g
#OMPFLAG   = -openmp

This way, no OMPFLAG will be set, and no problem will appear (but class will be slow). After this, please enter in your terminal:

make clean; make -j

Recommended solution: ideally, you should install a more modern C compiler, such as gcc-4.8 or gcc-4.9. You can do this by using brew, and doing

brew install gcc
  • When compiling, you get a long list of errors similar to:
/var/folders/gz/z699lk_d6vxg5ml4bk72yj4h0000gp/T//ccuHPsf2.s:34300:no such
instruction: `vcomisd LC4(%rip), %xmm0'

Solution: this is a problem of the assembler on OSX. Try doing this:

  1. Modify the flags in the Makefile in one of the following two ways (do a make clean; make every time): a. Do not use -march=native OR b. Add the additional flag -Wa,-q (literally with no space between , and -) after the gcc command.
  2. If you are using macports, try installing the package binutils.
  3. Change compiler.

Python installation

  • I am missing modules, scipy, numpy, matplotlib, numexpr, etc

On linux: use your package manager to get those packages:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython
ipython-notebook

This will unfortunately install a rather old version of the ipython interactive interpreter. It is not such a big deal however, and you can probably live with this.

On Mac OS X: there are several solutions, presented in increasing order of difficulty.

  • Use anaconda. Download the python 2.7 version corresponding to your OS.
  • I get a missing module, but pip, the python package manager, tells me it is already installed:

You can try to uninstall the pip module, and reinstall. For instance, if scipy was not found, you can try (without the part in brackets at first, and if it fails, try with the command in brackets also)

(sudo) pip uninstall scipy
pip install scipy (--user)
  • pip install scipy (--user) fails and complains about a missing Fortran compiler:

The error is not so specific in fact, you have to scroll up to see that it is a problem of missing Fortran compiler.

Assuming that you are using brew, which is the case where we observed this error, you can install gcc with

brew install gcc

and try again.

classy wrapper

  • I try to compile the wrapper, but I have the following error:
cannot find -lclass
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

It means the file libclass.a was not found by the wrapper. The possible solution to that problem is that you forgot to build this file when installing CLASS. Go back one directory, and then compile CLASS with the option (all), meaning with no options at all:

cd ../
make

This should properly build the library. Then go back to the python subfolder and retry the installation:

cd python/
python setup.py install --user
  • You think you have installed Cython properly, but when compiling the wrapper you get an error that cython module is not installed.

Solution: Specify the correct python version in the Makefile, for instance python2.7 if that is the one you are using. If that is okay, try the pip uninstall reinstall trick mentioned elsewhere.

Clone this wiki locally