-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Cannot install on windows #7
Comments
I never tried to build it on Windows machines, and the error is quite obscure, so it's not easy for me to help here. Does the compiler toolchain come with I will try to install it on a VM with Win8 (if it still boot...), and report back. |
A very quick inspection suggests that even the underlying libpg_query library isn't easily compilable on Windows: its Makefile relies on GNU make facilities... |
Oh, I see now. I'll try to build it using MinGW and will let you know |
Nope, the same error. |
Yes, at this point Windows is unfortunately not supported for libpg_query - the error above probably is caused by a compilation error in the C library code itself. |
Thank you Lukas! I spent a little on this, but the |
Apart from the makefiles the other issue is that the extracted code from Postgres is currently not supporting Windows. I've created pganalyze/libpg_query#44 to track this on the libpg_query repo itself. |
Closing this issue as outdated |
New year brought new hope on the subject, sooner or later someone could try it out. |
I did some experiments, but I ran out of spare time and ideas trying to solve redefinition errors between PG's |
@lfittl, any idea on what may trigger those hard errors? |
I think that can happen when the windows system headers get loaded before pg_query gets loaded and is able to set some defines. Specifically, I think the Windows definition of S_IFLNK might get pulled in because WIN32_LEAN_AND_MEAN isn't set the first time windows.h gets loaded (see https://github.com/pganalyze/libpg_query/blob/16-latest/src/postgres/include/port/win32_port.h#L47). It appears that S_IFLNK is the only hard error in that build, it might be worth to change the relevant code to instead look like this:
|
Thank you, I will try to reorder the headers inclusion and see what happens. |
As suggested by Lukas in #7 (comment), the PG headers must be included first under Windows, even before any other system header. This is still not enough though, and I'm still investigating how to convince Cython to include Python.h after postgresql.h.
The good news is that on my local development machine I finally got it working, and all tests are green. |
As suggested by Lukas in #7 (comment), the PG headers must be included first under Windows, even before any other system header. This is still not enough though, and I'm still investigating how to convince Cython to include Python.h after postgresql.h.
Compiling on Windows is always a pain (IMHO, of course :-), but with a sufficient amount of patience I was eventually able to do it, first on my local machine and then tweaking the CI configuration to build wheels on GitHub. Due to the way PG's headers has been extended to support Windows, its main header (that is, postgres.h) must be included earlier than any other system header, and that means before Python.h. Since I could not find a way to convince Cython to generate a C source that includes a particular header before anything else, I replaced the `cythonize` approach with an explicit pre-generation of the C source using the `cython` CLI tool and the hacking it with `ed` to move the import of "postgres.h" near the beginning. This fixes issue #7.
I just released 6.0.dev2, and the CI should produce Windows wheels... 🥳 |
v6 is out, carrying Windows binary wheels! |
Windows 10, Python 3.6.
Full output is:
The text was updated successfully, but these errors were encountered: