libftdi Archives

Subject: Re: windows 7 Python modules

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sat, 25 Oct 2014 08:11:17 +0800
On Fri, Oct 24, 2014 at 11:54 PM, Joachim Schambach
<jschamba@xxxxxxxxxxxxxxxxxx> wrote:
> OK, thanks for all the responses.
> I tried around a little, but i think i am still missing something very
> fundamental in the MinGW setup or something like that.
> So let me try to be a little more specific:
>
> The module that works just fine under Linux is called ftdIOmodule.c, which
> in turn calls all kinds of functions from libftdi. I tried to modify the
> "setup.py" file to correspond to the appropriate Windows files, and came up
> with something like this:
>
> ---- setup.py -----
> from distutils.core import setup, Extension
>
> module1 = Extension('ftdIO',
>                     include_dirs =
> ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/include/libftdi1'],
>                     libraries = ['ftdi1'],
>                     library_dirs =
> ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/lib64'],
>                     define_macros=[('MS_WIN64', 1)],
>                     sources = ['ftdIOmodule.c'])
>
> setup (name = 'PackageName',
>         version = '1.1',
>         description = 'ftdIO functions for Python',
>         ext_modules = [module1])
> ---- end setup.py ---------

Sorry I do not know Python well enough to comment on
the above.

> I then tried to compile this with the command line:
>
> python setup_windows.py build -c mingw32
>

First thing first, are you using 64bit Python or 32bit Python? Are
you using MinGW.org 32bit toolchain or the MinGW-w64 toolchain?

If you use Python 2.7, try to stick to the 32bit version, I have
quite some problem to get Python 2.7 64bit to work to build
libftdi Python binding.

And then you need to use 32bit tool chain. If you use MinGW.org,
then you need to use libftdi1-1.1_devkit_mingw32_12Feb2014.zip
which was built using MinGW.org 32bit toolchain.

If you use MinGW-w64 (usually the one shipped in modern Linux),
then you need to use libftdi1-1.1_devkit_x86_x64_21Feb2014.zip.
Inside there is both 32bit and 64bit libraries. You'd better use
32bit Python 2.7 and the 32bit MinGW-w64 toolchain.

BTW, why do you need to build your own Python bindings?


-- 
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread