Dave, thanks a ton for your support,

I'm getting this right now:

$ otool -L _rapi.so
_rapi.so:
_rapi.so (compatibility version 0.0.0, current version 0.0.0)
libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

$ DYLD_LIBRARY_PATH=`python-config --prefix`/lib python -c 'import rapi'
Segmentation fault: 11

Where python-config --prefix points to:

/Users/roman/.anaconda/anaconda


On Sun, Aug 24, 2014 at 3:06 PM, David Froger <david.froger@inria.fr> wrote:

Hi Roman,

Seems that at run time the python library from the system is loaded instead of
the python library from anaconda.

Does this
    otool -L _rapi.so

returns:
    libpython2.7.dylib
or
    /absolute/path/to/libpython2.7.dylib
?

Does this work:
    cd rapi/pyrapi
    DYLD_LIBRARY_PATH=`python-config --prefix`/lib python -c 'import rapi'

There are compiler/linker options to set the path of the python library to be
loaded at run time, but I'm not sure what are the best pratices.

Quoting brainstorm (2014-08-24 09:18:02)
> While the fix does work for the barebones SWIG repository example, the same
> applied to RAPI (a more complex use case) fails with the exact same segfault/
> backtrace:
>
> https://github.com/ilveroluca/rapi
>
>
>
> On Thu, Aug 21, 2014 at 6:19 PM, brainstorm <braincode@gmail.com> wrote:
>
>     Thanks David! That was it!
>
>
>     On Tue, Aug 19, 2014 at 7:38 PM, David Froger <david.froger@inria.fr>
>     wrote:
>
>         Quoting brainstorm (2014-08-19 16:55:28)
>         > That sounds much more like the case... how can I fix/workaround it in
>         the
>         > Makefile?:
>         >
>         > https://github.com/brainstorm/swig-python-skel/commit/9c28128c
>
>         Hi Roman,
>
>         I modified the Makefile like this, which works for me:
>
>         https://github.com/dfroger/swig-python-skel/commit/
>         28539f12736aa99259a456bedefcccc9cd166b08
>
>         Note that distutils works very well to build Python extension, and
>         prevents
>         this kind of problems:
>
>         https://docs.python.org/2/distutils/setupscript.html#
>         extension-source-files
>
>
>
>

--
David Froger
SED-PRO
"La simplicité est la sophistication suprême."
        -- Léonard de Vinci