-
Notifications
You must be signed in to change notification settings - Fork 15
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
Building on windows #9
Comments
I went in and added intermediates to figure out exactly what's breaking. So it looks like it's barfing on this line Specifically, { static_cast<py::ssize_t>(img.height()), static_cast<py::ssize_t>(img.width()), bytes_per_color }, This is passed through as an initializer list to the
The values are being passed as a single initializer list to the constructor, not to the constructor directly. It still doesn't work, though. Replacing the contents of py::buffer_info image_buffer_info(image &img)
{
py::ssize_t bytes_per_color = img.bytes_per_row() / img.width();
const std::array<ssize_t, 3> shape_in = {static_cast<py::ssize_t>(img.height()), static_cast<py::ssize_t>(img.width()), bytes_per_color};
const std::array<ssize_t, 3> strides_in = {static_cast<py::ssize_t>(img.bytes_per_row()), bytes_per_color, 1L};
py::buffer_info ret = py::buffer_info(
static_cast<void*>(img.data()),
1L,
py::format_descriptor<char>::format(),
3L,
shape_in,
strides_in
);
return ret;
} (and adding |
It builds, but there's DLL issues when trying to import, currently.
Ok, I tracked down the broken dependency. First, the poppler DLLs need to be placed in the Additionally, there's a dependency on Grabbing a version from conda-forge (https://anaconda.org/conda-forge/libiconv/files) worked, but I had to rename the DLL before putting it into the Note: Conda-forge seems to also ship compiled binaries for poppler as well (https://anaconda.org/conda-forge/poppler/files). I think these are actually built by the same process as the ones from the github repo above, the paths in the packageconfig files have the same format. |
Thank you for this effort! I'm not very familiar with conda, but this is probably the easiest way to get a Windows version of poppler. Will you able to submit a pull request when all problems will be solved? For the failing test, you could simply add something like: |
That would be the plan.
Huh, I didn't realize that was a thing. Currently, I'm just changing the expected text based on I need to look at python packages I did for work a while ago and try to remember what the nicest way to package DLLs would be. Note that if you ship a precompiled package (which is probably by far the best option for windows), the only person who'd have to do the dll hijinks would be the person building the package. |
If you provide me all the needed steps to build the library, I should be able to handle the packaging. My plan is to add GitHub actions to test the package under Windows, and to upload the binary package to PyPI. |
Allright, so currently https://github.com/fake-name/python-poppler/blob/master/setup.py will package everything correctly for windows, provided you manually provide the relevant DLLs. This is a first attempt, I'm pretty sure I'm doing at least some of the packaging wrong. I'm not totally how You need a bunch of conda packages for the associated DLLs, and these paths are hard coded for my machine, which is super not great. Ideally, it should only need to be hard-coded for the machine that builds the packages, so you might need to just tweak them, I'm not sure how github actions handle windows. Also, you could probably use MSYS or similar to cross-compile, but I've got no idea how to go about doing that.
You'll also need to either cherry pick (or I can PR) 85091ae, which fixes MSVC++ not seeing a type-conversion correctly. That was the one build issue that wasn't just missing dependencies I hit. |
Ok. Could you open a pull request, with the change needed for image_buffer_info, and with the correction needed for the test? You should also add a line to NEWS.txt. Do not touch the version number for now, I will handle it. When this will be merged, I will try to find some time to write the configuration to automatically build the windows package on GitHub. |
Will do. |
It would be useful to have this available as a guide for when someone is on windows. I am mostly |
If you came here like me looking for a solution to install a package under
|
After installing poppler in windows 10, python version is 3.8.7 from poppler import load_from_file, PageRenderer |
You may try to run https://github.com/lucasg/Dependencies on the python poppler pyd to find if a dependency is missing. |
Hi @fake-name (and @cbrunet ), Did anyone had any luck in getting the package to work on Linux? I'm working on a package that would benefit a lot from not having to shell out calls to the poppler binaries (which I install through msys2 but maybe there's a better way..). It seems that fake-name's fork got things kinda working, but now it's a dozen commits behind so I'm not sure if it would need major changes or not. Thanks in advance for any pointers! |
Ok, so I'm putzing about trying to get this to build on windows
find_library()
call.*.pc
files.prefix=D:/bld/poppler_1595515154908/_h_env/Library
. I replaced them with relative paths and that seems to have worked:prefix=../../_h_env/Library
PKG_CONFIG_PATH
pointing to thelib\pkgconfig
subdirectory of wherever you unzipped the poppler librarypython setup.py bdist
will configure successfully, and then try to build.I'm now at the point where I'm hitting compiler differences:
So it looks like it's not hugely difficult to get this to do things on windows.
The text was updated successfully, but these errors were encountered: