Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix python bindings compilation on Windows #19

mitjat opened this Issue · 7 comments

3 participants


Thanks for the nice repackaging. It still needs some work on Windows though. To compile:
1) open a cmd window
2) run vcvarsall.bat (FIXME: why is this commented out in
3) run
4) FIXME: copy libcld.lib to ports/python/cld.lib
5) FIXME (biggest one): fails on Windows

The hackish solution to (5) is to make pkgconfig return (on Windows only) the dict {'define_macros': [('WIN32',None)], 'libraries': packages}
Why the hack is necessary: On windows, pkg-config is not available by default. If you get it, it depends on a dll. If you get that one as well, it doesn't find the cld.pc file. If you copy it over, it returns the nonsensical (for MSVC) value "-I/usr/local/include/cld -L/usr/local/lib/cld -lcld". It also fails to define WIN32, without which the whole thing does not compile.

Do you prefer getting a pull request or making the changes yourself? Thanks.


Related -

Im having some problems getting this up and running on Windows. I have got as far as 5, but not entirely sure on the steps involved in your hack. Can you elaborate? (im a rookie at python, but keen to learn)


@mitjat pull request welcomed since my Windows environment is onerous to setup for testing.

@jakc My Python is pretty shaky and my Windows programming a bit rusty but I'm asking some friends for help on this.


@jakc Huh, sorry, missed your post. Step 5 is to edit and replace the whole pkgconfig function with simply just this:

def pkgconfig(*packages, **kw): 
    return {'define_macros': [('WIN32',None)], 'libraries': packages}

@mzsanford OK, I'll follow up with the patch, I just don't have it handy at the moment.


Also, for posterity, CLD is now included in the absolutely wonderful Unofficial Windows Binaries for Python Extension Packages list:


Fixing up old projects and made the requested change in the issue_19_python_windows branch (SHA: 5a29fd5). Can you try that out and let me know if it works?


Thanks for the fix, Matt. I'm sorry to say I don't have that dev environment set up any more. It would take quite some effort and time to get everything to the point where I can test it, so I'll leave it be right now.

@mzsanford mzsanford self-assigned this

Merged it in

@mzsanford mzsanford closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.