Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#104 setup.py needs secur32.lib for win32

open
nobody
None
5
2009-01-14
2009-01-14
Robert Brewer
No

I compiled a new libpq from postgresql-8.3.5 today on Vista, and then received the following error while trying to build pyPgSQL against it:

C:\download\Python\pyPgSQL-2.5.1>python setup.py build
...
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\download\Postgres\postgresql-8.3.5\src\interfaces\libpq\Release /LIBPATH:C:\Python26\libs /LIBPATH
:C:\Python26\PCbuild libpq.lib wsock32.lib advapi32.lib shell32.lib /EXPORT:initlibpq build\temp.win32-2.6\Release\libpqmodule.obj build\temp.win32-2.6\Release\pgboolean.obj build\temp.win32-2.6\Release\pgint2object.obj build\temp.win32-2.6\Release\pgint8object.obj build\temp.win32-2.6\Release\pgversion.obj build\temp.win32-2.6\Release\pglargeobject.obj build\temp.win32-2.6\Release\pgnotify.obj build\temp.win32-2.6\Release\pgconnection.obj build\temp.win32-2.6\Release\pgresult.obj build\temp.win32-2.6\Release\pymemstrdup.obj build\temp.win32-2.6\Release\port/strtoll.obj build\temp.win32-2.6\Release\port/strtoull.obj build\temp.win32-2.6\Release\port/strtok.obj /OUT:build\lib.win32-2.6\pyPgSQL\libpq\libpq.pyd /IMPLIB:build\temp.win32-2.6\Release\libpq.lib /MANIFESTFILE:build\temp.win32-2.6\ Release\libpq.pyd.manifest
Creating library build\temp.win32-2.6\Release\libpq.lib and object build\temp.win32-2.6\Release\libpq.exp
libpq.lib(fe-connect.obj) : error LNK2019: unresolved external symbol __imp__DeleteSecurityContext@4 referenced in function _closePGconn
libpq.lib(fe-connect.obj) : error LNK2019: unresolved external symbol __imp__FreeCredentialsHandle@4 referenced in function _closePGconn
libpq.lib(fe-auth.obj) : error LNK2019: unresolved external symbol _FreeContextBuffer@4 referenced in function _pg_SSPI_continue
libpq.lib(fe-auth.obj) : error LNK2019: unresolved external symbol _InitializeSecurityContextA@48 referenced in function _pg_SSPI_continue
libpq.lib(fe-auth.obj) : error LNK2019: unresolved external symbol _AcquireCredentialsHandleA@36 referenced in function _pg_SSPI_startup
build\lib.win32-2.6\pyPgSQL\libpq\libpq.pyd : fatal error LNK1120: 5 unresolved externals
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120

This occurs because 'secur32.lib' is not present. The fix is simple: add 'secur32' to setup.py:

elif sys.platform == "win32":
## library_dirs[0] = library_dirs[0] + "/ms"
optional_libs = ["libpq", "wsock32", "advapi32", "shell32", "secur32"]
modname="pyPgSQL.libpq.libpq"

Discussion