CGAl library not loaded

Asked by Aron Wahlberg

I have just installed dolfin 0.9.7. The build process went smooth via Dorsal. However, I get the following when importing dolfin:

>>> from dolfin import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py", line 13, in <module>
    import dolfin.cpp as cpp
  File "/Users/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py", line 28, in <module>
    _cpp = swig_import_helper()
  File "/Users/aron/bzr/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/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/_cpp.so, 2): Library not loaded: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_cgal/work/CGAL-3.5.1/lib/libCGAL.4.dylib
  Referenced from: /opt/local/lib/libCGAL_Core.4.dylib
  Reason: image not found
>>>

The directory _opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_cgal does not exist on my machine. Why?
CGAL is installed with macports and the installation was trouble-free.

I run SL on Mac.

Aron

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Harish Narayanan
Solved:
Last query:
Last reply:
Revision history for this message
Harish Narayanan (hnarayanan) said :
#1

On 2/22/10 3:08 PM, Aron Wahlberg wrote:
> New question #102008 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/102008
>
> I have just installed dolfin 0.9.7. The build process went smooth via Dorsal. However, I get the following when importing dolfin:
>
>>>> from dolfin import *
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Users/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/__init__.py", line 13, in <module>
> import dolfin.cpp as cpp
> File "/Users/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py", line 28, in <module>
> _cpp = swig_import_helper()
> File "/Users/aron/bzr/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/aron/bzr/FEniCS/lib/python2.6/site-packages/dolfin/_cpp.so, 2): Library not loaded: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_cgal/work/CGAL-3.5.1/lib/libCGAL.4.dylib
> Referenced from: /opt/local/lib/libCGAL_Core.4.dylib
> Reason: image not found
>>>>

There is a bug in MacPorts' CGAL (or rather, CMake), and I have pointed
it out to them. In order to get around this for now, you need to do a
strange and dirty trick I discovered (whose details I've forgotten, but
it goes something like this):

1. Do a
   otool -L for each of libCGAL*

2. You will see your strange library
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_gis_cgal/work/CGAL-3.5.1/lib/libCGAL.4.dylib
popup in some of these.

3. Do a
   install_name_tool -change ${brokenlibrary} ${actual_library} file

   for each of the instances in each of the files.

e.g. (I think)

install_name_tool -change /bigbroken/lib/libCGAL.4.dylib
/opt/local/lib/libCGAL_Core.4.dylib

without the linebreak.

I wish I did not know this.

Harish

Revision history for this message
Best Harish Narayanan (hnarayanan) said :
#2

3. Should rather read:
install_name_tool -change /bigbroken/lib/libCGAL.4.dylib /opt/lib/libCGAL.4.dylib /opt/local/lib/libCGAL_Core.4.dylib

Revision history for this message
Aron Wahlberg (aron-simula) said :
#3

Thanks Harish Narayanan, that solved my question.