Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21554

Re: PyCrypto builds neither with MSVC nor MinGW

References (4 earlier) <CANerV6mip=4q5ZJFu00g7wvSAV4cBk6soDTc+x=bHKfVWt+4ZQ@mail.gmail.com> <CAO+9iGfmMmLyRH-CXcToz0KuT_AAAiko=N0XNPPnxpfpTuXKrg@mail.gmail.com> <CANerV6kNxt1eM1pj=fAp_161q363iOxRQ7Wo_3pPTXumjqXRsw@mail.gmail.com> <mailman.595.1331584711.3037.python-list@python.org> <13993807.3661.1331611178050.JavaMail.geo-discussion-forums@pbcgf10>
Date 2012-03-13 15:57 +1100
Subject Re: PyCrypto builds neither with MSVC nor MinGW
From Alec Taylor <alec.taylor6@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.603.1331614675.3037.python-list@python.org> (permalink)

Show all headers | View raw


Hmm, I just tried that method, but the output I got was still:

C:\workingdir\pycrypto>python setup.py install
running install
running build
running build_py
running build_ext
building 'Crypto.Random.OSRNG.winrandom' extension
Traceback (most recent call last):
  File "setup.py", line 452, in <module>
    core.setup(**kw)
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\distutils\command\install.py", line 563, in run
    self.run_command('build')
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 249, in run
    build_ext.run(self)
  File "C:\Python27\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "setup.py", line 146, in build_extensions
    build_ext.build_extensions(self)
  File "C:\Python27\lib\distutils\command\build_ext.py", line 448, in
build_extensions
    self.build_extension(ext)
  File "C:\Python27\lib\distutils\command\build_ext.py", line 498, in
build_extension
    depends=ext.depends)
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
    self.initialize()
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in
query_vcvarsall
    raise ValueError(str(list(result.keys())))
ValueError: [u'path']

--------------
and when I manually run vcvarsall (which is in PATH), I get the
aforementioned linker errors:
--------------

C:\workingdir\pycrypto>python setup.py install
running install
running build
running build_py
running build_ext
building 'Crypto.Random.OSRNG.winrandom' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c
/nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc/ -Isrc/inc-msvc/
-IC:\Python27\include -IC:\Python27 \PC /Tcsrc/winrand.c
/Fobuild\temp.win-amd64-2.7\Release\src/winrand.obj winrand.c
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe
/DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs
/LIBPATH:C:\Python27\PCbuild\amd64 ws2 _32.lib advapi32.lib
/EXPORT:initwinrandom build\temp.win-amd64-2.7\Release\src/
winrand.obj /OUT:build\lib.win-amd64-2.7\Crypto\Random\OSRNG\winrandom.pyd /IMPL
IB:build\temp.win-amd64-2.7\Release\src\winrandom.lib
/MANIFESTFILE:build\temp.win-amd64-2.7\Release\src\winrandom.pyd.manifest
   Creating library build\temp.win-amd64-2.7\Release\src\winrandom.lib
and object build\temp.win-amd64-2.7\Release\src\winrandom.exp
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyObject_Free referenced in function _WRdealloc
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyExc_SystemError referenced in function _WRdealloc
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyErr_Format referenced in function _WRdealloc
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyExc_TypeError referenced in function _WRdealloc
winrand.obj : error LNK2019: unresolved external symbol
__imp___PyObject_New referenced in function _winrandom_new
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyArg_ParseTupleAndKeywords referenced in function
_winrandom_new
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyString_FromStringAndSize referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyMem_Free referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyErr_NoMemory referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyMem_Malloc referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyErr_SetString referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyExc_ValueError referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyArg_ParseTuple referenced in function _WR_get_bytes
winrand.obj : error LNK2019: unresolved external symbol
__imp__Py_FindMethod referenced in function _WRgetattr
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyInt_FromLong referenced in function _WRgetattr
winrand.obj : error LNK2019: unresolved external symbol
__imp__Py_FatalError referenced in function _initwinrandom
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyErr_Occurred referenced in function _initwinrandom
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyModule_AddStringConstant referenced in function
_initwinrandom
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyModule_AddIntConstant referenced in function _initwinrandom
winrand.obj : error LNK2019: unresolved external symbol
__imp__Py_InitModule4 referenced in function _initwinrandom
winrand.obj : error LNK2019: unresolved external symbol
__imp__PyType_Type referenced in function _initwinrandom
build\lib.win-amd64-2.7\Crypto\Random\OSRNG\winrandom.pyd : fatal error LNK1120:
 21 unresolved externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\BIN\link.exe"' failed with exit status 1120

On Tue, Mar 13, 2012 at 2:59 PM,  <casevh@gmail.com> wrote:
> On Monday, March 12, 2012 1:38:29 PM UTC-7, Alec Taylor wrote:
>> On a brand new Windows install now, with a brand new VS8 installed
>> with new YASM and MPIR in c:\usr\src\include and c:\usr\src\lib.
>>
>> But it still isn't working:
>>
> This was a little challenging. I looked through the setup.py to figure out what assumptions their build process made. First, the file pycrypto-2.5\src\inc-msvc\config.h must be modified. Below is the file I used:
>
> config.h
> ===================================================================
> /* Define to 1 if you have the declaration of `mpz_powm', and to 0 if you
>   don't. */
> #define HAVE_DECL_MPZ_POWM 1
>
> /* Define to 1 if you have the declaration of `mpz_powm_sec', and to 0 if you
>   don't. */
> #define HAVE_DECL_MPZ_POWM_SEC 0
>
> /* Define to 1 if you have the `gmp' library (-lgmp). */
> #undef HAVE_LIBGMP
>
> /* Define to 1 if you have the `mpir' library (-lmpir). */
> #define HAVE_LIBMPIR 1
>
> /* Define to 1 if you have the <stdint.h> header file. */
> #define HAVE_STDINT_H 1
> ===================================================================
>
> Although I was able to specify an include directory for mpir.h with -Ic:\usr\include, I was not able specify a lib directory with -Lc:\usr\lib. It looks like setup.py does not honor the -L option. So I finally gave up and just copied the mpir.h file into my Python27\include directory and the mpir.lib file into my Python27\libs directory.
>
> After copying the files "python setup.py install" was successful. I created a binary installer with "python setup.py bdist-wininst".
>
> There may be a cleaner way to build PyCrypto, but these steps worked for me.
>
> casevh
> --
> http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-02-06 01:40 +1100
  Re: PyCrypto builds neither with MSVC nor MinGW casevh <casevh@gmail.com> - 2012-02-06 15:27 -0800
    Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-02-08 16:37 +1100
    Re: PyCrypto builds neither with MSVC nor MinGW Case Van Horsen <casevh@gmail.com> - 2012-02-08 02:48 -0800
    Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-02-08 23:24 +1100
    Re: PyCrypto builds neither with MSVC nor MinGW Case Van Horsen <casevh@gmail.com> - 2012-02-08 04:31 -0800
    Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-03-13 07:38 +1100
      Re: PyCrypto builds neither with MSVC nor MinGW casevh@gmail.com - 2012-03-12 20:59 -0700
        Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-03-13 15:57 +1100
        Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-03-13 17:09 +1100
        Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-03-14 20:47 +1100
        Re: PyCrypto builds neither with MSVC nor MinGW bikewave <pmfenton33@gmail.com> - 2012-08-22 11:21 -0700
        Re: PyCrypto builds neither with MSVC nor MinGW Dave Angel <d@davea.name> - 2012-08-22 14:39 -0400
      Re: PyCrypto builds neither with MSVC nor MinGW casevh@gmail.com - 2012-03-12 20:59 -0700
    Re: PyCrypto builds neither with MSVC nor MinGW Alec Taylor <alec.taylor6@gmail.com> - 2012-03-13 08:21 +1100

csiph-web