huberf / pybluez

Automatically exported from code.google.com/p/pybluez
0 stars 0 forks source link

Fails to link _msbt.exp on Windows 64-bit - unresolved external symbols #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. easy_install 
http://code.google.com/p/pybluez/downloads/detail?name=PyBluez-0.18.tar.gz
2.
3.

What is the expected output? What do you see instead?

It should build normally and install. Instead I see

PS C:\> easy_install http://pybluez.googlecode.com/files/PyBluez-0.18.tar.gz
install_dir C:\Python\Lib\site-packages\
Downloading http://pybluez.googlecode.com/files/PyBluez-0.18.tar.gz
Processing PyBluez-0.18.tar.gz
Running PyBluez-0.18\setup.py -q bdist_egg --dist-dir 
c:\users\jaraco\appdata\local\temp\easy_install-bvccpo\PyBluez-0.18\egg-dist-tmp
-4z9hiy
_msbt.c
msbt\_msbt.c(45) : warning C4996: 'sprintf': This function or variable may be 
unsafe. Consider using sprintf_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h(366) : see declaration of 'sprintf'
msbt\_msbt.c(104) : warning C4996: 'strncpy': This function or variable may be 
unsafe. Consider using strncpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
msbt\_msbt.c(108) : warning C4996: 'strncpy': This function or variable may be 
unsafe. Consider using strncpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
msbt\_msbt.c(112) : warning C4996: 'strncpy': This function or variable may be 
unsafe. Consider using strncpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
msbt\_msbt.c(116) : warning C4996: 'strncpy': This function or variable may be 
unsafe. Consider using strncpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
msbt\_msbt.c(117) : warning C4996: 'strncpy': This function or variable may be 
unsafe. Consider using strncpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(157) : see declaration of 'strncpy'
msbt\_msbt.c(139) : warning C4244: '=' : conversion from 'SOCKET' to 'int', 
possible loss of data
msbt\_msbt.c(218) : warning C4244: '=' : conversion from 'SOCKET' to 'int', 
possible loss of data
msbt\_msbt.c(381) : warning C4244: '=' : conversion from 'SOCKET' to 'int', 
possible loss of data
msbt\_msbt.c(586) : warning C4244: 'initializing' : conversion from 'SOCKET' to
'int', possible loss of data
msbt\_msbt.c(597) : warning C4996: 'close': The POSIX name for this item is 
deprecated. Instead, use the ISO C++ conformant name: _close. See online help 
for details.
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\io.h(306)
: see declaration of 'close'
msbt\_msbt.c(602) : warning C4996: 'strcpy': This function or variable may be 
unsafe. Consider using strcpy_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
_msbt.obj : warning LNK4197: export 'init_msbt' specified multiple times; using
first specification
   Creating library build\temp.win-amd64-2.6\Release\msbt\_msbt.lib and object build\temp.win-amd64-2.6\Release\msbt\_msbt.exp
_msbt.obj : error LNK2019: unresolved external symbol __imp_LocalFree 
referenced in function Err_SetFromWSALastError
_msbt.obj : error LNK2019: unresolved external symbol __imp_FormatMessageA 
referenced in function Err_SetFromWSALastError
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSAGetLastError 
referenced in function Err_SetFromWSALastError
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSAStartup 
referenced in function msbt_initwinsock
_msbt.obj : error LNK2019: unresolved external symbol __imp_socket referenced 
in function msbt_socket
_msbt.obj : error LNK2019: unresolved external symbol __imp_bind referenced in 
function msbt_bind
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSAStringToAddressA
referenced in function msbt_bind
_msbt.obj : error LNK2019: unresolved external symbol __imp_listen referenced 
in function msbt_listen
_msbt.obj : error LNK2019: unresolved external symbol __imp_accept referenced 
in function msbt_accept
_msbt.obj : error LNK2019: unresolved external symbol __imp_connect referenced 
in function msbt_connect
_msbt.obj : error LNK2019: unresolved external symbol __imp_send referenced in 
function msbt_send
_msbt.obj : error LNK2019: unresolved external symbol __imp_recv referenced in 
function msbt_recv
_msbt.obj : error LNK2019: unresolved external symbol __imp_closesocket 
referenced in function msbt_close
_msbt.obj : error LNK2019: unresolved external symbol __imp_getsockname 
referenced in function msbt_getsockname
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSASocketA 
referenced in function msbt_dup
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSADuplicateSocketA
referenced in function msbt_dup
_msbt.obj : error LNK2019: unresolved external symbol __imp_GetCurrentProcessId
referenced in function msbt_dup
MSVCRT.lib(gs_support.obj) : error LNK2001: unresolved external symbol 
__imp_GetCurrentProcessId
_msbt.obj : error LNK2019: unresolved external symbol 
__imp_WSALookupServiceNextA referenced in function msbt_discover_devices
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSALookupServiceEnd
referenced in function msbt_discover_devices
_msbt.obj : error LNK2019: unresolved external symbol 
__imp_WSALookupServiceBeginA referenced in function msbt_discover_devices
_msbt.obj : error LNK2019: unresolved external symbol BluetoothFindRadioClose 
referenced in function msbt_lookup_name
_msbt.obj : error LNK2019: unresolved external symbol BluetoothGetDeviceInfo 
referenced in function msbt_lookup_name
_msbt.obj : error LNK2019: unresolved external symbol BluetoothFindFirstRadio 
referenced in function msbt_lookup_name
_msbt.obj : error LNK2019: unresolved external symbol __imp_WSASetServiceA 
referenced in function msbt_set_service_raw
_msbt.obj : error LNK2019: unresolved external symbol __imp_ioctlsocket 
referenced in function msbt_setblocking
_msbt.obj : error LNK2019: unresolved external symbol __imp_setsockopt 
referenced in function msbt_settimeout
_msbt.obj : error LNK2019: unresolved external symbol __imp_getsockopt 
referenced in function msbt_gettimeout
MSVCRT.lib(crtdll.obj) : error LNK2019: unresolved external symbol __imp_Sleep 
referenced in function _CRT_INIT
MSVCRT.lib(dllmain.obj) : error LNK2019: unresolved external symbol 
__imp_DisableThreadLibraryCalls referenced in function DllMain
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol 
__imp_QueryPerformanceCounter referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol 
__imp_GetTickCount referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol 
__imp_GetCurrentThreadId referenced in function __security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external symbol 
__imp_GetSystemTimeAsFileTime referenced in function __security_init_cookie
build\lib.win-amd64-2.6\bluetooth\_msbt.pyd : fatal error LNK1120: 33 
unresolved externals
error: Setup script exited with error: command '"c:\Program Files 
(x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe"' failed with exit 
status 1120

What version of the product are you using? On what operating system?

Windows 7 64-bit with Visual Studio 2008 Professional and Python 2.6.5 64-bit. 
I've built many other Python C-extension packages on this platform with success.

Please provide any additional information below.

Original issue reported on code.google.com by jaraco%jaraco.com@gtempaccount.com on 7 Jul 2010 at 6:21

GoogleCodeExporter commented 8 years ago
This patch seems to address the issue and now the library builds.

Original comment by jaraco%jaraco.com@gtempaccount.com on 7 Jul 2010 at 6:55

GoogleCodeExporter commented 8 years ago
PS C:\Users\jaraco\projects\public\pybluez> svn diff
Index: setup.py
===================================================================
--- setup.py    (revision 40)
+++ setup.py    (working copy)
@@ -3,6 +3,7 @@
 from distutils.core import setup, Extension
 from distutils.debug import DEBUG
 import sys
+import platform
 import os

 mods = []
@@ -18,10 +19,13 @@
             break
     if PSDK_PATH is None:
         raise SystemExit ("Can't find the Windows XP Platform SDK")
-
+
+    lib_path = os.path.join(PSDK_PATH, 'Lib')
+    if '64' in platform.architecture()[0]:
+        lib_path = os.path.join(lib_path, 'x64')
     mod1 = Extension ('bluetooth._msbt',
                         include_dirs = ["%s\\Include" % PSDK_PATH],
-                        library_dirs = ["%s\\Lib" % PSDK_PATH],
+                        library_dirs = [lib_path],
                         libraries = [ "WS2_32", "Irprops" ],
                         sources=['msbt\\_msbt.c'],)
     mods = [ mod1 ]

Original comment by jaraco%jaraco.com@gtempaccount.com on 7 Jul 2010 at 6:55

GoogleCodeExporter commented 8 years ago
Thanks for the patch.  You should have commit access now -- please commit it.

Original comment by ashu...@gmail.com on 7 Jul 2010 at 1:50

GoogleCodeExporter commented 8 years ago
Added to trunk r41.

Original comment by jaraco%jaraco.com@gtempaccount.com on 7 Jul 2010 at 2:32