On Tue, Feb 19, 2013 at 6:12 AM, JonY <[email protected]> wrote:
> On 2/18/2013 22:56, Xiaofan Chen wrote:
>> Ref:
>> http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00137.html
>>
>> I am trying to build the 64bit Python (2.7.3 and 3.3) bindings for
>> libftdi1-1.0 ( http://www.intra2net.com/en/developer/libftdi/download.php )
>> with MinGW-w64 (Ruben personal build 4.7.2 release).
>> But somehow it does not work.
>>
>> I am trying using the instructions here.
>> http://stackoverflow.com/questions/11182765/how-can-i-build-my-c-extensions-with-mingw-w64-in-python
>>
>> For 64bit Python 2.7.3, I did the following.
>> 1) gendef.exe python27.dll
>> 2) dlltool.exe --dllname python27.dll --def python27.def --output-lib
>> libpython27.a
>> 3) Copy libpython27.a to C:\Python27\libs
>>
>> Strangely, gendef has already used Py_InitModule4_64 but I need
>> to rename it back to Py_InitModule4 to get the Python binding build
>> successfully.
>>
>> But the resultant Python bindings do not work. Just FYI,
>> 32bit Python binding works very well but I do not need
>> to use gendef and dlltool there since the default 32bit
>> Python windows binaries already provide the import
>> library libpython27.a.
>
> That is because your def don't match the DLL, you just
> messed with it.
The problem is that if I do not change the def file, I will
have the following compile error.
make[2]: Entering directory `/c/work/libftdi/libftdi/build64'
Linking C shared module _ftdi1.pyd
cd /C/work/libftdi/libftdi/build64/bindings && "/c/Program Files (x86)/CMake 2.8
/bin/cmake.exe" -E remove -f CMakeFiles/_ftdi1.dir/objects.a
cd /C/work/libftdi/libftdi/build64/bindings && /c/mingw64_rubenvb/bin/ar.exe cr
CMakeFiles/_ftdi1.dir/objects.a @CMakeFiles/_ftdi1.dir/objects1.rsp
cd /C/work/libftdi/libftdi/build64/bindings && /c/mingw64_rubenvb/bin/gcc.exe
-shared -o _ftdi1.pyd -Wl,--major-image-version,0,--minor-image-version,0 -Wl,
--whole-archive CMakeFiles/_ftdi1.dir/objects.a -Wl,--no-whole-archive -L/C/wor
k/libftdi/libftdi/build64/bindings/../src ../src/libftdi1.dll.a /C/Python27/libs
/libpython27.a /C/work/libusbx/libusbx-1.0.14-win/MinGW64/dll/libusb-1.0.dll.a -
lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomd
lg32 -ladvapi32
CMakeFiles/_ftdi1.dir/objects.a(ftdi1PYTHON_wrap.c.obj): In function `init_ftdi1
':
c:/work/libftdi/libftdi/build64/bindings/ftdi1PYTHON_wrap.c:11561: undefined ref
erence to `__imp_Py_InitModule4'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [bindings/_ftdi1.pyd] Error 1
>> c:\work\libftdi\libftdi1-1.0\examples\python>python
>> Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on
>> win
>> 32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import ftdi1 as ftdi
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "C:\python27\lib\site-packages\ftdi1.py", line 30, in <module>
>> _ftdi1 = swig_import_helper()
>> File "C:\python27\lib\site-packages\ftdi1.py", line 26, in
>> swig_import_helper
>> _mod = imp.load_module('_ftdi1', fp, pathname, description)
>> ImportError: DLL load failed: The specified procedure could not be found.
>>
>
> Use dependency walker to find out if you really have a _ftdi1 export.
Seems to be fine.
--
Xiaofan
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public