Archived

This forum has been archived. Please start a new discussion on GitHub.

building python extensions

I am using Ice 3.6 on Windows. I have built Ice for C++ from source and now I am attempting to build the python extension (IcePy) with the intention of using a python client.

I am getting the following unresolved externals which appears to a problem with building IceSSL sliced files. The python Makefile.mak forces me to use CPP_COMPILER=vc100 but the Ice for C++ is built using vc110 (Visual Studio 2012). Is this causing the problem? If so, how do I build the python extension with VS 2012 to be compatible with everything else.

C:\Ice-3.6.0\python>nmake /f Makefile.mak

Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.

"making all in modules"
"making all in IcePy"
link.exe /LIBPATH:"C:\Python27\libs" /LIBPATH:"..\..\..\cpp\lib" /nolog
o /OPT:REF /pdb:none /dll .\BatchRequestInterceptor.obj .\Communicator.obj .\
Connection.obj .\ConnectionInfo.obj .\Current.obj .\Endpoint.obj .\EndpointI
nfo.obj .\ImplicitContext.obj .\Init.obj .\Logger.obj .\ObjectAdapter.obj .
\ObjectFactory.obj .\Operation.obj .\Properties.obj .\PropertiesAdmin.obj .\
Proxy.obj .\Slice.obj .\Thread.obj .\Types.obj .\Util.obj /out:..\..\python
\IcePy.pyd IcePy.res
Creating library ..\..\python\IcePy.lib and object ..\..\python\IcePy.exp
ConnectionInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) class Ice::LocalObject * __cdecl IceSSL::upCast(class IceSSL::ConnectionIn
fo *)" (__imp_?upCast@IceSSL@@YAPEAVLocalObject@Ice@@PEAVConnectionInfo@1@@Z) re
ferenced in function sslConnectionInfoGetCipher
ConnectionInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) class Ice::LocalObject * __cdecl IceSSL::upCast(class IceSSL::WSSConnectio
nInfo *)" (__imp_?upCast@IceSSL@@YAPEAVLocalObject@Ice@@PEAVWSSConnectionInfo@1@
@Z) referenced in function wssConnectionInfoGetHeaders
ConnectionInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) public: __cdecl IceSSL::ConnectionInfo::ConnectionInfo(void)" (__imp_??0Co
nnectionInfo@IceSSL@@QEAA@XZ) referenced in function "public: __cdecl IceSSL::Co
nnectionInfo__staticInit::ConnectionInfo__staticInit(void)" (??0ConnectionInfo__
staticInit@IceSSL@@QEAA@XZ)
ConnectionInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllim
port) protected: void __cdecl IceSSL::ConnectionInfo::`vbase destructor'(void)"
(__imp_??_DConnectionInfo@IceSSL@@IEAAXXZ) referenced in function "public: __cde
cl IceSSL::ConnectionInfo__staticInit::~ConnectionInfo__staticInit(void)" (??1Co
nnectionInfo__staticInit@IceSSL@@QEAA@XZ)
EndpointInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllimpo
rt) class Ice::LocalObject * __cdecl IceSSL::upCast(class IceSSL::EndpointInfo *
)" (__imp_?upCast@IceSSL@@YAPEAVLocalObject@Ice@@PEAVEndpointInfo@1@@Z) referenc
ed in function "public: static class IceInternal::Handle<class IceSSL::EndpointI
nfo> __cdecl IceInternal::Handle<class IceSSL::EndpointInfo>::dynamicCast<class
Ice::EndpointInfo>(class IceUtil::HandleBase<class Ice::EndpointInfo> const &)"
@IceInternal@
@Z)
EndpointInfo.obj : error LNK2019: unresolved external symbol "__declspec(dllimpo
rt) class Ice::LocalObject * __cdecl IceSSL::upCast(class IceSSL::WSSEndpointInf
o *)" (__imp_?upCast@IceSSL@@YAPEAVLocalObject@Ice@@PEAVWSSEndpointInfo@1@@Z) re
ferenced in function wssEndpointInfoGetResource
..\..\python\IcePy.pyd : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\amd64\link.exe"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: 'for' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'for' : return code '0x1'
Stop.

Comments

  • bernard
    bernard Jupiter, FL
    Hi Dennis,

    Python is itself built with Visual Studio: Visual Studio 2010 for Python 3.3 and 3.4, and Visual Studio 2015 for Python 3.5. See https://docs.python.org/devguide/setup.html#windows.

    We use the same version of Visual Studio to build the Ice for Python extension, and we recommend you do the same.

    Which version of Python are you using?

    Best regards,
    Bernard
  • I need to build it with VS 2012 then. Why can't it be built with VS 20212 using CPP_COMPILER=VC110? Otherwise, I am not going to be able to use it. I'm currently using Python 2.7, is that the problem? It builds everything, it just has a problem with the link step.
  • benoit
    benoit Rennes, France
    Hi,

    We recommend using the same compiler as the compiler used to build Python to prevent mixing C runtime libraries. For Python 2.7, you're supposed to be using Visual Studio 2008 or the special compiler release made freely available by Microsoft for Python 2.7. It's available at this link: https://www.microsoft.com/en-us/down....aspx?id=44266

    However, Ice 3.6 no longer supports building the python extension from source with this Visual Studio version so I'm afraid it won't work.

    Why do you need to build the extension with VS2012? Can't you just use the Ice 3.6.1 Python 2.7 wheel available on PyPI (https://pypi.python.org/pypi/zeroc-ice/3.6.1)?

    Cheers,
    Benoit.
  • benoit
    benoit Rennes, France
    Btw, the linker error you posted is most likely caused by a bug in 3.6.0 which has been fixed with Ice 3.6.1.

    Cheers,
    Benoit.
  • Great thanks. I'll need to migrate to 3.6.1.