Problem freezing Win32 services

Alexander Wilkens alexw at fast.no.nospam
Thu Feb 14 05:34:42 EST 2002


Hi,

I'm attempting to freeze a Windows NT service (in Win2000) written in Python
2.2 using win32all 142 and the freeze util bundled with Python in the tools
directory, and I've encountered some problems. Freezing console apps works
fine.

The following is the link error I get when using the '-s service' option to
freeze:

frozen.obj : error LNK2001: unresolved external symbol _PythonService_main
NodeControllerWin32Service.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"E:\Apps\Microsoft Visual
Studio\VC98\bin\link.exe"' : return code '0x460'
Stop.

I've tried freezing it without the '-s service' option set in which case I
get an executable that runs, but doesn't work as a service. I can do
'myservice.exe install' on it which seems to work, but if I then do
'myservice.exe debug' I get an importerror on 'myservice'...

Returning to the '-s service' option; During freeze I get a lot of errors
about DSP files not found. I found that these could be ignored when freezing
console apps as I just use the corresponding DLLs instead. When freezing the
service I get an additional error:

e:\apps\python\tools\freeze\%PYTHONEX%\win32\cvs\PythonService EXE.dsp:
[Errno 2] No such file or directory: 'e:\\apps\\
python\\tools\\freeze\\%PYTHONEX%\\win32\\cvs\\PythonService EXE.dsp'
No definition of module servicemanager in any specified map file.

If I fix this by setting the correct path to the DSP file I get:

LINK : fatal error LNK1104: cannot open file "pywintypes.lib"
NMAKE : fatal error U1077: '"E:\Apps\Microsoft Visual
Studio\VC98\bin\link.exe"' : return code '0x450'
Stop.

I now compile pywintypes using the it's DSP and correct the path to the
pywintypes DSP file as well. I now end up with the following mix of errors
and warnings:

PyACL.cpp
e:\Apps\Python\win32\src\PyACL.cpp(13) : warning C4273: 'PyWinMethod_NewACL'
: inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(22) : warning C4273: 'PyWinObject_AsACL'
: inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(39) : warning C4273: 'Initialize' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(51) : warning C4273:
'AddAccessAllowedAce' : inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(70) : warning C4273: 'AddAccessDeniedAce'
: inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(89) : warning C4273: 'GetAclSize' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(102) : warning C4273: 'GetAceCount' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(116) : warning C4273: 'GetAce' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(149) : error C2491: 'PyACLType' :
definition of dllimport data not allowed
e:\Apps\Python\win32\src\PyACL.cpp(172) : warning C4273: 'PyACL::PyACL' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(183) : warning C4273: 'PyACL::PyACL' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(192) : warning C4273: 'PyACL::~PyACL' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(197) : warning C4273: 'getattr' :
inconsistent dll linkage.  dllexport assumed.
e:\Apps\Python\win32\src\PyACL.cpp(202) : warning C4273: 'deallocFunc' :
inconsistent dll linkage.  dllexport assumed.
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

What now? :) Am I on the right track at all here? If anyone could shed some
light on this I would really appreciate it. Thanks!

--
Alex






More information about the Python-list mailing list