Subject: [FEniCS-users] Mac OS X Installation Problems

From: Ted Kord <[email-masked]>
Date: Wed, 11 Nov 2009 21:37:14 +0000

Hello

I'm having serious problems installing FEniCs on my Mac Book Pro (Mac OS X
10.6.2).

I have followed the procedure on the wiki using the dorsal script but:

1. The petsc installation always results in an error ( Unknown fortran name
mangling).
a. To solve this, I've tried exporting the appropriate compiler environment
variables (in the snowleopard.platform file itself and also in my
.bash_profile). No joy.
b. I installed petsc and slepc myself, set the appropriate ?_DIR and ?_ARCH
environment variables and commented out the download of petsc and slepc in
the snowleopard.platform file. The installation completes, but during it,
the dkg_config fails to find petsc, slepc, umfpack, etc.
c. When I try to run a demo in python, it complains about maybe not finding
the 'dolfin.pc' file and sometimes about no module named dolfin.
d. In C++, errors relating to MPI occur.

Any help resolving this issue(s) is will be greatly appreciated.

Best regards

Ted

---

From: Johannes Ring <[email-masked]>
Date: Thu, 12 Nov 2009 09:55:07 +0100

Hi Ted,

> the dkg_config fails to find petsc, slepc, umfpack, etc.

Try to build the development version of the FEniCS packages. I just
pushed some fixes for the pkg-config generators in DOLFIN for Mac.
Please post the output from "scons configure". Also post the contents
of <dolfin_dir>/scons/simula_scons.log.

> the 'dolfin.pc' file and sometimes about no module named dolfin.

Did you update your environment variables after the installation? You
can do this by sourcing the file <dolfin_dir>/dolfin.conf.

Johannes

> _______________________________________________
> FEniCS-users mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/fenics-users
>
>

---

From: Ted Kord <[email-masked]>
Date: Thu, 12 Nov 2009 20:36:31 +0000

2009/11/12 Johannes Ring <[email-masked]>

> <snip>

>  </snip>

> Johannes
Hi Johannes

I just tried to pull the developmental versions but this fails for some
reason. On issuing the command:

hg clone http://www.fenics.org/hg/dolfin

I get the following:

destination directory: dolfin
requesting all changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed

What could be the problem?

Regards

Ted

---

From: Anders Logg <[email-masked]>
Date: Thu, 12 Nov 2009 21:38:30 +0100

Try again. I noticed the same thing today, but it worked when I tried
the second time.

Don't know why this happens, but let's keep our eyes open if there's a
problem with the web server.

--
Anders

On Thu, Nov 12, 2009 at 08:36:31PM +0000, Ted Kord wrote:
> I just tried to pull the developmental versions but this fails for some reason.
> On issuing the command:
>

---

From: Ted Kord <[email-masked]>
Date: Fri, 13 Nov 2009 01:16:20 +0000

Hi Johannes and Anders

I've managed to download all the packages.

I installed ufc with no problems. I then copied ufc-1.pc to
~/dolfin/scons/pkgconfig because dolfin couldn't find it.

dolfin picked up some packages but not all (particularly petsc, slepc and
trilinos) even though I explicitly specified the locations. Seems to want
trilinos 7 but I've got 10.0.2 installed. I've not got scotch or parmetis
installed but metis is installed.

Ted

My scons configure is:
=================

scons configure prefix=~/FEniCS enableDemos=yes
withMtl4Dir=/Users/tedkord/mtl4
 withUmfpackDir=/opt/local/var/macports/software/SuiteSparse/3.4.0_0/opt/local
withCholmodDir=/opt/local/var/macports/software/SuiteSparse/3.4.0_0/opt/local
withBoostDir=/opt/local withTrilinosDir=/usr/local
withPetscDir=/Users/tedkord/petsc-3.0.0-p9
withSlepcDir=/Users/tedkord/slepc-3.0.0-p7 withPetscArch=darwin10.2.0-c-opt
scons: Reading SConscript files ...
/Users/tedkord/dolfin/scons/simula-scons
Using options from /Users/tedkord/dolfin/scons/options.cache
MPI not found (might not work if PETSc uses MPI).
Checking for pkg-config... yes
Checking for boost... yes
 Trying to re-generate pkg-config file for boost... done
 Found Boost and generated pkg-config file in
 '/Users/tedkord/dolfin/scons/pkgconfig'
Checking for boost_filesystem... yes
Checking for boost_program_options... yes
Checking for cholmod... yes
 Trying to re-generate pkg-config file for cholmod... done
 Found CHOLMOD and generated pkg-config file in
 '/Users/tedkord/dolfin/scons/pkgconfig'
Checking for gts... yes
Checking for libxml-2.0... yes
Checking for mtl4... yes
 Trying to re-generate pkg-config file for mtl4... done
 Found MTL4 and generated pkg-config file in
 '/Users/tedkord/dolfin/scons/pkgconfig'
Checking for numpy-1... yes
Checking for parmetis... no (pkg-config file not found)
 Trying to generate pkg-config file for parmetis... failed
Checking for petsc... no (pkg-config file not found)
 Trying to generate pkg-config file for petsc... Does not know about any
alternates for gcc-mp-4.3, so that is used
Does not know about any alternates for gcc-mp-4.3, so that is used
failed
Checking for python-2... yes
Checking for scotch... no (pkg-config file not found)
 Trying to generate pkg-config file for scotch... failed
Checking for slepc... no (pkg-config file not found)
 Trying to generate pkg-config file for slepc... Does not know about any
alternates for gcc-mp-4.3, so that is used
Does not know about any alternates for gcc-mp-4.3, so that is used
failed
Checking for trilinos... yes
 Trying to re-generate pkg-config file for trilinos... done
 Found Trilinos and generated pkg-config file in
 '/Users/tedkord/dolfin/scons/pkgconfig'
Checking for ufc-1... yes
Checking for umfpack... yes
 Trying to re-generate pkg-config file for umfpack... done
 Found UMFPACK and generated pkg-config file in
 '/Users/tedkord/dolfin/scons/pkgconfig'
Checking for zlib... yes
Resolving compiler... done
Found optional package: umfpack (version 5.2.0)
Found optional package: cholmod (version 1.6.0)
Found optional package: zlib (version 1.2.3)
Found optional package: mtl4 (version 4)
Found optional package: gts (version 0.7)
Unable to find optional package: trilinos (version 7.0.0)
Unable to find optional package: parmetis (version 3.1)
Unable to find optional package: slepc (version 3.0.0)
Unable to find optional package: petsc (version 3.0.0)
Unable to find optional package: scotch (version 5.0)
Enabling compilation of Python wrappers
---------------------------------------------------------
Configuration of DOLFIN finished. Now run

    scons

to build DOLFIN. To see available configure options, run

    scons configure --help or -h

For a list of general SCons options, run

    scons --help-options or -H

---------------------------------------------------------

My dolfin log:
===========

=================== dolfin log ===================
2009-11-13 00:22:21.396199
Using simula_scons from:
/Users/tedkord/dolfin/scons/simula-scons/simula_scons/__init__.pyc
Unable to compile a ParMETIS test program.
Compilation command was:
g++-mp-4.3 -I/usr/include -c parmetis_config_test_version.cpp
Failed test program was:

#include <stdio.h>
#include <parmetis.h>

int main() {
  #ifdef PARMETIS_MAJOR_VERSION
    #ifdef PARMETIS_MINOR_VERSION
      printf("%d.%d", PARMETIS_MAJOR_VERSION, PARMETIS_MINOR_VERSION);
    #else
      printf("%d", PARMETIS_MAJOR_VERSION);
    #endif
  #endif
  return 0;
}

Error message:
parmetis_config_test_version.cpp:3:22: error: parmetis.h: No such file or
directory
Unable to link a PETSc test program.
Link command was:
gcc-mp-4.3 -o a.out -L/Users/tedkord/petsc-3.0.0-p9/darwin10.2.0-c-opt/lib
-L/Users/tedkord/petsc-3.0.0-p9/darwin10.2.0-c-opt/lib -lpetscts -lpetscsnes
-lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc
petsc_config_test_version.o
Failed test program was:

#include <stdio.h>
#include <petsc.h>

int main() {
  #ifdef PETSC_VERSION_MAJOR
    #ifdef PETSC_VERSION_MINOR
      #ifdef PETSC_VERSION_SUBMINOR
        printf("%d.%d.%d", PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR,
PETSC_VERSION_SUBMINOR);
      #else
        printf("%d.%d", PETSC_VERSION_MAJOR, PETSC_VERSION_MINOR);
      #endif
    #else
      printf("%d", PETSC_VERSION_MAJOR);
    #endif
  #endif
  return 0;
}

Error message:
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      _main in petsc_config_test_version.o
      CIE in petsc_config_test_version.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Unable to compile a SCOTCH test program.
Compilation command was:
g++-mp-4.3 -I/usr/include/scotch -c scotch_config_test_include.cpp
Failed test program was:

extern "C" {
#include <stdio.h>
#include <scotch.h>
}
int main() {
  return 0;
}

Error message:
scotch_config_test_include.cpp:4:20: error: scotch.h: No such file or
directory
Unable to link a SLEPc test program.
Link command was:
gcc-mp-4.3 -o a.out -L/Users/tedkord/petsc-3.0.0-p9/darwin10.2.0-c-opt/lib
-L/Users/tedkord/petsc-3.0.0-p9/darwin10.2.0-c-opt/lib -lpetscts -lpetscsnes
-lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc
-L/Users/tedkord/slepc-3.0.0-p7/darwin10.2.0-c-opt/lib
-L/Users/tedkord/slepc-3.0.0-p7/darwin10.2.0-c-opt/lib -lslepc
slepc_config_test_version.o
Failed test program was:

#include <stdio.h>
#include <slepc.h>

int main() {
  #ifdef SLEPC_VERSION_MAJOR
    #ifdef SLEPC_VERSION_MINOR
      #ifdef SLEPC_VERSION_SUBMINOR
        printf("%d.%d.%d", SLEPC_VERSION_MAJOR, SLEPC_VERSION_MINOR,
SLEPC_VERSION_SUBMINOR);
      #else
        printf("%d.%d", SLEPC_VERSION_MAJOR, SLEPC_VERSION_MINOR);
      #endif
    #else
      printf("%d", SLEPC_VERSION_MAJOR);
    #endif
  #endif
  return 0;
}

Error message:
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      _main in slepc_config_test_version.o
      CIE in slepc_config_test_version.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
resolveCompiler: No pkg-config generator for package 'ufc-1'. Assuming Ok.
resolveCompiler: No pkg-config generator for package 'gts'. Assuming Ok.

============================

---

From: Harish Narayanan <[email-masked]>
Date: Fri, 13 Nov 2009 03:13:55 +0100

Ted Kord wrote:
> dolfin picked up some packages but not all (particularly petsc, slepc
> and trilinos) even though I explicitly specified the locations. Seems to
> want trilinos 7 but I've got 10.0.2 installed. I've not got scotch or
> parmetis installed but metis is installed.

I don't mean to sidetrack this discussion, but I am going to.

Was it easy to get Trilinos 10.x installed on Mac OS X? If so, do you
have any pointers to share?

Thanks,
Harish

---

From: Johannes Ring <[email-masked]>
Date: Fri, 13 Nov 2009 12:49:57 +0100

Hi Ted,

> ~/dolfin/scons/pkgconfig because dolfin couldn't find it.

This is not the right way to do it. Instead, add
<ufc_install_prefix>/lib/pkgconfig to your PKG_CONFIG_PATH variable.

> trilinos) even though I explicitly specified the locations.

The problem with PETSc and SLEPc seems to be that they are both built
with a C compiler instead of a C++ compiler. Try to rebuild PETSc with
the '--with-clanguage=c++' option. You will also have to rebuild SLEPc
after that. Note that PETSc and SLEPc is only optional, so they are
not strictly needed.

> Seems to want
> trilinos 7 but I've got 10.0.2 installed.

No, Trilinos 7 is only the minimum requirement (maybe we should do
something about the output from scons configure?). I don't think
anyone has tested Trilinos 10 with DOLFIN yet but 'scons configure'
doesn't seem to complain.

> I've not got scotch or parmetis

SCOTCH and ParMETIS is only optional so this should be okay.

Johannes

---

From: Ted Kord <[email-masked]>
Date: Fri, 13 Nov 2009 17:35:42 +0000

> have any pointers to share?

Hi Harish

It was relatively easy once you'd installed the patch for stratimikos which
Roscoe Bartlett and Chris Baker were kind enough to provide (should be fixed
in the next minor release).

If you want to compile with fortran enabled (a pain on the Mac):

1. Make sure you have matching versions of gcc, g++, and gfortran installed.

You can download gcc v4.5 from macports, and gfortran 4.5 from
http://hpc.sourceforge.net/.

2. Set the CC, CXX, and FC environment variables to point towards the proper
versions of the compilers before running CMake.

If it still complains about unknown fortran name mangling, just turn it off.

There 'was' a problem with Pytrilinos, so I disabled it but apparently this
should also be fixed now or in the next minor release.

Here's my do-configure script (the extra boost directories were just for
good measure):

cmake \
-D CMAKE_CXX_COMPILER:FILEPATH=/opt/local/bin/g++-mp-4.3 \
-D CMAKE_C_COMPILER:FILEPATH=/opt/local/bin/gcc-mp-4.3 \
-D CMAKE_Fortran_COMPILER:FILEPATH=/opt/local/bin/gfortran-mp-4.3 \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \

-D BUILD_SHARED_LIBS:BOOL=ON \
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
-D Trilinos_ENABLE_SECONDARY_STABLE_CODE:BOOL=ON \
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
-D Trilinos_ENABLE_PyTrilinos:BOOL=OFF \

-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D DART_TESTING_TIMEOUT:STRING=600 \
-D Trilinos_ENABLE_Fortran:BOOL=ON \
-D TPL_ENABLE_MPI:BOOL=ON \
-D MPI_BASE_DIR:PATH=“/opt/local” \
-D MPI_BIN_DIR:PATH="/opt/local/bin" \
-D TPL_Boost_INCLUDE_DIRS:PATH=/opt/local/include/boost \
-D Boost_INCLUDE_DIRS:PATH="/opt/local/include/boost" \
-D Boost_LIBRARY_DIRS:PATH=/opt/local/lib \
$EXTRA_ARGS \
${HOME}/trilinos-10.0.2-Source

Hope this helps.

Ted

---

From: Ted Kord <[email-masked]>
Date: Fri, 13 Nov 2009 17:40:16 +0000

> Johannes

Thanks Johannes. That's quite strange but I'll rebuild them as soon as I
have a chance and let you know how it went.

Ted

---

From: Ted Kord <[email-masked]>
Date: Fri, 13 Nov 2009 21:29:47 +0000

Hi Johannes

I've rebuilt Petsc and Slepc and dolfin picked them up. Thx.

All packages have been installed.

However, I tried to run a demo (specifically the Advection-Diffusion demo).
In c++, I get the following error message:

dyld: Symbol not found: _MPIUNI_TMP
  Referenced from: /Users/tedkord/FEniCS/lib/libdolfin.dylib
  Expected in: flat namespace
 in /Users/tedkord/FEniCS/lib/libdolfin.dylib

Is this because I built petsc without mpi support?

With python, I get:

Traceback (most recent call last):
  File "demo.py", line 16, in <module>
    from dolfin import *
  File
"/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py", line
11, in <module>
    import cpp
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
line 28, in <module>
    _cpp = swig_import_helper()
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
line 24, in swig_import_helper
    _mod = imp.load_module('_cpp', fp, pathname, description)
ImportError:
dlopen(/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/_cpp.so, 2):
Symbol not found: _MPIUNI_TMP
  Referenced from: /Users/tedkord/FEniCS/lib/libdolfin.dylib
  Expected in: flat namespace
 in /Users/tedkord/FEniCS/lib/libdolfin.dylib

Ted

---

From: Ted Kord <[email-masked]>
Date: Sat, 14 Nov 2009 12:00:26 +0000

>  in /Users/tedkord/FEniCS/lib/libdolfin.dylib

The symbol _MPIUNI_TMP is definitely in the libmpiuni.a library in the petsc
directory. 'But' Why is it not linking with it?

Ted

---

From: Harish Narayanan <[email-masked]>
Date: Sat, 14 Nov 2009 13:22:31 +0100

Ted Kord wrote:
>     "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py",
>     line 11, in <module>
>         import cpp
>       File
>     "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
>     line 28, in <module>
>     "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
>     dlopen(/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/_cpp.so,
>     2): Symbol not found: _MPIUNI_TMP
> The symbol _MPIUNI_TMP is definitely in the libmpiuni.a library in the
> petsc directory. 'But' Why is it not linking with it?

My guess is you need to add -lmpuni (or something like that) manually to
the petsc pkgconfig file to test if that helps.

Harish

---

From: Johannes Ring <[email-masked]>
Date: Mon, 16 Nov 2009 09:06:06 +0100

> the petsc pkgconfig file to test if that helps.

Or you can rebuild PETSc with shared libraries enabled (--with-shared=1).

Johannes

---

From: Ted Kord <[email-masked]>
Date: Mon, 16 Nov 2009 23:05:54 +0000

> Or you can rebuild PETSc with shared libraries enabled (--with-shared=1).

Unfortunately, there's a problem with petsc shared libraries on mac os x, so
you always end up with static libraries.

I did however manage to solve that problem by uninstalling openmpi from
macports and building it myself. So, everything's properly installed now and
the cpp demos compile. The executables run but with errors and there's no
plotting (viper and Parmetis problems) . I have to manually open the output
files in an appropriate program.

Here's an output from the the Poisson cpp demo:

Debug: Creating function space: 5fbfe4f0 [at
dolfin/function/FunctionSpace.cpp:55 in FunctionSpace()]
Debug: Registering function space: 5fbfe4f0 [at
dolfin/adaptivity/AdaptiveObjects.cpp:76 in register_object()]
Debug: Registering boundary condition: 5fbfea30 [at
dolfin/adaptivity/AdaptiveObjects.cpp:94 in register_object()]
Debug: Creating function: 5fbfe340 [at dolfin/function/Function.cpp:37 in
Function()]
Debug: Registering function: 5fbfe340 [at
dolfin/adaptivity/AdaptiveObjects.cpp:85 in register_object()]
Solving linear variational problem
  Matrix of size 1089 x 1089 has 7361 nonzero entries.
  Sorting sparsity pattern.
  Applying boundary conditions to linear system.
  LU-factorizing linear system of size 1089 x 1089 (UMFPACK).
  Solving factorized linear system of size 1089 x 1089 (UMFPACK).
Plotting x (unnamed data), press 'q' to continue...
Traceback (most recent call last):
  File "/opt/local/bin/viper", line 225, in <module>
    _newmain()
  File "/opt/local/bin/viper", line 220, in _newmain
    p = __main(infile, lutfile, mode, title)
  File "/opt/local/bin/viper", line 152, in __main
    return _plot_mesh(infile, lutfile, mode, title)
  File "/opt/local/bin/viper", line 116, in _plot_mesh
    import dolfin
  File
"/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py", line
11, in <module>
    import cpp
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
line 28, in <module>
    _cpp = swig_import_helper()
  File "/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py",
line 24, in swig_import_helper
    _mod = imp.load_module('_cpp', fp, pathname, description)
ImportError:
dlopen(/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/_cpp.so, 2):
Symbol not found: _METIS_NodeComputeSeparator
  Referenced from: /Users/tedkord/FEniCS/lib/libdolfin.dylib
  Expected in: flat namespace
 in /Users/tedkord/FEniCS/lib/libdolfin.dylib
*** Warning: Unable to plot.

Ted

---

From: Johannes Ring <[email-masked]>
Date: Thu, 19 Nov 2009 09:04:23 +0100

Hi Ted,

> *** Warning: Unable to plot.

It seems like it is missing a link to the METIS library. Have a look
for -lmetis in cholmod.pc or run

  pkg-config cholmod --libs

and look for -lmetis in the output (you will need to source
dolfin.conf first). I have made a fix for this but because of the
server problems I haven't been able to push it yet. Anders/Garth: Can
I push to the usual repository again?

Johannes

---

From: Ted Kord <[email-masked]>
Date: Fri, 20 Nov 2009 21:32:18 +0000

> I push to the usual repository again?

Cheers, works fine now.

Having said that ,the python demos throw up some errors but I'm assuming
these are fixed in the repository. So, I'll update first and see try again.

Thx.

Ted

---

From: Ted Kord <[email-masked]>
Date: Sat, 21 Nov 2009 15:37:42 +0000

I pulled the latest developmental version from bitbucket, configured and
installed. The cpp demos all work fine but for example for the Poisson
python demo, this is what I get:

Debug: Trying to automatically figure out the element [at
/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/expression.py:554
in __new__()]
Debug: Assuming it's a triangle [at
/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/expression.py:555
in __new__()]
Debug: It's a scalar [at
/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/expression.py:560
in __new__()]
Traceback (most recent call last):
  File "demo.py", line 37, in <module>
    f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) /
0.02)", V = V)
  File
"/Users/tedkord/FEniCS/lib/python2.6/site-packages/dolfin/expression.py",
line 561, in __new__
    element = ufl.FiniteElement("Quadrature", domain, None)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ufl/finiteelement.py",
line 97, in __init__
    ufl_assert(kmin is None or degree >= kmin, 'Degree "%d" invalid for "%s"
finite element.' % (degree, family))
TypeError: %d format: a number is required, not NoneType

All the python demos result in some sort of error.

Ted