Thanks Tim!

That did it!
After targetting MPFR_LIB and GMP_LIB to pyledger, I get libpyledger.so that 
imports cleanly.

However, I now get a RunTimeError on read_journal when I try the following 
code

Type "help", "copyright", "credits" or "license" for more information.
>>> import libpyledger as ledger
>>> ledger.read_journal("sample.dat")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: No default scope in which to read journal file 
'"/tmp/sample.dat"'

Using the same sample.dat file with the ledger binary works fine.

Any ideas?

Thanks,
cb

On Friday, June 21, 2013 10:09:46 PM UTC-7, Tim Crews wrote:
>
> On Friday, June 21, 2013 9:44:04 PM UTC-7, c b wrote:
>>
>>
>> I got a libpyledger.so, but upon doing an import libpyledger in python, 
>> I get the following error
>>
>> ImportError: ./libpyledger.so: undefined symbol: __gmpq_add
>>
>> Any ideas about this? I have absolutely no idea about this since I'm not 
>> a C++ programmer.
>>
>> Thanks,
>> cb
>>
>> That's a promising development.  I'm surprised that simply changing the 
> name in the BOOST_PYTHON_MODULE macro had this effect.
>
> __gmpq_add is  one of the functions from the GMP library (one of ledger's 
> dependencies), so it looks like this library did not get linked into 
> libpyledger.so.  Unfortunately, that's actually a CMake issue, not a C++ 
> issue, and CMake is almost a complete mystery to me.  Nevertheless, I'll 
> risk saying something ignorant in the hopes it might help you along.
>
> In the top-level CMakeLists.txt, it defines a macro named 
> add_ledger_library_dependencies, and you can see it adding MPFR_LIB and 
> GMP_LIB dependencies to the passed-in target.  This macro is used in 
> src/CMakeLists.txt to set "ledger" as the target that these dependencies 
> are added to.
>
> So, I think you need to use similar directives to add the same 
> dependencies to your python module library.  In src/CMakeLists.txt, after 
> you use add_library to create a pyledger library, I think you should try 
>
>    target_link_libraries(pyledger, ${MPFR_LIB}
>    target_link_libraries(pyledger, ${GMP_LIB}
>
> Tim Crews
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to