[pypy-dev] Problems in connecting C++ and python with cppyy

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Sat May 25 06:56:19 CEST 2013


Hi,

> 1.
>
> $ echo $LD_LIBRARY_PATH
> /home/GeV/work/hello/v1/src:/opt/root/lib/root
>
> $ ls /home/GeV/work/hello/v1/src
> libMyClassDict.rootmap  libMyClassDict.so  MyClass.h         MyClass_rflx.cpp
>
>>>>> import cppyy
>>>>> myinst = cppyy.gbl.MyClass(42)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> AttributeError: <class '__main__.::'> object has no attribute
> 'MyClass' (details: '<class '__main__.::'>' has no attribute
> 'MyClass')
>
> 2. TRY explicit load statements, Just as that Armin told me, It's OK,
> works perfectly
>
> $ echo $LD_LIBRARY_PATH
> /opt/root/lib/root
>
>>>>> import cppyy
>>>>> cppyy.load_reflection_info("./libMyClassDict.so")
>>>>> myinst = cppyy.gbl.MyClass(42)
> 42
>
> 3. Use LD_LIBRARY_PATH to clarify the path to libMyClassDict.so, still error
>
> $ echo $LD_LIBRARY_PATH
> /home/GeV/work/hello/v1/src:/opt/root/lib/root
>
>>>>> import cppyy
>>>>> cppyy.load_reflection_info("libMyClassDict.so")
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> RuntimeError: libMyClassDict.so: cannot open shared object file: No
> such file or directory
>
>
> I don't understand why the LD_LIBRARY_PATH did not work well on my PC.

neither do I, unless /home/GeV/work/hello/v1/src is not the current work
directory and you have two libMyClassDict.so.

What does:

  $ ldd /home/GeV/work/hello/v1/src/libMyClassDict.so

give? Any libraries to be linked not found?

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list