Re: building python package

2023-12-19 Thread lipp f
I noticed something strange. I do this:
$ PYTHONPATH=lib/ python
>>> import ledger
>>> j_file = r"/mnt/e/Data/Invest/data/ledger/xx.j"
>>> journal = ledger.read_journal(j_file)
>>> journal = ledger.read_journal(j_file)

Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: Assertion failed in 
"/home/sergiu/ledger-3.3.2/src/session.cc", line 183:std::size_t 
ledger::session_t::read_data(const string&): xact_count == 
journal->xacts.size()
>>>
I can only read the  journal once.

On Tuesday, December 19, 2023 at 5:37:41 PM UTC-5 lipp f wrote:

> sure. I also was thinking to document all steps required to install ledger 
> in a conda environment.
>
>
> On Tuesday, December 19, 2023 at 5:16:00 PM UTC-5 Alexis wrote:
>
>> Yay! 
>>
>> Glad to hear that you managed to get it working. 
>> Welcome to the quirky and wonderful world of Ledger Python! :) 
>>
>> I've been using Ledger Python for several years time, happy to answer 
>> questions and take inspiration for future API development from your 
>> experience with it. 
>>
>> To answer your question, yes, as long as ledger.so is compiled properly 
>> for the architecture and system you expect it to run on, you can place 
>> it were you like and tell Python about its location using PYTHONPATH 
>> or other means Python offers to load modules. 
>>
>> If you have the time and would like to give back, some feedback on 
>> what would have helped you in terms of documentation or examples to 
>> get Python Ledger installed would be appreciated. 
>>
>>
>> Cheers 
>> Alexis 
>>
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/e494ba35-e6ee-470a-a486-2d13efa19bd3n%40googlegroups.com.


Re: building python package

2023-12-19 Thread lipp f
I noticed something strange. I do this:
$ PYTHONPATH=lib/ python
>>> import ledger
>>> j_file = r"/mnt/e/Data/Invest/data/ledger/U13342246.j"
>>> journal = ledger.read_journal(j_file)
>>> journal = ledger.read_journal(j_file)
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: Assertion failed in 
"/home/sergiu/ledger-3.3.2/src/session.cc", line 183:std::size_t 
ledger::session_t::read_data(const string&): xact_count == 
journal->xacts.size()
>>>
I can only read the  journal once.

On Tuesday, December 19, 2023 at 5:37:41 PM UTC-5 lipp f wrote:

> sure. I also was thinking to document all steps required to install ledger 
> in a conda environment.
>
>
> On Tuesday, December 19, 2023 at 5:16:00 PM UTC-5 Alexis wrote:
>
>> Yay! 
>>
>> Glad to hear that you managed to get it working. 
>> Welcome to the quirky and wonderful world of Ledger Python! :) 
>>
>> I've been using Ledger Python for several years time, happy to answer 
>> questions and take inspiration for future API development from your 
>> experience with it. 
>>
>> To answer your question, yes, as long as ledger.so is compiled properly 
>> for the architecture and system you expect it to run on, you can place 
>> it were you like and tell Python about its location using PYTHONPATH 
>> or other means Python offers to load modules. 
>>
>> If you have the time and would like to give back, some feedback on 
>> what would have helped you in terms of documentation or examples to 
>> get Python Ledger installed would be appreciated. 
>>
>>
>> Cheers 
>> Alexis 
>>
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/06aa482c-4985-4d92-8b46-a5cb688cdb7dn%40googlegroups.com.


Re: building python package

2023-12-19 Thread lipp f
sure. I also was thinking to document all steps required to install ledger 
in a conda environment.


On Tuesday, December 19, 2023 at 5:16:00 PM UTC-5 Alexis wrote:

> Yay!
>
> Glad to hear that you managed to get it working.
> Welcome to the quirky and wonderful world of Ledger Python! :)
>
> I've been using Ledger Python for several years time, happy to answer
> questions and take inspiration for future API development from your
> experience with it.
>
> To answer your question, yes, as long as ledger.so is compiled properly
> for the architecture and system you expect it to run on, you can place
> it were you like and tell Python about its location using PYTHONPATH
> or other means Python offers to load modules.
>
> If you have the time and would like to give back, some feedback on
> what would have helped you in terms of documentation or examples to
> get Python Ledger installed would be appreciated.
>
>
> Cheers
> Alexis
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/598df123-dae2-4627-9768-76e7738d8cben%40googlegroups.com.


Re: building python package

2023-12-19 Thread Alexis
Yay!

Glad to hear that you managed to get it working.
Welcome to the quirky and wonderful world of Ledger Python! :)

I've been using Ledger Python for several years time, happy to answer
questions and take inspiration for future API development from your
experience with it.

To answer your question, yes, as long as ledger.so is compiled properly
for the architecture and system you expect it to run on, you can place
it were you like and tell Python about its location using PYTHONPATH
or other means Python offers to load modules.

If you have the time and would like to give back, some feedback on
what would have helped you in terms of documentation or examples to
get Python Ledger installed would be appreciated.


Cheers
Alexis

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/bizdkvfjt5sfjh5xyyqa6e4p6s2o33apjp6a4i5hfgvqn5uorm%40xdnysnj4nc4x.


Re: building python package

2023-12-19 Thread lipp f
A big thank you  Alexis. It works indeed. After make install I had to add 
/home/sergiu/miniconda3/envs/ldg-build/lib 
to ld.so.conf and I can run python  ./python/demo.py
Welcome to the Ledger.Python demo!
Demo completed successfully.
Now, if I understand this correctly, the python module is in ledger.so and 
whenever I want to "import ledger" I have to setup  PYTHONPATH to the 
location where ledger.so is. Am I rigth?


On Tuesday, December 19, 2023 at 3:32:30 PM UTC-5 Alexis wrote:

> Hi,
>
> quite frankly I'm not particularly fond of acprep and prefer to use
> the tools it wraps. Please find below the commands I use to cleanly
> build ledger with Python support on macOS with a build environment
> setup from nix flake and using cmake and make directly:
>
> % rm ledger{,.so}
> % rm -rf build
> % cmake -Bbuild -S. -DUSE_PYTHON:BOOL=ON -DPython_ROOT_DIR=$(which 
> python)/../../
> % make -Cbuild -j8
> % ls -lsa ./build/ledger{,.so}
> 428 -rwxr-xr-x 1 $USER staff 435664 Dec 19 21:27 ./build/ledger
> 5684 -rwxr-xr-x 1 $USER staff 5819184 Dec 19 21:27 ./build/ledger.so
> % ./build/ledger --version | head -2
> Ledger 3.3.2-20230330, the command-line accounting tool
> without support for gpg encrypted journals and with Python support
> % env PYTHONPATH=/does/not/exist python -c 'import ledger; 
> print(ledger.__version__)'
> Traceback (most recent call last):
> File "", line 1, in 
> ModuleNotFoundError: No module named 'ledger'
> % env PYTHONPATH=$PWD/build python -c 'import ledger; 
> print(ledger.__version__)'
> 3.3.2
>
> Not sure how helpful this is going to be yet the following works for me 
> too:
>
> % ./acprep clean
> % ls -lsa ./ledger{,.so}
> ls: cannot access './ledger': No such file or directory
> ls: cannot access './ledger.so': No such file or directory
> % ./acprep configure --python -- -DPython_ROOT_DIR=$(which python)/../../
> % ./acprep make -j8
> % ls -lsa ./ledger{,.so}
> 928 -rwxr-xr-x 1 $USER staff 948368 Dec 19 21:19 ./ledger
> 8916 -rwxr-xr-x 1 $USER staff 9126192 Dec 19 21:19 ./ledger.so
> % ./ledger --version | head -2
> Ledger 3.3.2-20230330, the command-line accounting tool
> without support for gpg encrypted journals and with Python support
> % PYTHONPATH=. python -c 'import ledger; print(ledger.__version__)'
> 3.3.2
>
> 爛
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/4fea156c-1920-4051-ab93-7bfca574ba34n%40googlegroups.com.


Re: building python package

2023-12-19 Thread Alexis
Hi,

quite frankly I'm not particularly fond of acprep and prefer to use
the tools it wraps. Please find below the commands I use to cleanly
build ledger with Python support on macOS with a build environment
setup from nix flake and using cmake and make directly:

  % rm ledger{,.so}
  % rm -rf build
  % cmake -Bbuild -S. -DUSE_PYTHON:BOOL=ON -DPython_ROOT_DIR=$(which 
python)/../../
  % make -Cbuild -j8
  % ls -lsa ./build/ledger{,.so}
   428 -rwxr-xr-x 1 $USER staff  435664 Dec 19 21:27 ./build/ledger
  5684 -rwxr-xr-x 1 $USER staff 5819184 Dec 19 21:27 ./build/ledger.so
  % ./build/ledger --version | head -2
  Ledger 3.3.2-20230330, the command-line accounting tool
  without support for gpg encrypted journals and with Python support
  % env PYTHONPATH=/does/not/exist python -c 'import ledger; 
print(ledger.__version__)'
  Traceback (most recent call last):
File "", line 1, in 
  ModuleNotFoundError: No module named 'ledger'
  % env PYTHONPATH=$PWD/build python -c 'import ledger; 
print(ledger.__version__)'
  3.3.2

Not sure how helpful this is going to be yet the following works for me too:

  % ./acprep clean
  % ls -lsa ./ledger{,.so}
  ls: cannot access './ledger': No such file or directory
  ls: cannot access './ledger.so': No such file or directory
  % ./acprep configure --python -- -DPython_ROOT_DIR=$(which python)/../../
  % ./acprep make -j8
  % ls -lsa ./ledger{,.so}
   928 -rwxr-xr-x 1 $USER staff  948368 Dec 19 21:19 ./ledger
  8916 -rwxr-xr-x 1 $USER staff 9126192 Dec 19 21:19 ./ledger.so
  % ./ledger --version | head -2
  Ledger 3.3.2-20230330, the command-line accounting tool
  without support for gpg encrypted journals and with Python support
  % PYTHONPATH=. python -c 'import ledger; print(ledger.__version__)'
  3.3.2

爛

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/kbqmrocglev7lk4ekavxeuikqs5cakvdjtfgfyedcn3tltng4w%40ghjgcivqdwst.


Re: building python package

2023-12-19 Thread lipp f
Giving up.

$ ./acprep clean
$ ./acprep configure  -DUSE_PYTHON=ON 
-DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/
$ ./acprep make -- -DUSE_PYTHON=ON 
-DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/

No errors whatsoever.

$ ./ledger
Ledger 3.3.2-20230330, the command-line accounting tool
without support for gpg encrypted journals and* without Python support*

Copyright (c) 2003-2023, John Wiegley.  All rights reserved.

On Tuesday, December 19, 2023 at 1:41:43 PM UTC-5 Alexis wrote:

> Hi,
>
> > I can run $ ./ledger --version and I'm getting "Ledger 3.3.2-20230330", 
>
> Posting the complete output of ./ledger --version is helpful as the
> version info includes a note about Python support:
>
> % ledger --version | head -2
> Ledger 3.3.2-20230330, the command-line accounting tool
> with support for gpg encrypted journals and with Python support
>
> > which is great, but the python test, fails on "import ledger".
>
> Seeing how you invoke Python, which version is run, and the actual
> error message when "the python test fails on "import ledger" can be
> insightful, e.g.:
>
> % /usr/bin/python3
> Python 3.9.6 (default, Nov 10 2023, 13:38:27)
> [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import ledger
> Traceback (most recent call last):
> File "", line 1, in 
> ModuleNotFoundError: No module named 'ledger'
>
> Maybe you could do a complete clean build from within a shell started
> with script(1) and reply to this mail with the output (ledger-build.log)
> attached?
>
> % script ledger-build.log
> % ./acprep 
> % exit
>
> Looking at the linked libraries of the ledger (ldd output) built on
> your system I do not see any references to Python, which exist for me
> on my machine (see below).
>
> % otool -L $(which ledger)
> ~/.nix-profile/bin/ledger:
> /nix/store/zm4a348a65ilcl35dg1sc5wmr98f0qnn-ledger-3.3.2/lib/libledger.3.dylib
>  
> (compatibility version 3.0.0, current version 3.0.0)
> /nix/store/3zkxk2nzf3b59fmdqi7s8fasl4asgx37-gpgme-1.23.0/lib/libgpgmepp.6.dylib
>  
> (compatibility version 27.0.0, current version 27.0.0)
> /nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/lib/libpython3.11.dylib
>  
> (compatibility version 3.11.0, current version 3.11.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 
> 1292.60.1)
> /nix/store/3zkxk2nzf3b59fmdqi7s8fasl4asgx37-gpgme-1.23.0/lib/libgpgme.11.dylib
>  
> (compatibility version 44.0.0, current version 44.0.0)
> /nix/store/sc9h2pf31m4pqbnq9h5f5yj0ccgr1hb6-libassuan-2.5.6/lib/libassuan.0.dylib
>  
> (compatibility version 9.0.0, current version 9.6.0)
> /nix/store/l455b10bq8vri2gzgy7jk5fzjh6q24b8-mpfr-4.2.1/lib/libmpfr.6.dylib 
> (compatibility version 9.0.0, current version 9.1.0)
> /nix/store/1mlfpdjs99nhkin3gi2ns37vggkskkr4-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
>  
> (compatibility version 16.0.0, current version 16.0.0)
> /nix/store/4w0d6ly44x9mczv4s0x26dyhisgshb01-libedit-20221030-3.1/lib/libedit.0.dylib
>  
> (compatibility version 1.0.0, current version 1.70.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_date_time.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_filesystem.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_atomic.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_system.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_iostreams.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_regex.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_unit_test_framework.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_python311.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_nowide.dylib
>  
> (compatibility version 0.0.0, current version 0.0.0)
> /nix/store/0w070w3a2azyy1gs4mgskz9j3pq0g5dy-libcxxabi-16.0.6/lib/libc++abi.1.dylib
>  
> (compatibility version 1.0.0, current version 1.0.0)
> /nix/store/jkp27cvkfzy264pgmwgry17rkyi50m3r-gettext-0.21.1/lib/libintl.8.dylib
>  
> (compatibility version 12.0.0, current version 12.0.0)
> /nix/store/a78xnmg223s3iffja69ydg6sswbwd3i3-libiconv-50/lib/libiconv.dylib 
> (compatibility version 7.0.0, current version 7.0.0)
> /nix/store/p5wr7bxrs2naa4rwy9sqs19rljr7g7qh-libcxx-16.0.6/lib/libc++.1.0.dylib
>  
> (compatibility version 1.0.0, current version 1.0.0)
>

-- 


Re: building python package

2023-12-19 Thread Alexis
Hi,

> I can run $ ./ledger --version and I'm getting "Ledger 3.3.2-20230330", 

Posting the complete output of ./ledger --version is helpful as the
version info includes a note about Python support:

  % ledger --version | head -2
  Ledger 3.3.2-20230330, the command-line accounting tool
  with support for gpg encrypted journals and with Python support

> which is great, but the python test, fails on "import ledger".

Seeing how you invoke Python, which version is run, and the actual
error message when "the python test fails on "import ledger" can be
insightful, e.g.:

  % /usr/bin/python3
  Python 3.9.6 (default, Nov 10 2023, 13:38:27)
  [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import ledger
  Traceback (most recent call last):
File "", line 1, in 
  ModuleNotFoundError: No module named 'ledger'

Maybe you could do a complete clean build from within a shell started
with script(1) and reply to this mail with the output (ledger-build.log)
attached?

  % script ledger-build.log
  % ./acprep 
  % exit

Looking at the linked libraries of the ledger (ldd output) built on
your system I do not see any references to Python, which exist for me
on my machine (see below).

  % otool -L $(which ledger)
  ~/.nix-profile/bin/ledger:

/nix/store/zm4a348a65ilcl35dg1sc5wmr98f0qnn-ledger-3.3.2/lib/libledger.3.dylib 
(compatibility version 3.0.0, current version 3.0.0)

/nix/store/3zkxk2nzf3b59fmdqi7s8fasl4asgx37-gpgme-1.23.0/lib/libgpgmepp.6.dylib 
(compatibility version 27.0.0, current version 27.0.0)

/nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/lib/libpython3.11.dylib
 (compatibility version 3.11.0, current version 3.11.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 
1292.60.1)

/nix/store/3zkxk2nzf3b59fmdqi7s8fasl4asgx37-gpgme-1.23.0/lib/libgpgme.11.dylib 
(compatibility version 44.0.0, current version 44.0.0)

/nix/store/sc9h2pf31m4pqbnq9h5f5yj0ccgr1hb6-libassuan-2.5.6/lib/libassuan.0.dylib
 (compatibility version 9.0.0, current version 9.6.0)
/nix/store/l455b10bq8vri2gzgy7jk5fzjh6q24b8-mpfr-4.2.1/lib/libmpfr.6.dylib 
(compatibility version 9.0.0, current version 9.1.0)

/nix/store/1mlfpdjs99nhkin3gi2ns37vggkskkr4-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
 (compatibility version 16.0.0, current version 16.0.0)

/nix/store/4w0d6ly44x9mczv4s0x26dyhisgshb01-libedit-20221030-3.1/lib/libedit.0.dylib
 (compatibility version 1.0.0, current version 1.70.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_date_time.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_filesystem.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_atomic.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_system.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_iostreams.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_regex.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_unit_test_framework.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_python311.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/rd912bdihq9azqhmx37p39yp05mv8vca-boost-1.81.0/lib/libboost_nowide.dylib
 (compatibility version 0.0.0, current version 0.0.0)

/nix/store/0w070w3a2azyy1gs4mgskz9j3pq0g5dy-libcxxabi-16.0.6/lib/libc++abi.1.dylib
 (compatibility version 1.0.0, current version 1.0.0)

/nix/store/jkp27cvkfzy264pgmwgry17rkyi50m3r-gettext-0.21.1/lib/libintl.8.dylib 
(compatibility version 12.0.0, current version 12.0.0)
/nix/store/a78xnmg223s3iffja69ydg6sswbwd3i3-libiconv-50/lib/libiconv.dylib 
(compatibility version 7.0.0, current version 7.0.0)

/nix/store/p5wr7bxrs2naa4rwy9sqs19rljr7g7qh-libcxx-16.0.6/lib/libc++.1.0.dylib 
(compatibility version 1.0.0, current version 1.0.0)

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/k4o2wmyfnwsdezmrjevtnzyo6u3vvr4znwah7g5yy4dri46ifu%402sqeunfvyujt.


Re: building python package

2023-12-19 Thread lipp f
Thank you for all the help  Alexis.  Probably you didn't notice the 
previous message but the ncurses issue was resolved, and I can do the full 
build now. The issues are that the built seems to be without python, there 
is no python module under site-packages and make install puts the files in 
a wrong place.

On Tuesday, December 19, 2023 at 12:59:04 PM UTC-5 Alexis wrote:

> Hi,
>
> some of the things that you might try to resolve this are:
>
> 1. Disable use of libedit by appending -DHAVE_EDIT:BOOL=NO to the
> ./acprep call
>
> 2. Define LDFLAGS="-L$PATH_TO_NCURSES_LIBDIR -lncurses" in the
> environment when running acprep hoping cmake will pick it up
> properly.
>
> 3. Manually disable use of libedit in CMakeLists.txt by
> adding the following below line 256¹
> set(HAVE_EDIT 0)
>
>
> Cheers
> Alexis
>
> ¹ https://github.com/ledger/ledger/blob/master/CMakeLists.txt#L256
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/deecbbd5-6b61-495d-86d1-ca11db8df787n%40googlegroups.com.


Re: building python package

2023-12-19 Thread Alexis
Hi,

some of the things that you might try to resolve this are:

1. Disable use of libedit by appending -DHAVE_EDIT:BOOL=NO to the
   ./acprep call

2. Define LDFLAGS="-L$PATH_TO_NCURSES_LIBDIR -lncurses" in the
   environment when running acprep hoping cmake will pick it up
   properly.

3. Manually disable use of libedit in CMakeLists.txt by
   adding the following below line 256¹
   set(HAVE_EDIT 0)


Cheers
Alexis

¹ https://github.com/ledger/ledger/blob/master/CMakeLists.txt#L256

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/26pw2c5e7dgyz7oledcmp5rg5p4fqcplr26ffw5jwjpykjnspg%40vjr4ut3cvpho.


Re: building python package

2023-12-19 Thread lipp f
I am getting close. I had to uninstall two python packages. readline and 
ncurses. Compiling and linking ends without errors.
I can run $ ./ledger --version and I'm getting "Ledger 3.3.2-20230330", 
which is great, but the python test, fails on "import ledger".

$ make test
100% tests passed, 0 tests failed out of 411

Total Test time (real) =  26.18 sec

I did the build with ./acprep configure --prefix=~/local/bin ... . When i 
run make install, I was expecting everything to go under $HOME/local/bin 
but it goes under /usr/local and destroys my previously installed ubuntu 
package. Also, there is no trace of the python module 
under /home/sergiu/miniconda3/envs/ldg-build/lib/python3.8/site-packages. 

$ sudo make install
[sudo] password for sergiu:
[ 80%] Built target libledger
[ 85%] Built target ledger
[ 95%] Built target MathTests
[100%] Built target UtilTests
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libledger.so.3
-- Set runtime path of "/usr/local/lib/libledger.so.3" to "/usr/local/lib"
-- Up-to-date: /usr/local/lib/libledger.so
-- Up-to-date: /usr/local/include/ledger/account.h
-- Up-to-date: /usr/local/include/ledger/amount.h
-- Up-to-date: /usr/local/include/ledger/annotate.h
-- Up-to-date: /usr/local/include/ledger/balance.h
-- Up-to-date: /usr/local/include/ledger/chain.h
-- Up-to-date: /usr/local/include/ledger/commodity.h
-- Up-to-date: /usr/local/include/ledger/compare.h
-- Up-to-date: /usr/local/include/ledger/context.h
-- Up-to-date: /usr/local/include/ledger/convert.h
-- Up-to-date: /usr/local/include/ledger/csv.h
-- Up-to-date: /usr/local/include/ledger/draft.h
-- Up-to-date: /usr/local/include/ledger/emacs.h
-- Up-to-date: /usr/local/include/ledger/error.h
-- Up-to-date: /usr/local/include/ledger/expr.h
-- Up-to-date: /usr/local/include/ledger/exprbase.h
-- Up-to-date: /usr/local/include/ledger/filters.h
-- Up-to-date: /usr/local/include/ledger/flags.h
-- Up-to-date: /usr/local/include/ledger/format.h
-- Up-to-date: /usr/local/include/ledger/generate.h
-- Up-to-date: /usr/local/include/ledger/global.h
-- Up-to-date: /usr/local/include/ledger/gpgme.h
-- Up-to-date: /usr/local/include/ledger/history.h
-- Up-to-date: /usr/local/include/ledger/item.h
-- Up-to-date: /usr/local/include/ledger/iterators.h
-- Up-to-date: /usr/local/include/ledger/journal.h
-- Up-to-date: /usr/local/include/ledger/lookup.h
-- Up-to-date: /usr/local/include/ledger/mask.h
-- Up-to-date: /usr/local/include/ledger/op.h
-- Up-to-date: /usr/local/include/ledger/option.h
-- Up-to-date: /usr/local/include/ledger/output.h
-- Up-to-date: /usr/local/include/ledger/parser.h
-- Up-to-date: /usr/local/include/ledger/pool.h
-- Up-to-date: /usr/local/include/ledger/post.h
-- Up-to-date: /usr/local/include/ledger/precmd.h
-- Up-to-date: /usr/local/include/ledger/predicate.h
-- Up-to-date: /usr/local/include/ledger/print.h
-- Up-to-date: /usr/local/include/ledger/pstream.h
-- Up-to-date: /usr/local/include/ledger/ptree.h
-- Up-to-date: /usr/local/include/ledger/pyinterp.h
-- Up-to-date: /usr/local/include/ledger/pyutils.h
-- Up-to-date: /usr/local/include/ledger/query.h
-- Up-to-date: /usr/local/include/ledger/quotes.h
-- Up-to-date: /usr/local/include/ledger/report.h
-- Up-to-date: /usr/local/include/ledger/scope.h
-- Up-to-date: /usr/local/include/ledger/select.h
-- Up-to-date: /usr/local/include/ledger/session.h
-- Up-to-date: /usr/local/include/ledger/stats.h
-- Up-to-date: /usr/local/include/ledger/stream.h
-- Up-to-date: /usr/local/include/ledger/temps.h
-- Up-to-date: /usr/local/include/ledger/timelog.h
-- Up-to-date: /usr/local/include/ledger/times.h
-- Up-to-date: /usr/local/include/ledger/token.h
-- Up-to-date: /usr/local/include/ledger/unistring.h
-- Up-to-date: /usr/local/include/ledger/utils.h
-- Up-to-date: /usr/local/include/ledger/value.h
-- Up-to-date: /usr/local/include/ledger/views.h
-- Up-to-date: /usr/local/include/ledger/xact.h
-- Up-to-date: /usr/local/include/ledger/system.hh
-- Installing: /usr/local/bin/ledger
-- Set runtime path of "/usr/local/bin/ledger" to "/usr/local/lib"
-- Up-to-date: /usr/local/share/man/man1/ledger.1

and here is the ldd:
$ ldd ledger
linux-vdso.so.1 (0x7fff5bbf9000)
libledger.so.3 => /home/sergiu/ledger-3.3.2/libledger.so.3 
(0x7f957de9f000)
libedit.so.2 => /lib/x86_64-linux-gnu/libedit.so.2 
(0x7f957de54000)
libboost_filesystem.so.1.82.0 => 
/home/sergiu/miniconda3/envs/ldg-build/lib/libboost_filesystem.so.1.82.0 
(0x7f957de32000)
libstdc++.so.6 => 
/home/sergiu/miniconda3/envs/ldg-build/lib/libstdc++.so.6 
(0x7f957dc1e000)
libgcc_s.so.1 => 
/home/sergiu/miniconda3/envs/ldg-build/lib/libgcc_s.so.1 
(0x7f957dc04000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7f957da12000)
libmpfr.so.6 => /lib/x86_64-linux-gnu/libmpfr.so.6 
(0x7f957d98f000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 
(0x7f957d90b000)

Re: building python package

2023-12-19 Thread lipp f
More progress:
- first I have to do ./acprep clean with each attempt
- before I've seen your last message, i did ./acprep configure 
--prefix=/usr/local -- -DUSE_PYTHON=ON 
-DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/
- I also tryed your options
- in make, both sets of options compile to the end with some warnings but 
no errors, and both of them fail in linking with 6 "undefined reference to  
NCURSES6_TINFO symbols in libedit.so:

[ 83%] Building CXX object src/CMakeFiles/ledger.dir/global.cc.o
In file included from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/function/detail/requires_cxx11.hpp:9,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/function/detail/prologue.hpp:12,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/function.hpp:30,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/algorithm/string/detail/find_iterator.hpp:18,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/algorithm/string/find_iterator.hpp:24,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/algorithm/string/iter_find.hpp:27,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/algorithm/string/split.hpp:16,
 from 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/algorithm/string.hpp:23,
 from /home/sergiu/ledger-3.3.2/system.hh:137,
 from /home/sergiu/ledger-3.3.2/src/global.cc:32:
/home/sergiu/miniconda3/envs/ldg-build/include/boost/bind.hpp:36:1: note: 
#pragma message: The practice of declaring the Bind placeholders (_1, _2, 
...) in the global namespace is deprecated. Please use 
 + using namespace boost::placeholders, or define 
BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.
   36 | BOOST_PRAGMA_MESSAGE(
  | ^~~~
[ 85%] Linking CXX executable ../ledger
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tgoto@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tgetent@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tgetnum@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tputs@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tgetflag@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so: 
undefined reference to `tgetstr@NCURSES6_TINFO_5.0.19991023'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/ledger.dir/build.make:111: ledger] Error 1
make[1]: *** [CMakeFiles/Makefile2:223: src/CMakeFiles/ledger.dir/all] 
Error 2
make: *** [Makefile:163: all] Error 2
acprep: ERROR: Execution failed: make


This is referred libedit.so :
$ ls -l /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so
lrwxrwxrwx 1 root root 17 Jan  3  2020 
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so -> 
libedit.so.2.0.63
and here are the 6 symbols:
$ readelf -Ws 
 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libedit.so  | 
grep -E 'tgoto|tgetent|tgetnum|tputs|tgetflag|tgetstr'
 7:  0 FUNCGLOBAL DEFAULT  UND 
tputs@NCURSES6_TINFO_5.0.19991023 (4)
31:  0 FUNCGLOBAL DEFAULT  UND 
tgoto@NCURSES6_TINFO_5.0.19991023 (4)
84:  0 FUNCGLOBAL DEFAULT  UND 
tgetnum@NCURSES6_TINFO_5.0.19991023 (4)
90:  0 FUNCGLOBAL DEFAULT  UND 
tgetflag@NCURSES6_TINFO_5.0.19991023 (4)
91:  0 FUNCGLOBAL DEFAULT  UND 
tgetstr@NCURSES6_TINFO_5.0.19991023 (4)
   123:  0 FUNCGLOBAL DEFAULT  UND 
tgetent@NCURSES6_TINFO_5.0.19991023 (4)

On Tuesday, December 19, 2023 at 10:26:03 AM UTC-5 Alexis wrote:

> Hi,
>
> > Based on your suggestions I made some progress. It finds boost in 
> configure 
>
> That's great to hear!
>
> > but it is not being picked up. Is there an option to add something to 
> make 
> > INCLUDE?
>
> There sure is: CMake's FindBoost Module¹ also offers hints with which
> an installation prefix or the preferred include and library directory
> can be set (for details see the FindBoost documentation²).
> Does specifying -DBOOST_ROOT help?
>
> % ./acprep configure --python -- \
> -DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/ \
> -DBOOST_ROOT=/home/sergiu/miniconda3/envs/ldg-build/ \
> -DBoost_NO_SYSTEM_PATHS:BOOL=ON
>
> The last hint "disable[s] searching in locations not specified by these
> hint variables"; configuring ledger using CMake may work without it.
>
>
> Godspeed :)
>
>
> ¹ 

Re: building python package

2023-12-19 Thread Alexis
Hi,

> Based on your suggestions I made some progress. It finds boost in configure 

That's great to hear!

> but it is not being picked up. Is there an option to add something to make 
> INCLUDE?

There sure is: CMake's FindBoost Module¹ also offers hints with which
an installation prefix or the preferred include and library directory
can be set (for details see the FindBoost documentation²).
Does specifying -DBOOST_ROOT help?

  % ./acprep configure --python -- \
-DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/ \
-DBOOST_ROOT=/home/sergiu/miniconda3/envs/ldg-build/ \
-DBoost_NO_SYSTEM_PATHS:BOOL=ON

The last hint "disable[s] searching in locations not specified by these
hint variables"; configuring ledger using CMake may work without it.


Godspeed :)


¹ https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake
² https://cmake.org/cmake/help/latest/module/FindBoost.html#hints

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/ihtpkcksyf5jdjcbn4557wny47nujtcj3qodjqcwxyocdpidpx%40xcfrjk4jzxxg.


Re: building python package

2023-12-19 Thread lipp f
Based on your suggestions I made some progress. It finds boost in configure 
and fails with  "fatal error: boost/filesystem/directory.hpp: No such file 
or directory" in make.

The file exists 
in 
/home/sergiu/miniconda3/envs/ldg-build/include/boost/filesystem/directory.hpp 
but it is not being picked up. Is there an option to add something to make 
INCLUDE?

$ rm -rf ./build
$ ./acprep configure --python -- 
-DPython_ROOT_DIR=/home/sergiu/miniconda3/envs/ldg-build/
acprep: INFO: Invoking primary phase: configure
acprep: INFO: Executing phase: configure
acprep: INFO: System type is => Linux
acprep: INFO: Setting up build flavor => debug
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- Found Python: /home/sergiu/miniconda3/envs/ldg-build/bin/python3.8 
(found version "3.8.18") found components: Interpreter
-- Found Python: /home/sergiu/miniconda3/envs/ldg-build/bin/python3.8 
(found version "3.8.18") found components: Interpreter Development
-- Found Boost: 
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found 
suitable version "1.71.0", minimum required is "1.49.0") found components: 
date_time filesystem system iostreams regex unit_test_framework python38 
missing components: nowide
-- Looking for getpwuid
-- Looking for getpwuid - found
-- Looking for getpwnam
-- Looking for getpwnam - found
-- Looking for ioctl
-- Looking for ioctl - found
-- Looking for isatty
-- Looking for isatty - found
-- Performing Test UNIX_PIPES_COMPILES
-- Performing Test UNIX_PIPES_COMPILES - Success
-- Performing Test BOOST_REGEX_UNICODE_RUNS
-- Performing Test BOOST_REGEX_UNICODE_RUNS - Success
-- Performing Test BOOST_MAKE_SETTER_COMPILES
-- Performing Test BOOST_MAKE_SETTER_COMPILES - Success
-- Looking for readline in edit
-- Looking for readline in edit - found
-- Performing Test HAVE_WORKING_UTFCPP
-- Performing Test HAVE_WORKING_UTFCPP - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sergiu/ledger-3.3.2
$  ./acprep make
acprep: INFO: Invoking primary phase: make
acprep: INFO: Executing phase: make
acprep: INFO: Executing phase: config
acprep: INFO: Executing phase: configure
acprep: INFO: System type is => Linux
acprep: INFO: Setting up build flavor => debug
Scanning dependencies of target libledger
[  1%] Building CXX object src/CMakeFiles/libledger.dir/cmake_pch.hxx.gch
In file included from 
/home/sergiu/ledger-3.3.2/src/CMakeFiles/libledger.dir/cmake_pch.hxx:5,
 from :
/home/sergiu/ledger-3.3.2/system.hh:151:10: fatal error: 
boost/filesystem/directory.hpp: No such file or directory
  151 | #include 
  |  ^~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/libledger.dir/build.make:64: 
src/CMakeFiles/libledger.dir/cmake_pch.hxx.gch] Error 1
make[1]: *** [CMakeFiles/Makefile2:250: src/CMakeFiles/libledger.dir/all] 
Error 2
make: *** [Makefile:163: all] Error 2
acprep: ERROR: Execution failed: make

On Sunday, December 17, 2023 at 2:11:17 PM UTC-5 Alexis wrote:

> Hi
>
> from the information presented I have no clear understanding of the
> environment and setup and I'm unfamiliar with conda and its specialities.
>
> It seems to me as if some environment manager (miniconda?) is
> setting up the environment so its Python (version 3.9) is preferred.
> Is there a way, where you could have a shell that only uses the system
> Python and retry building ledger with Python support?
>
> Unfortunately I have no good advice for troubleshooting CMake
> apart from reading FindPython.cmake¹ :/
>
> What I suggest is giving CMake a hint about which Python you'd prefer to
> be used (see Python_ROOT_DIR in FindPython module documentation²).
>
> If I'm not mistaken on Ubuntu the Python root installation directory
> should be /usr as the python executable resides in /usr/bin/python
> and its libraries in /usr/lib/python3.8; at least according the
> file Ubunut filelist³
>
> How about trying the following:
> % rm -rf ./build
> % ./acprep configure --python -- -DPython_ROOT_DIR=/usr
> % ./acprep make
> % /usr/bin/env PYTHONPATH=$PWD/build/ledger/debug python3 -c 'import 
> ledger; dir(ledger)'
>
> or if your prefer to avoid using acprep:
> % rm -rf ./build
> % cmake --fresh -Bbuild -S. -DUSE_PYTHON:BOOL=ON -DPython_ROOT_DIR=/usr
> % make -j8 -Cbuild
> % /usr/bin/env PYTHONPATH=$PWD/build python3 -c 'import ledger; 
> dir(ledger)'
>
>
> Hope this helps!
> If it's not too much to ask I'd appreciate to hear back if you run
> into issues and if you succeed I'd be interested in what you think
> would have helped you and made building Ledger Python easier for you.
>
>
> Best
> Alexis
>
> ¹ https://github.com/Kitware/CMake/blob/master/Modules/FindPython.cmake
> ² https://cmake.org/cmake/help/latest/module/FindPython.html#hints
> ³