chtd / psycopg2cffi

Port to cffi with some speed improvements
Other
177 stars 43 forks source link

not installing on win32 (pypy400) #54

Open mentat51 opened 8 years ago

mentat51 commented 8 years ago

Hello.

First, I need to change the _build_libpq.py like that (adding the last 2 lines): def find_libpq(self): path = self.query('libdir') fname = None if os.name == 'posix': if sys.platform == 'darwin': fname = os.path.join(path, 'libpq.dylib') if sys.platform in ['linux', 'linux2', 'linux3']: fname = os.path.join(path, 'libpq.so') if sys.platform.startswith('freebsd'): fname = os.path.join(path, 'libpq.so') elif sys.platform == 'win32': fname = os.path.join(path, 'libpq.dll')

But, after that, I have an error:

Found libpq at: -> c:/PROGRA~1/POSTGR~1/9.4/lib\libpq.dll

running install Checking .pth file support in c:\usr\pypy400\site-packages\ c:\usr\pypy400\pypy.exe -E -c pass TEST PASSED: c:\usr\pypy400\site-packages\ appears to support .pth files running bdist_egg running egg_info writing psycopg2cffi.egg-info\PKG-INFO writing dependency_links to psycopg2cffi.egg-info\dependency_links.txt writing requirements to psycopg2cffi.egg-info\requires.txt writing top-level names to psycopg2cffi.egg-info\top_level.txt reading manifest file 'psycopg2cffi.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'psycopg2cffi.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib running build_py copying psycopg2cffi_impl_buildlibpq.py -> build\lib.win32-2.7\psycopg2cffi impl running build_ext generating cffi module 'build\temp.win32-2.7\Release\psycopg2cffi._impl._libp q.c' already up-to-date building 'psycopg2cffi._impl._libpq' extension C:\Users\USER\AppData\Local\Programs\Common\Microsoft\Visual C ++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:/PROGRA ~1/POSTGR~1/9.4/include -Ic:\usr\pypy400\include /Tcbuild\temp.win32-2.7\Release \psycopg2cffi._impl._libpq.c /Fobuild\temp.win32-2.7\Release\build\temp.win32-2. 7\Release\psycopg2cffi._impl._libpq.obj psycopg2cffi._impl._libpq.c build\temp.win32-2.7\Release\psycopg2cffi._impl._libpq.c(400) : fatal error C108 3: Cannot open include file: 'stdint.h': No such file or directory error: command 'C:\Users\USER\AppData\Local\Programs\Com mon\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit st atus 2

I have no idea for fixing it. Best regards

thedrow commented 8 years ago

It looks like something in your environment variables is set up wrong or the compiler version you're using. stdint.h is a C99 standard header. Check that the compiler you are using is C99 compliant and that all environment variables are set up correctly.

lopuhin commented 8 years ago

Also, maybe #23 will help here once it's done

mentat51 commented 8 years ago

@thedrow: no the installation is correct. The problem is that ms vc 2008 don't include a stdint.h (yes !). I have to download it from : http://msinttypes.googlecode.com/svn/trunk/stdint.h and put it in VC/include

so now, I have another error LINK : fatal error LNK1181: cannot open input file 'pq.lib' error: command 'C:\Users\USER\AppData\Local\Programs\Common\Microsoft\V isual C++ for Python\9.0\VC\Bin\link.exe' failed with exit status 1181

So next step...

@lopuhin : yes if I can help when I have finish

mentat51 commented 8 years ago

I've found a libpq.lib in postgresql lib directory. But If I run the link line with libpq.lib, I got this log: Creating library build\temp.win32-2.7\Release\build\temp.win32-2.7\Release_libpq.pypy-26.lib and object build\temp.win32-2.7\Release\build\temp.win32-2.7\Release_libpq.pypy-26.exp psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetvalue referenced in function _PQEgetlong psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQbackendPID referenced in function cffi_d_PQbackendPID psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQcancel referenced in function __cffi_d_PQcancel psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQclear referenced in function cffi_d_PQclear psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQcmdStatus referenced in function cffi_d_PQcmdStatus psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQcmdTuples referenced in function __cffi_d_PQcmdTuples psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQconnectPoll referenced in function cffi_d_PQconnectPoll psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQconnectStart referenced in function cffi_d_PQconnectStart psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQconnectdb referenced in function __cffi_d_PQconnectdb psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQconsumeInput referenced in function cffi_d_PQconsumeInput psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQerrorMessage referenced in function cffi_d_PQerrorMessage psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQescapeBytea referenced in function __cffi_d_PQescapeBytea psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQescapeByteaConn referenced in function cffi_d_PQescapeByteaConn psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQescapeLiteral referenced in function cffi_d_PQescapeLiteral psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQescapeString referenced in function __cffi_d_PQescapeString psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQescapeStringConn referenced in function cffi_d_PQescapeStringConn psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQexec referenced in function cffi_d_PQexec psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfinish referenced in function __cffi_d_PQfinish psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQflush referenced in function cffi_d_PQflush psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfmod referenced in function cffi_d_PQfmod psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfname referenced in function __cffi_d_PQfname psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfreeCancel referenced in function cffi_d_PQfreeCancel psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfreemem referenced in function cffi_d_PQfreemem psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQfsize referenced in function __cffi_d_PQfsize psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQftype referenced in function cffi_d_PQftype psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetCancel referenced in function cffi_d_PQgetCancel psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetCopyData referenced in function __cffi_d_PQgetCopyData psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetResult referenced in function cffi_d_PQgetResult psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetisnull referenced in function cffi_d_PQgetisnull psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQgetlength referenced in function __cffi_d_PQgetlength psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQisBusy referenced in function cffi_d_PQisBusy psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQnfields referenced in function cffi_d_PQnfields psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQnotifies referenced in function __cffi_d_PQnotifies psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQntuples referenced in function cffi_d_PQntuples psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQoidValue referenced in function cffi_d_PQoidValue psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQparameterStatus referenced in function __cffi_d_PQparameterStatus psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQprotocolVersion referenced in function cffi_d_PQprotocolVersion psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQputCopyData referenced in function cffi_d_PQputCopyData psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQputCopyEnd referenced in function __cffi_d_PQputCopyEnd psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQrequestCancel referenced in function cffi_d_PQrequestCancel psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQresultErrorField referenced in function cffi_d_PQresultErrorField psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQresultErrorMessage referenced in function __cffi_d_PQresultErrorMessage psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQresultStatus referenced in function cffi_d_PQresultStatus psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQsendQuery referenced in function cffi_d_PQsendQuery psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQserverVersion referenced in function __cffi_d_PQserverVersion psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQsetNoticeProcessor referenced in function cffi_d_PQsetNoticeProcessor psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQsetnonblocking referenced in function cffi_d_PQsetnonblocking psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQsocket referenced in function __cffi_d_PQsocket psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQstatus referenced in function cffi_d_PQstatus psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQtransactionStatus referenced in function cffi_d_PQtransactionStatus psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _PQunescapeBytea referenced in function cffi_d_PQunescapeBytea psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_close referenced in function cffi_d_lo_close psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_create referenced in function cffi_d_lo_create psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_export referenced in function cffi_d_lo_export psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_import referenced in function __cffi_d_lo_import psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_lseek referenced in function cffi_d_lo_lseek psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_open referenced in function cffi_d_lo_open psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_read referenced in function __cffi_d_lo_read psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_tell referenced in function cffi_d_lo_tell psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_truncate referenced in function cffi_d_lo_truncate psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_unlink referenced in function __cffi_d_lo_unlink psycopg2cffi._impl._libpq.obj : error LNK2019: unresolved external symbol _lo_write referenced in function cffi_d_lo_write build\lib.win32-2.7\psycopg2cffi_impl_libpq.pypy-26.pyd : fatal error LNK1120: 62 unresolved externals

mentat51 commented 8 years ago

ok, I can compile now. with pypy400 32 bits, compiling with VC2008 32 bits and postgresql 64 bits, it doesn't work. If I install postgresql 32 bits, it's ok. So I have an egg (psycopg2cffi-2.7.2-py2.7-win32.egg) for testing...

mentat51 commented 8 years ago

But I can't build a wheel :

pypy setup.py bdist_wheel

Found libpq at: -> c:/usr/POSTGR~1/9.4/lib\libpq.dll

Found libpq at: -> c:/usr/POSTGR~1/9.4/lib\libpq.dll

running bdist_wheel running build running build_py running build_ext generating cffi module 'build\temp.win32-2.7\Release\psycopg2cffi._impl._libp q.c' already up-to-date installing to build\bdist.win32\wheel running install running install_lib running install_egg_info running egg_info writing psycopg2cffi.egg-info\PKG-INFO writing dependency_links to psycopg2cffi.egg-info\dependency_links.txt writing requirements to psycopg2cffi.egg-info\requires.txt writing top-level names to psycopg2cffi.egg-info\top_level.txt reading manifest file 'psycopg2cffi.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'psycopg2cffi.egg-info\SOURCES.txt' removing 'build\bdist.win32\wheel\psycopg2cffi-2.7.2.data..\psycopg2cffi-2.7.2- py2.7.egg-info' (and everything under it) Copying psycopg2cffi.egg-info to build\bdist.win32\wheel\psycopg2cffi-2.7.2.data ..\psycopg2cffi-2.7.2-py2.7.egg-info running install_scripts error: [Error 32] Le processus ne peut pas accÚder au fichier car ce fichier est utilisÚ par un autre processus: build\bdist.win32\wheel\psycopg2cffi-2.7.2.dist -info\dependency_links.txt

Even after restarted my PC. I can run : pypy setup.py install_scripts but after that ? If I rerun the bdist_wheel, same error

mentat51 commented 8 years ago

Ok, so it seems to be a bug in wheel : https://bitbucket.org/pypa/wheel/issues/150/error-32-when-deleting-empty It fix my problem, but I have similar error with requires.txt (error 32 too)