honzasp / rust-turbojpeg

Rust bindings for TurboJPEG library
MIT License
16 stars 12 forks source link

cannot find -lturbojpeg #4

Closed edgarriba closed 2 years ago

edgarriba commented 2 years ago

hi ! I'm trying to package a rust-python package that includes this crate via Pyo3 maturin. I use the following docker image required to generate a manywheels distribution: quay.io/pypa/manylinux2014_x86_64

Also yum install libjpeg-turbo-devel but I get a linking error. Any ideas what would be happening ?

honzasp commented 2 years ago

Unfortunately, I don't know PyO3 or Maturin so I can't really help you much :( Perhaps you could try enabling the pkg-config feature flag of turbojpeg (which is then passed to turbojpeg-sys)? This would use pkg-config to locate the library for linking.

honzasp commented 2 years ago

I overhauled the build process of turbojpeg-sys, which links to the turbojpeg native library. By default, it builds the library from source, which should help with linking problems. Detailed documentation is here:

https://github.com/honzasp/rust-turbojpeg/tree/master/turbojpeg-sys

If this issue is still relevant to you, could you please try upgrading the turbojpeg crate to version 0.5 and see whether it helps?

edgarriba commented 2 years ago

@honzasp awesome -- I'll give it a shoot soon !!

honzasp commented 2 years ago

Hi Edgar, I'm closing this issue because it has not seen any activity in the past few months. Feel free to re-open it if you encounter more issues, though :)

edgarriba commented 1 year ago

@honzasp thanks so much. I can say that I finally integrated the crate to our cv library and added a thin layer to bind to python with pyo3. I’m still polishing and testing but so far is good and extremely fast compared to existing libraries.

here is the main code, https://github.com/kornia/kornia-rs/blob/main/src/io.rs

im still learning a bit rust so feedback is pretty much appreciated. Specially with ownership borrowing to python since I’m seeing some segmentation faults when I integrate with asyncio grpc services during the decoding here: https://github.com/kornia/camera-grpc/blob/master/camera_client.py

honzasp commented 1 year ago

Great, I'm happy that the library works for you. I eyeballed the io.rs code that you linked and it looks very reasonable. In particular, it does not use any unsafe code, so if you get segfaults, it is definitely a bug in some other code. I have zero experience with PyO3, though.

However, if you get any segfaults from turbojpeg while using this crate, don't hesitate to send a bug report.

edgarriba commented 1 year ago

@honzasp i did a but of digging and the issue was not in turbojpeg decoding. So we are good here :)