Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leptonica v1.83.0 #5

Closed
ava57r opened this issue Jan 11, 2023 · 17 comments · Fixed by houqp/leptess#54
Closed

leptonica v1.83.0 #5

ava57r opened this issue Jan 11, 2023 · 17 comments · Fixed by houqp/leptess#54

Comments

@ava57r
Copy link
Contributor

ava57r commented Jan 11, 2023

Hello.
It does not work on new leptonica version v1.83.0

I tried to compile my project.
I got an error

error[E0609]: no field `n` on type `&box::leptonica_sys::Boxa`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/leptonica-plumbing-0.6.0/src/boxa.rs:50:18
   |
50 |         if lboxa.n <= std::convert::TryFrom::try_from(i).ok()? {
   |                  ^ unknown field
   |
   = note: available fields are: `_address`

error[E0609]: no field `box_` on type `&box::leptonica_sys::Boxa`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/leptonica-plumbing-0.6.0/src/boxa.rs:53:59
   |
53 |             unsafe { Some(crate::BorrowedBox::new(&*lboxa.box_.offset(i))) }
   |                                                           ^^^^ unknown field
   |
   = note: available fields are: `_address`

error[E0609]: no field `n` on type `&box::leptonica_sys::Pixa`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/leptonica-plumbing-0.6.0/src/pixa.rs:49:18
   |
49 |         if lpixa.n <= std::convert::TryFrom::try_from(i).ok()? {
   |                  ^ unknown field
   |
   = note: available fields are: `_address`

error[E0609]: no field `pix` on type `&box::leptonica_sys::Pixa`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/leptonica-plumbing-0.6.0/src/pixa.rs:52:58
   |
52 |             unsafe { Some(crate::BorrowedPix::new(*lpixa.pix.offset(i))) }
   |                                                          ^^^ unknown field
   |
   = note: available fields are: `_address`

@ccouzens
Copy link
Owner

How strange

The fields still seem to be there

https://github.com/DanBloomberg/leptonica/blob/master/src/pix_internal.h#L234
https://github.com/DanBloomberg/leptonica/blob/master/src/pix_internal.h#L267

What operating system are you using and how did you install leptonica? I might be able to replicate your setup.

@ava57r
Copy link
Contributor Author

ava57r commented Jan 12, 2023

I found in release notes https://github.com/DanBloomberg/leptonica/blob/master/version-notes.html#L116

I install from source code

@ava57r
Copy link
Contributor Author

ava57r commented Jan 12, 2023

rename .so lib DanBloomberg/leptonica@29a33a3

@ava57r
Copy link
Contributor Author

ava57r commented Jan 12, 2023

split interface DanBloomberg/leptonica@e8b670d

@ava57r
Copy link
Contributor Author

ava57r commented Jan 12, 2023

tesseract has prepared tesseract-ocr/tesseract#3851

@ccouzens
Copy link
Owner

I've managed to replicate the issue

ccouzens added a commit to ccouzens/leptonica-sys that referenced this issue Jan 15, 2023
I've had to disable doc tests because some of the syntax in the
autogenerated comments confuses it.

It looks like access to the PIX struct is now private, so we need to use
getters.

I started looking at this because of this issue in leptonica-plumbing
ccouzens/leptonica-plumbing#5

---

To test using my dev version of leptonica I need to use this command

```bash
LD_LIBRARY_PATH=../../DanBloomberg/leptonica/local/lib PKG_CONFIG_PATH=../../DanBloomberg/leptonica/local/lib/pkgconfig cargo test --lib
```

My checkout of leptonica was built with

```bash
sudo dnf builddep leptonica-devel
./autogen.sh
./configure --prefix
 /configure "--prefix=$(pwd)/local"
make
make install
```
ccouzens added a commit to ccouzens/leptonica-sys that referenced this issue Jan 15, 2023
I've had to disable doc tests because some of the syntax in the
autogenerated comments confuses it.

It looks like access to the PIX struct is now private, so we need to use
getters.

I started looking at this because of this issue in leptonica-plumbing
ccouzens/leptonica-plumbing#5

---

To test using my dev version of leptonica I need to use this command

```bash
LD_LIBRARY_PATH=../../DanBloomberg/leptonica/local/lib PKG_CONFIG_PATH=../../DanBloomberg/leptonica/local/lib/pkgconfig cargo test --lib
```

My checkout of leptonica was built with

```bash
sudo dnf builddep leptonica-devel
./autogen.sh
./configure --prefix
 /configure "--prefix=$(pwd)/local"
make
make install
```
ccouzens added a commit that referenced this issue Jan 15, 2023
#5

```bash
LD_LIBRARY_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib" PKG_CONFIG_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib/pkgconfig" cargo test
```
@ccouzens
Copy link
Owner

ccouzens commented Feb 4, 2023

Just to keep you updated:

I'm working on this. It requires refactoring and a new interface as some things we could do previously are no longer possible.

I'm mostly there with this repository, but I want to get branches of tesseract-plumbing, LepTess and tesseract-rs using it too to ensure the new interface is good.

I also want to improve the test coverage.

@PureSci
Copy link

PureSci commented Feb 7, 2023

Hello! I am also facing the issue. What can be a possible temp solution to this? Like downgrading leptonica or...

@ccouzens
Copy link
Owner

ccouzens commented Feb 7, 2023

Hello! I am also facing the issue. What can be a possible temp solution to this? Like downgrading leptonica or...

Hi @PureSci ,

Sorry to hear you're also having the issue. Yes, in the mean time can you downgrade leptonica.

I've been building it manually so I can use 1.83.0 to work with the new ABI. You'll need to go back to 1.82.0 or earlier.

These are my notes on building it manually.

# fedora
sudo dnf builddep leptonica-devel
# ubuntu
sudo apt-get build-dep libleptonica-dev

./autogen.sh

# prefix assumes you don't want to install it system wide
./configure "--prefix=$(pwd)/local"
make
make install

Assuming you used a --prefix you'll need to set LD_LIBRARY_PATH and PKG_CONFIG_PATH (eg LD_LIBRARY_PATH=/var/home/chris/Documents/github.com/DanBloomberg/leptonica/local/lib PKG_CONFIG_PATH=/var/home/chris/Documents/github.com/DanBloomberg/leptonica/local/lib/pkgconfig when compiling or running code that uses it (PKG_CONFIG_PATH is only used for compiling).

ccouzens added a commit to ccouzens/tesseract-plumbing that referenced this issue Feb 12, 2023
ccouzens added a commit to houqp/leptess that referenced this issue Feb 12, 2023
ccouzens/leptonica-plumbing#5

It doesn't currently work, but I expect it can be refactored.

```bash
LD_LIBRARY_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib" PKG_CONFIG_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib/pkgconfig" bash -c 'cargo test --release && valgrind --leak-check=yes --error-exitcode=1 --leak-check=full --show-leak-kinds=all "$(find target/*/deps/ -executable -name 'leptess-*')"'
```
@ccouzens
Copy link
Owner

ccouzens commented Feb 17, 2023

I've raised a PR here #6.

Please feel free to review and comment.

@dbernatt
Copy link

dbernatt commented Feb 17, 2023

How to downgrade into 1.82.0 if I installed on Windows 10?

Install command on windows: vcpkg install leptonica:x64-windows-static-md

@ccouzens
Copy link
Owner

@dbernatt I don't know.

I tried to use vcpkg to go the other way (get 1.83.0) when I was first starting to work on this issue. I struggled with specifying the version at the time.

When Googling I found some information about checking out an older version of vcpkg and having that give older versions of packages.

As a work around you might be able to wait until the fix is merged.
Or you could specify the git branch in your cargo.toml

leptonica-plumbing = { git = "https://github.com/ccouzens/leptonica-plumbing", branch = "leptonica_1.83.0" }

@MGSousa
Copy link

MGSousa commented Feb 17, 2023

@dbernatt You can use the vcpkg.json manifest for overriding leptonica version or other packages (as a workaround for now).

{
  "dependencies": [
    "leptonica",
    "tesseract",
    "vcpkg-cmake-config",
    "vcpkg-cmake-get-vars",
    "vcpkg-cmake",
  ],
  "overrides": [
    {
      "name": "leptonica",
      "version": "1.82.0"
    }
  ]
}

Then just vcpkg x-update-baseline --add-initial-baseline and vcpkg install --triplet=x64-windows-static-md

@ccouzens ccouzens linked a pull request Feb 19, 2023 that will close this issue
@eniolajayi
Copy link

@MGSousa Tried what you suggested and still did not fix the issue. @ccouzens Any updates on a fix for this?

@ccouzens
Copy link
Owner

@ccouzens Any updates on a fix for this?

@eniolajayi yes. I've released leptonica-plumbing 1.0.0 which fixes this.

But I suspect you're not using this directly. I've been waiting until some upstream projects are fixed before making an announcement.

Tesseract-plumbing uses this updated version in 0.8.0.

LepTess has an open pr on it. If there's no comments soon I'll merge and release. houqp/leptess#54

ccouzens added a commit to houqp/leptess that referenced this issue Feb 21, 2023
ccouzens/leptonica-plumbing#5

It doesn't currently work, but I expect it can be refactored.

```bash
LD_LIBRARY_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib" PKG_CONFIG_PATH="$(pwd)/../../DanBloomberg/leptonica/local/lib/pkgconfig" bash -c 'cargo test --release && valgrind --leak-check=yes --error-exitcode=1 --leak-check=full --show-leak-kinds=all "$(find target/*/deps/ -executable -name 'leptess-*')"'
```
ccouzens added a commit to antimatter15/tesseract-rs that referenced this issue Feb 21, 2023
ccouzens added a commit to antimatter15/tesseract-rs that referenced this issue Feb 21, 2023
@ccouzens
Copy link
Owner

Hey all,

Everything is merged and released.
If you're on leptonica-plumbing:1.0.0

Or the upstream projects
tesseract-plumbing:0.8.0
leptess:0.14.0
tesseract:0.12.1

Then everything should just work with leptonica-1.83.0.

Let me know if otherwise.

@eniolajayi
Copy link

@ccouzens it's fixed! Thanks

s3bk pushed a commit to s3bk/tesseract-plumbing that referenced this issue Feb 27, 2023
s3bk pushed a commit to s3bk/tesseract-rs that referenced this issue Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants