libdolfin.so.1 undefined symbol

Asked by Paul Constantine

I'm going through manual installation of Dolfin on a small CentOS cluster. I'm not using Dorsal.

I was able to make and install Dolfin with a handful of libraries. However, I'm now stuck on the following error while trying to run demo_navier_stokes.py. This one is pretty confusing.

$ python demo_navier-stokes.py
Traceback (most recent call last):
  File "demo_navier-stokes.py", line 28, in <module>
    from dolfin import *
  File "/usr/local/lib64/python2.6/site-packages/dolfin/__init__.py", line 16, in <module>
    import cpp
  File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/__init__.py", line 40, in <module>
    exec("import %s" % module_name)
  File "<string>", line 1, in <module>
  File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 30, in <module>
    _common = swig_import_helper()
  File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 26, in swig_import_helper
    _mod = imp.load_module('_common', fp, pathname, description)
ImportError: /home/paulcon/software/fenics-install/dolfin-build/dolfin/libdolfin.so.1.0: undefined symbol: _ZNK5boost15program_options22error_with_option_name4whatEv

If I had to guess, I'd say I need to build boost differently. But I'm not sure.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

On 01/09/2013 03:15 AM, Paul Constantine wrote:
> New question #218687 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/218687
>
> I'm going through manual installation of Dolfin on a small CentOS cluster. I'm not using Dorsal.
>
> I was able to make and install Dolfin with a handful of libraries. However, I'm now stuck on the following error while trying to run demo_navier_stokes.py. This one is pretty confusing.
>
> $ python demo_navier-stokes.py
> Traceback (most recent call last):
> File "demo_navier-stokes.py", line 28, in <module>
> from dolfin import *
> File "/usr/local/lib64/python2.6/site-packages/dolfin/__init__.py", line 16, in <module>
> import cpp
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/__init__.py", line 40, in <module>
> exec("import %s" % module_name)
> File "<string>", line 1, in <module>
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 30, in <module>
> _common = swig_import_helper()
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 26, in swig_import_helper
> _mod = imp.load_module('_common', fp, pathname, description)
> ImportError: /home/paulcon/software/fenics-install/dolfin-build/dolfin/libdolfin.so.1.0: undefined symbol: _ZNK5boost15program_options22error_with_option_name4whatEv
>
> If I had to guess, I'd say I need to build boost differently. But I'm not sure.

Running:

  $> c++filt _ZNK5boost15program_options22error_with_option_name4whatEv

yields:

 boost::program_options::error_with_option_name::what() const

which indicates that you have not installed boost program_options or you
do not have /usr/lib/libboost_program_options.so in your LD_LIBRARY_PATH.

Johan

Revision history for this message
Johan Hake (johan-hake) said :
#2

On 01/09/2013 03:15 AM, Paul Constantine wrote:
> New question #218687 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/218687
>
> I'm going through manual installation of Dolfin on a small CentOS cluster. I'm not using Dorsal.
>
> I was able to make and install Dolfin with a handful of libraries. However, I'm now stuck on the following error while trying to run demo_navier_stokes.py. This one is pretty confusing.
>
> $ python demo_navier-stokes.py
> Traceback (most recent call last):
> File "demo_navier-stokes.py", line 28, in <module>
> from dolfin import *
> File "/usr/local/lib64/python2.6/site-packages/dolfin/__init__.py", line 16, in <module>
> import cpp
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/__init__.py", line 40, in <module>
> exec("import %s" % module_name)
> File "<string>", line 1, in <module>
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 30, in <module>
> _common = swig_import_helper()
> File "/usr/local/lib64/python2.6/site-packages/dolfin/cpp/common.py", line 26, in swig_import_helper
> _mod = imp.load_module('_common', fp, pathname, description)
> ImportError: /home/paulcon/software/fenics-install/dolfin-build/dolfin/libdolfin.so.1.0: undefined symbol: _ZNK5boost15program_options22error_with_option_name4whatEv
>
> If I had to guess, I'd say I need to build boost differently. But I'm not sure.

Running:

  $> c++filt _ZNK5boost15program_options22error_with_option_name4whatEv

yields:

 boost::program_options::error_with_option_name::what() const

which indicates that you have not installed boost program_options or you
do not have libboost_program_options.so in your LD_LIBRARY_PATH.

Johan

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#3

I have libboost_program_options.so in /usr/local/lib.

Is that not sufficient?

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#4

I tried explicitly setting

$> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

But I still get the same results.

Revision history for this message
Johan Hake (johan-hake) said :
#5

Only if that library is picked up by cmake. To check this you can go
into your build directory and call

  ccmake .. (or another path to where your source resides)

then hit t to toggle advanced variables and search for your boost
libraries.

Johan

On 01/11/2013 02:35 AM, Paul Constantine wrote:
> Question #218687 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/218687
>
> Status: Answered => Open
>
> Paul Constantine is still having a problem:
> I have libboost_program_options.so in /usr/local/lib.
>
> Is that not sufficient?
>

Revision history for this message
Kent-Andre Mardal (kent-and) said :
#6

Use nm to check for the symbol, e.g.

nm _some_boost_libraries.so | grep
_ZNK5boost15program_options22error_with_option_name4whatEv

'U' indicates undefined.

When you have found the library that contains the symbol, you can use 'ldd'
to check whether
that library is linked to dolfin. ldd will also show you if the linker has
found the libraries, otherwise
you need to alter LD_LIBRARY_PATH

On 11 January 2013 02:35, Paul Constantine <
<email address hidden>> wrote:

> Question #218687 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/218687
>
> Paul Constantine gave more information on the question:
> I tried explicitly setting
>
> $> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
>
> But I still get the same results.
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#7

Thanks, Kent and Johan. ldd revealed that libdolfin.so is linked to /usr/lib64/libboost*

How can I change this to link to /usr/local/lib/libboost* ? Is there a variable I can change in the cmake process?

Here's my current cmake command:

cmake \
    -DPETSC_DIR=/usr/local/petsc \
    -DPETSC_ARCH=arch-linux2-c-debug \
    -DDOLFIN_ENABLE_SLEPC=OFF \
    -DDOLFIN_ENABLE_SCOTCH=OFF \
    -DDOLFIN_ENABLE_QT=OFF \
    -DDOLFIN_ENABLE_TRILINOS=OFF \
    -DDOLFIN_ENABLE_PASTIX=OFF \
    -DDOLFIN_ENABLE_HDF5=OFF \
    -DDOLFIN_ENABLE_VTK=OFF \
    ~/software/fenics-install/dolfin-trunk/dolfin

Revision history for this message
Johan Hake (johan-hake) said :
#8

Set the environment variable:

  export BOOST_ROOT=/usr/local

and clear the CMake cache.

Johan

On 01/11/2013 05:51 PM, Paul Constantine wrote:
> Question #218687 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/218687
>
> Status: Answered => Open
>
> Paul Constantine is still having a problem:
> Thanks, Kent and Johan. ldd revealed that libdolfin.so is linked to
> /usr/lib64/libboost*
>
> How can I change this to link to /usr/local/lib/libboost* ? Is there a
> variable I can change in the cmake process?
>
> Here's my current cmake command:
>
> cmake \
> -DPETSC_DIR=/usr/local/petsc \
> -DPETSC_ARCH=arch-linux2-c-debug \
> -DDOLFIN_ENABLE_SLEPC=OFF \
> -DDOLFIN_ENABLE_SCOTCH=OFF \
> -DDOLFIN_ENABLE_QT=OFF \
> -DDOLFIN_ENABLE_TRILINOS=OFF \
> -DDOLFIN_ENABLE_PASTIX=OFF \
> -DDOLFIN_ENABLE_HDF5=OFF \
> -DDOLFIN_ENABLE_VTK=OFF \
> ~/software/fenics-install/dolfin-trunk/dolfin
>

Revision history for this message
Garth Wells (garth-wells) said :
#9

On 11 January 2013 16:51, Paul Constantine
<email address hidden> wrote:
> Question #218687 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/218687
>
> Status: Answered => Open
>
> Paul Constantine is still having a problem:
> Thanks, Kent and Johan. ldd revealed that libdolfin.so is linked to
> /usr/lib64/libboost*
>

This looks suspiciously like the FindBoost.cmake bug that I hit on a
Scientific Linux machine.

> How can I change this to link to /usr/local/lib/libboost* ? Is there a
> variable I can change in the cmake process?
>

Try setting

    Boost_NO_BOOST_CMAKE=true

This has been added to DOLFIN 1.1. It stops the FindBoost.cmake script
from looking in /usr/lib* when it's already been told not to.

Garth

> Here's my current cmake command:
>
> cmake \
> -DPETSC_DIR=/usr/local/petsc \
> -DPETSC_ARCH=arch-linux2-c-debug \
> -DDOLFIN_ENABLE_SLEPC=OFF \
> -DDOLFIN_ENABLE_SCOTCH=OFF \
> -DDOLFIN_ENABLE_QT=OFF \
> -DDOLFIN_ENABLE_TRILINOS=OFF \
> -DDOLFIN_ENABLE_PASTIX=OFF \
> -DDOLFIN_ENABLE_HDF5=OFF \
> -DDOLFIN_ENABLE_VTK=OFF \
> ~/software/fenics-install/dolfin-trunk/dolfin
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.

Revision history for this message
Best Garth Wells (garth-wells) said :
#10

On 11 January 2013 17:11, Johan Hake
<email address hidden> wrote:
> Question #218687 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/218687
>
> Status: Open => Answered
>
> Johan Hake proposed the following answer:
> Set the environment variable:
>
> export BOOST_ROOT=/usr/local
>
> and clear the CMake cache.
>

It's still necessary to set

   Boost_NO_BOOST_CMAKE=true

on systems that provide a BoostConfig.cmake (like RHEL and clones) to
make CMake respect BOOST_ROOT.

Garth

> Johan
>
> On 01/11/2013 05:51 PM, Paul Constantine wrote:
>> Question #218687 on DOLFIN changed:
>> https://answers.launchpad.net/dolfin/+question/218687
>>
>> Status: Answered => Open
>>
>> Paul Constantine is still having a problem:
>> Thanks, Kent and Johan. ldd revealed that libdolfin.so is linked to
>> /usr/lib64/libboost*
>>
>> How can I change this to link to /usr/local/lib/libboost* ? Is there a
>> variable I can change in the cmake process?
>>
>> Here's my current cmake command:
>>
>> cmake \
>> -DPETSC_DIR=/usr/local/petsc \
>> -DPETSC_ARCH=arch-linux2-c-debug \
>> -DDOLFIN_ENABLE_SLEPC=OFF \
>> -DDOLFIN_ENABLE_SCOTCH=OFF \
>> -DDOLFIN_ENABLE_QT=OFF \
>> -DDOLFIN_ENABLE_TRILINOS=OFF \
>> -DDOLFIN_ENABLE_PASTIX=OFF \
>> -DDOLFIN_ENABLE_HDF5=OFF \
>> -DDOLFIN_ENABLE_VTK=OFF \
>> ~/software/fenics-install/dolfin-trunk/dolfin
>>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#11

Thanks Garth Wells, that solved my question.

Revision history for this message
Paul Constantine (paul-g-constantine) said :
#12

Just FYI. I had to set BOOST_DIR in the environment instead of BOOST_ROOT.

BOOST_ROOT was ultimately set in CMakeLists.txt according the BOOST_DIR.