Quantcast

PyCrypto builds neither with MSVC nor MinGW

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
PIL, PyCrypto and many other modules require a C compiler and linker.

Unfortunately neither install on my computer, with a PATH with the following:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
C:\libraries\MinGW\msys\1.0\bin
C:\libraries\MinGW
C:\Python27\Scripts

Output from G:\pycrypto>vcvarsall.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

Error output from G:\pycrypto>python setup.py build --compiler msvc
http://pastebin.com/nBsuXDGg

Error output from G:\pycrypto>python setup.py build --compiler mingw32
1> log1 2> log2
Log1: http://pastebin.com/yG3cbdZv
Log2: http://pastebin.com/qvnshPeh

Will there ever be support for newer MSVC versions? - Also, why
doesn't even MinGW install PyCrypto for me?

Thanks for all suggestions,

Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Christian Heimes-2
Am 05.02.2012 15:40, schrieb Alec Taylor:
> PIL, PyCrypto and many other modules require a C compiler and linker.
>
> Unfortunately neither install on my computer, with a PATH with the following:
>
> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
> C:\libraries\MinGW\msys\1.0\bin
> C:\libraries\MinGW
> C:\Python27\Scripts

MSVC 10 is not supported, you need VC 9 (2008).

Christian

--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
A 4 year old compiler?

I also have MSVC11 installed. Can the python project add support for
that so that we aren't waiting 5 years between compiler support?

On Mon, Feb 6, 2012 at 2:23 AM, Christian Heimes <[hidden email]> wrote:

> Am 05.02.2012 15:40, schrieb Alec Taylor:
>> PIL, PyCrypto and many other modules require a C compiler and linker.
>>
>> Unfortunately neither install on my computer, with a PATH with the following:
>>
>> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
>> C:\libraries\MinGW\msys\1.0\bin
>> C:\libraries\MinGW
>> C:\Python27\Scripts
>
> MSVC 10 is not supported, you need VC 9 (2008).
>
> Christian
>
> --
> http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Steven D'Aprano-11
In reply to this post by Christian Heimes-2
On Mon, 06 Feb 2012 03:42:08 +1100, Alec Taylor wrote:

> A 4 year old compiler?

Compilers aren't like milk. They don't go off after a few weeks. A good
compiler/operating system combination should still be usable after 4 or
14 years. The compiler I'm using is six years old, and I expect that it
will continue to get patches and upgrades without breaking backwards
compatibility for the next six years.


> I also have MSVC11 installed. Can the python project add support for
> that so that we aren't waiting 5 years between compiler support?

Are you volunteering to provide that support? I'm sure it would be
appreciated.


P.S. Please don't top-post.


> On Mon, Feb 6, 2012 at 2:23 AM, Christian Heimes <[hidden email]>
> wrote:
>> Am 05.02.2012 15:40, schrieb Alec Taylor:
>>> PIL, PyCrypto and many other modules require a C compiler and linker.
>>>
>>> Unfortunately neither install on my computer, with a PATH with the
>>> following:
>>>
>>> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
>>> C:\libraries\MinGW\msys\1.0\bin
>>> C:\libraries\MinGW
>>> C:\Python27\Scripts
>>
>> MSVC 10 is not supported, you need VC 9 (2008).
>>
>> Christian


--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Terry Reedy
In reply to this post by Alec Taylor
On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote:
> On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor<[hidden email]>
> wrote:
>
>> A 4 year old compiler?
>>
>> I also have MSVC11 installed. Can the python project add support for
>> that so that we aren't waiting 5 years between compiler support?

3.3 will almost certainly be built with VS2010.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Chris Angelico
On Mon, Feb 6, 2012 at 12:26 PM, Terry Reedy <[hidden email]> wrote:

> On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote:
>>
>> On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor<[hidden email]>
>> wrote:
>>
>>> A 4 year old compiler?
>>>
>>> I also have MSVC11 installed. Can the python project add support for
>>> that so that we aren't waiting 5 years between compiler support?
>
>
> 3.3 will almost certainly be built with VS2010.

I suppose there's no chance of moving to a free compiler? For my
Windows work, I've generally used the Open Watcom compiler; that's not
to say it's the best, but it does the job, and it's free software.

But no, I'm not offering. Way way too many jobs that I already have
queued, sorry!

ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Terry Reedy
On 2/6/2012 1:53 AM, Chris Angelico wrote:

> On Mon, Feb 6, 2012 at 12:26 PM, Terry Reedy<[hidden email]>  wrote:
>> On 2/5/2012 6:23 PM, Dennis Lee Bieber wrote:
>>>
>>> On Mon, 6 Feb 2012 03:42:08 +1100, Alec Taylor<[hidden email]>
>>> wrote:
>>>
>>>> A 4 year old compiler?
>>>>
>>>> I also have MSVC11 installed. Can the python project add support for
>>>> that so that we aren't waiting 5 years between compiler support?
>>
>>
>> 3.3 will almost certainly be built with VS2010.
>
> I suppose there's no chance of moving to a free compiler?

VC express is free-as-in-beer. The whole V. Studio is free to core
developers. MS may not *like* open-source software, but they have
decided they would like it even less if everyone compiled it with non-MS
compilers.

> Windows work, I've generally used the Open Watcom compiler; that's not
> to say it's the best, but it does the job, and it's free software.

Would it build CPython, including the +- dependent libraries like
tcl/tk? How would the speed compare?

> But no, I'm not offering. Way way too many jobs that I already have
> queued, sorry!

I guess the answer will have to wait ;-).

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Chris Angelico
On Mon, Feb 6, 2012 at 6:39 PM, Terry Reedy <[hidden email]> wrote:
> On 2/6/2012 1:53 AM, Chris Angelico wrote:
>> I suppose there's no chance of moving to a free compiler?
>
> VC express is free-as-in-beer. The whole V. Studio is free to core
> developers. MS may not *like* open-source software, but they have decided
> they would like it even less if everyone compiled it with non-MS compilers.

Oh, that's something at least. I wasn't aware of what exactly they
charge for and what they don't.

>> Windows work, I've generally used the Open Watcom compiler; that's not
>> to say it's the best, but it does the job, and it's free software.
>
> Would it build CPython, including the +- dependent libraries like tcl/tk?
> How would the speed compare?

I can't answer that question without grabbing the sources, going
through the whole work of porting makefiles etc, and finding out
whether there's failures - in other words, doing the whole job. It's
entirely possible that there'll be some dependency failure; but I
would posit that, on balance, it's more likely there won't be.

As to speed - I've not done a lot of compiler benchmarking. (Not sure
whether you mean compilation speed or the efficiency of the resulting
code; either way, I've not tried.) Never actually had multiple
compilers on any one platform for long enough to do serious testing.
It's hardly fair to compare Borland C++ for Windows 3.1, icc on OS/2
32-bit, Open Watcom on XP, and gcc on Debian 64-bit!

It's probably not worth the hassle of changing compilers, although I
do wonder whether changing compiler _versions_ isn't sometimes nearly
as much work. ("What? All that legacy code doesn't compile any more?
Ohh... it doesn't like #include <iostream.h> any more...")

ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

casevh-2
In reply to this post by Alec Taylor
On Feb 5, 6:40 am, Alec Taylor <[hidden email]> wrote:

> PIL, PyCrypto and many other modules require a C compiler and linker.
>
> Unfortunately neither install on my computer, with a PATH with the following:
>
> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
> C:\libraries\MinGW\msys\1.0\bin
> C:\libraries\MinGW
> C:\Python27\Scripts
>
> Output from G:\pycrypto>vcvarsall.bat
> Setting environment for using Microsoft Visual Studio 2010 x86 tools.
>
> Error output from G:\pycrypto>python setup.py build --compiler msvc
> http://pastebin.com/nBsuXDGg
A couple of comments. You will need to complile either GMP or MPIR
first.

MPIR is a windows friendly fork of GMP and I use it create Windows
binaries
for gmpy.
>
> Error output from G:\pycrypto>python setup.py build --compiler mingw32
> 1> log1 2> log2
> Log1:http://pastebin.com/yG3cbdZv
> Log2:http://pastebin.com/qvnshPeh
>
> Will there ever be support for newer MSVC versions? - Also, why

Python 2.7 uses VS2008. I use the command line compiler included with
in
Microsoft's SDK 7.0 which is still available for download. I have
step-
by-step build instructions included in gmpy's source download. I would
try to build MPIR and gmpy first and then adapt/modify the process for
PyCrypto.

MPIR home page: www.mpir.org
gmpy source: gmpy.googlecode.com/files/gmpy-1.15.zip

> doesn't even MinGW install PyCrypto for me?
>

> Thanks for all suggestions,
>
> Alec Taylor
Hope these comments help...
casevh
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
Thanks all for your replies.

I have now installed MSVC8 and YASM.

I was able to successfully run configure.bat and make.bat (including
make.bat check).

However, I'm unsure what to do about install, since there is no
install arg. Do I copy it across to my VC\bin folder, or does it need
it's own place in PATH + system variables?

I am asking because I don't know where it is looking for the MPIR library.

Thanks for all suggestions,

Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

casevh-2
On Tue, Feb 7, 2012 at 9:37 PM, Alec Taylor <[hidden email]> wrote:
> Thanks all for your replies.
>
> I have now installed MSVC8 and YASM.
I assume you installed Visual Studio. I've omitted the commands to use
the SDK compiler below.
>
> I was able to successfully run configure.bat and make.bat (including
> make.bat check).
>
> However, I'm unsure what to do about install, since there is no
> install arg. Do I copy it across to my VC\bin folder, or does it need
> it's own place in PATH + system variables?

The following is just a guess.

I copy the files to a convenient location and then specify that
location to setup.py. Below is an excerpt from my build process.

mkdir c:\src\lib
mkdir c:\src\include
xcopy /Y mpir.h c:\src\include\*.*
xcopy /Y win\mpir.lib c:\src\lib\*.*

python setup.py build_ext -Ic:\src\include -Lc:\src\lib install

>
> I am asking because I don't know where it is looking for the MPIR library.
>
> Thanks for all suggestions,
>
> Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
Thanks, but to get it to work with pip, wouldn't I need to add it to
PATH? - Or can I just add those library args to pip?

On Wed, Feb 8, 2012 at 9:48 PM, Case Van Horsen <[hidden email]> wrote:

> On Tue, Feb 7, 2012 at 9:37 PM, Alec Taylor <[hidden email]> wrote:
>> Thanks all for your replies.
>>
>> I have now installed MSVC8 and YASM.
> I assume you installed Visual Studio. I've omitted the commands to use
> the SDK compiler below.
>>
>> I was able to successfully run configure.bat and make.bat (including
>> make.bat check).
>>
>> However, I'm unsure what to do about install, since there is no
>> install arg. Do I copy it across to my VC\bin folder, or does it need
>> it's own place in PATH + system variables?
>
> The following is just a guess.
>
> I copy the files to a convenient location and then specify that
> location to setup.py. Below is an excerpt from my build process.
>
> mkdir c:\src\lib
> mkdir c:\src\include
> xcopy /Y mpir.h c:\src\include\*.*
> xcopy /Y win\mpir.lib c:\src\lib\*.*
>
> python setup.py build_ext -Ic:\src\include -Lc:\src\lib install
>
>>
>> I am asking because I don't know where it is looking for the MPIR library.
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

casevh-2
On Wed, Feb 8, 2012 at 4:24 AM, Alec Taylor <[hidden email]> wrote:
> Thanks, but to get it to work with pip, wouldn't I need to add it to
> PATH? - Or can I just add those library args to pip?
I don't think so. pyCrypto probably builds a single DLL so the MPIR library is
statically linked into that DLL. Only the innvocation of setup.py should need
to refer to the MPIR library locations.  I don't use pip so I'm not sure how to
get pip to install the resulting DLL, etc.

>
> On Wed, Feb 8, 2012 at 9:48 PM, Case Van Horsen <[hidden email]> wrote:
>> On Tue, Feb 7, 2012 at 9:37 PM, Alec Taylor <[hidden email]> wrote:
>>> Thanks all for your replies.
>>>
>>> I have now installed MSVC8 and YASM.
>> I assume you installed Visual Studio. I've omitted the commands to use
>> the SDK compiler below.
>>>
>>> I was able to successfully run configure.bat and make.bat (including
>>> make.bat check).
>>>
>>> However, I'm unsure what to do about install, since there is no
>>> install arg. Do I copy it across to my VC\bin folder, or does it need
>>> it's own place in PATH + system variables?
>>
>> The following is just a guess.
>>
>> I copy the files to a convenient location and then specify that
>> location to setup.py. Below is an excerpt from my build process.
>>
>> mkdir c:\src\lib
>> mkdir c:\src\include
>> xcopy /Y mpir.h c:\src\include\*.*
>> xcopy /Y win\mpir.lib c:\src\lib\*.*
>>
>> python setup.py build_ext -Ic:\src\include -Lc:\src\lib install
>>
>>>
>>> I am asking because I don't know where it is looking for the MPIR library.
>>>
>>> Thanks for all suggestions,
>>>
>>> Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
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:

C:\workingdir\pycrypto>python setup.py build_ext -Ic:\usr\src\include
-Lc:\usr\src\lib install
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

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 "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']

On Wed, Feb 8, 2012 at 11:31 PM, Case Van Horsen <[hidden email]> wrote:

> On Wed, Feb 8, 2012 at 4:24 AM, Alec Taylor <[hidden email]> wrote:
>> Thanks, but to get it to work with pip, wouldn't I need to add it to
>> PATH? - Or can I just add those library args to pip?
> I don't think so. pyCrypto probably builds a single DLL so the MPIR library is
> statically linked into that DLL. Only the innvocation of setup.py should need
> to refer to the MPIR library locations.  I don't use pip so I'm not sure how to
> get pip to install the resulting DLL, etc.
>>
>> On Wed, Feb 8, 2012 at 9:48 PM, Case Van Horsen <[hidden email]> wrote:
>>> On Tue, Feb 7, 2012 at 9:37 PM, Alec Taylor <[hidden email]> wrote:
>>>> Thanks all for your replies.
>>>>
>>>> I have now installed MSVC8 and YASM.
>>> I assume you installed Visual Studio. I've omitted the commands to use
>>> the SDK compiler below.
>>>>
>>>> I was able to successfully run configure.bat and make.bat (including
>>>> make.bat check).
>>>>
>>>> However, I'm unsure what to do about install, since there is no
>>>> install arg. Do I copy it across to my VC\bin folder, or does it need
>>>> it's own place in PATH + system variables?
>>>
>>> The following is just a guess.
>>>
>>> I copy the files to a convenient location and then specify that
>>> location to setup.py. Below is an excerpt from my build process.
>>>
>>> mkdir c:\src\lib
>>> mkdir c:\src\include
>>> xcopy /Y mpir.h c:\src\include\*.*
>>> xcopy /Y win\mpir.lib c:\src\lib\*.*
>>>
>>> python setup.py build_ext -Ic:\src\include -Lc:\src\lib install
>>>
>>>>
>>>> I am asking because I don't know where it is looking for the MPIR library.
>>>>
>>>> Thanks for all suggestions,
>>>>
>>>> Alec Taylor
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
FYI: When running "vcvarsall" manually, I get a variety of linker
errors, even though I have the SDK and everything else installed:

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:\usr\src\include -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:\usr\src\lib
/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
/IMPLIB: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
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

casevh-2
In reply to this post by casevh-2
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
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,  <[hidden email]> 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
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
Nope, I have C:\Python27 (and C:\Python27\Scripts) in my PATH.

C:\workingdir\pycrypto>where python
C:\Python27\python.exe

On Tue, Mar 13, 2012 at 4:44 PM, Case Van Horsen <[hidden email]> wrote:

> On Mon, Mar 12, 2012 at 9:57 PM, Alec Taylor <[hidden email]> wrote:
>> 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
>>
>
> It almost seems that python can't find all its files. Are you using a
> macro or batch file to invoke python. I actually used
>
> "c:\x64\Python27\python.exe setup.py install"
>
> IIRC, I've had issues with a DOSKEY macro before so now I explicitly
> use the full path to python.exe.
>
> Otherwise I'm stumped.
>> On Tue, Mar 13, 2012 at 2:59 PM,  <[hidden email]> 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
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

Alec Taylor
Oh wait, just realised it was loading the (x86) tools. Doing a quick
search I noticed that I didn't have the x64 components installed, so
loading up the MSVC08 setup again and installing it, then:
copying vcvarsamd64.bat to vcvarsall.bat and adding its directory
(C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\) to
PATH....

AND IT WORKS!

=D
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: PyCrypto builds neither with MSVC nor MinGW

bikewave
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I also had the unresolved externals problem (not the mdir.h problem, though) and my solution was different.
a) reinstall python2.6.4, but use the 32-bit msi instead of the 64-bit msi (AMD64)
b) source the c:\program files(x86\microsoft visual studio 9.0\vc\bin\vcvars32.bat
and shazzaaaam the pycrypto build + install worked fine.
My VisualStudio V9 appears to be 32-bit (basing this conclusion on the lack of a vcvars64.bat file.)
Hopefully I'm not muddying the waters since my symptoms are slightly different than the original posters.
Loading...