Hi everyone. I’m currently trying to port a big Python project from a Docker development setup to Nix. In the process I’ve run into a weird issue, and I think I need help.
We depend on Pillow (v9.5.0) for calculating the size of a block of text. For that, we use ImageFont.getsize.
But this function call has different results depending on whether we use Nix as an environment or install pillow in a “normal” debian environment.
I’m assuming this is because some library is different somewhere down the line, but as far as I can tell at least libfreetype is of the same version. Checking for identity of the libraries is not that easy because the Nix libraries have been treated with patchElf.
If anyone knows what knobs I can turn to fix this or at least get more information about the underlying problem I would be very greatful.
I did find one difference. poetry2nix seems to choose Pillow-9.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl while pip in the docker container chooses Pillow-9.5.0-cp310-cp310-manylinux_2_28_x86_64.whl
No idea why yet, or if this influences the difference in any way.
Oh, wow, I don’t think I would have found that anytime soon, thanks a lot!
Now I just have to think of a way to get Raqm into the nix variant (aside from wanting to change as little as possible I think we will need RAQM for rtl text)
That might take a bit of work still. We’re currently on Pillow 9.5 which seems to have problems building from source in poetry2nix^^
We might be able to upgrade, etc.
What I’m not quite sure about is… how does the docker version get libraqm? I tried searching for any mention of raqm in the file system and couldn’t find anything. Is it statically built into _imagingft.cpython-310-aarch64-linux-gnu.so or something? O.o
In any case, thanks so much for your help. I’ll resume the experimentation tomorrow
Good catch!
I’m currently trying messing around with patchelf and adding fribidi to the propagated build inputs, but so far no luck.
If I understand this correctly, technically all that would need to happen is dlopen needs to find libfribidi.so. I think the two things in the way of that is having libfribidi.so in the search path and teaching dlopen to actually search for it (which I believe is turned off by nix normally?)
Now our dependency properly formats text with RAQM.
Thanks again for all your help @_Andrew
I will mark this as the “solution” so future people with the same problem have an easy time finding it, but it’s really none of my work^^