Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Fix python bindings compilation on Windows #19

Closed
mitjat opened this issue Sep 25, 2012 · 7 comments
Closed

Fix python bindings compilation on Windows #19

mitjat opened this issue Sep 25, 2012 · 7 comments
Assignees

Comments

@mitjat
Copy link

mitjat commented Sep 25, 2012

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 build.win.bat?)
  3. run build.win.bat
  4. FIXME: copy libcld.lib to ports/python/cld.lib
  5. FIXME (biggest one): setup.py 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.

@simongis
Copy link

Related - http://stackoverflow.com/questions/13328180/installing-cld-libary-on-windows-and-bind-to-python

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)

@mzsanford
Copy link
Owner

@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.

@mitjat
Copy link
Author

mitjat commented Nov 26, 2012

@Jakc Huh, sorry, missed your post. Step 5 is to edit setup.py 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.

@mitjat
Copy link
Author

mitjat commented Nov 26, 2012

Also, for posterity, CLD is now included in the absolutely wonderful Unofficial Windows Binaries for Python Extension Packages list: http://www.lfd.uci.edu/~gohlke/pythonlibs/

@mzsanford
Copy link
Owner

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?

@mitjat
Copy link
Author

mitjat commented Feb 24, 2014

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 Mar 2, 2014
@mzsanford
Copy link
Owner

Merged it in

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants