Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'method,': 0.05; 'initialize': 0.07; 'skip:` 10': 0.07; 'working:': 0.07; 'python': 0.08; '#define': 0.09; '#undef': 0.09; '>>>>': 0.09; 'fatal': 0.09; 'linker': 0.09; 'path.': 0.09; 'referenced': 0.09; 'setup.py': 0.09; 'valueerror:': 0.09; 'files.': 0.09; 'error:': 0.10; 'output': 0.10; 'library': 0.13; 'binary': 0.13; '"python': 0.15; 'honor': 0.15; 'skip:" 40': 0.15; 'skip:v 30': 0.15; '/nologo': 0.16; '498,': 0.16; 'config.h': 0.16; 'declaration': 0.16; 'externals': 0.16; 'from:addr:alec.taylor6': 0.16; 'from:name:alec taylor': 0.16; 'horsen': 0.16; 'iirc,': 0.16; 'install"': 0.16; 'modified.': 0.16; 'skip:/ 50': 0.16; 'unresolved': 0.16; 'looked': 0.16; 'mon,': 0.16; 'extension': 0.17; 'wrote:': 0.18; '>>>': 0.18; '(which': 0.19; 'seems': 0.20; '(most': 0.21; 'to:2**1': 0.21; 'received:209.85.210.174': 0.21; 'received:mail-iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; 'command': 0.24; 'specify': 0.24; 'traceback': 0.24; 'creating': 0.25; 'windows': 0.26; 'skip:_ 20': 0.26; 'figure': 0.26; 'url:mailman': 0.27; 'function': 0.27; 'tried': 0.27; 'looks': 0.27; 'skip:" 30': 0.28; "i'm": 0.28; 'message- id:@mail.gmail.com': 0.29; 'compile': 0.29; 'exit': 0.29; 'explicitly': 0.29; 'made.': 0.29; "skip:' 30": 0.29; 'worked': 0.29; 'installed': 0.29; 'pm,': 0.29; 'skip:p 30': 0.29; '(and': 0.30; 'installer': 0.30; 'invoke': 0.30; 'nope,': 0.30; 'van': 0.30; 'error': 0.30; 'skip:b 30': 0.31; 'actually': 0.31; 'file.': 0.31; 'url:listinfo': 0.32; 'skip:\xa0 30': 0.32; "i've": 0.32; 'does': 0.32; 'tue,': 0.32; "isn't": 0.33; 'there': 0.33; "can't": 0.33; 'object': 0.33; 'file': 0.34; 'running': 0.34; '8bit%:3': 0.34; 'copied': 0.34; 'directory.': 0.34; 'last):': 0.34; 'option.': 0.34; 'symbol': 0.34; 'to:addr:python-list': 0.35; 'copying': 0.35; 'external': 0.35; 'skip:" 20': 0.35; 'url:python': 0.35; 'install': 0.35; 'created': 0.37; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'subject:with': 0.37; 'skip:_ 10': 0.38; 'received:209.85': 0.38; 'monday,': 0.38; 'files': 0.39; 'skip:\xa0 10': 0.39; 'url:org': 0.39; 'header': 0.39; 'received:209': 0.39; 'setup': 0.40; 'to:addr:python.org': 0.40; 'skip:_ 30': 0.40; 'march': 0.61; 'full': 0.62; 'below': 0.62; '8bit%:4': 0.63; 'studio': 0.63; 'skip:b 50': 0.67; 'taylor': 0.67; 'brand': 0.76; 'skip:9 20': 0.84; '4:44': 0.91; 'successful.': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=sVOx7GFIMSc+IwPBG+MjRCtS/nbDM8FsBo/nWwS4C3c=; b=hq5yxptiaOfPc8EwKGOGzetUBqOskVIp1Ll0NwIQjE5nJ65HyVXpeZyhQCYTtx4E2l gjPk6bw8y4Bz7LsF1oWrunajmiV7H5bckm2bk2xS/95yUrlmGAoS+A3qqJ0hMsLuJJWR 1jZc9Zcf7cC328ih4TphxgEZbByLn4yS0uM8PxHNP1pssJmJCpUJvhlApOqmVcj2mMU2 mpIS3B53Dv2ncdfLFsYat0GODGBXvGYuNEzNlQS/uUPg84PldQziiTfL6xWPX1PeKRE+ fumek0v7+2DwDDFgiDfVnwFwwuhTKfa+TJaSkyJ5TQVXGRUwmkjXTR9W8djtDeRo63BV aMmg== MIME-Version: 1.0 In-Reply-To: References: <35da69c3-edcc-4466-8a0d-70237c88af3b@qv4g2000pbc.googlegroups.com> <13993807.3661.1331611178050.JavaMail.geo-discussion-forums@pbcgf10> Date: Tue, 13 Mar 2012 17:09:38 +1100 Subject: Re: PyCrypto builds neither with MSVC nor MinGW From: Alec Taylor To: Case Van Horsen , "comp.lang.python" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 199 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331618982 news.xs4all.nl 6936 [2001:888:2000:d::a6]:48302 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21555 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 wrote: > On Mon, Mar 12, 2012 at 9:57 PM, Alec Taylor wro= te: >> 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): >> =A0File "setup.py", line 452, in >> =A0 =A0core.setup(**kw) >> =A0File "C:\Python27\lib\distutils\core.py", line 152, in setup >> =A0 =A0dist.run_commands() >> =A0File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands >> =A0 =A0self.run_command(cmd) >> =A0File "C:\Python27\lib\distutils\dist.py", line 972, in run_command >> =A0 =A0cmd_obj.run() >> =A0File "C:\Python27\lib\distutils\command\install.py", line 563, in run >> =A0 =A0self.run_command('build') >> =A0File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command >> =A0 =A0self.distribution.run_command(command) >> =A0File "C:\Python27\lib\distutils\dist.py", line 972, in run_command >> =A0 =A0cmd_obj.run() >> =A0File "C:\Python27\lib\distutils\command\build.py", line 127, in run >> =A0 =A0self.run_command(cmd_name) >> =A0File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command >> =A0 =A0self.distribution.run_command(command) >> =A0File "C:\Python27\lib\distutils\dist.py", line 972, in run_command >> =A0 =A0cmd_obj.run() >> =A0File "setup.py", line 249, in run >> =A0 =A0build_ext.run(self) >> =A0File "C:\Python27\lib\distutils\command\build_ext.py", line 339, in r= un >> =A0 =A0self.build_extensions() >> =A0File "setup.py", line 146, in build_extensions >> =A0 =A0build_ext.build_extensions(self) >> =A0File "C:\Python27\lib\distutils\command\build_ext.py", line 448, in >> build_extensions >> =A0 =A0self.build_extension(ext) >> =A0File "C:\Python27\lib\distutils\command\build_ext.py", line 498, in >> build_extension >> =A0 =A0depends=3Dext.depends) >> =A0File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compi= le >> =A0 =A0self.initialize() >> =A0File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initi= alize >> =A0 =A0vc_env =3D query_vcvarsall(VERSION, plat_spec) >> =A0File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in >> query_vcvarsall >> =A0 =A0raise 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.p= yd /IMPL >> IB:build\temp.win-amd64-2.7\Release\src\winrandom.lib >> /MANIFESTFILE:build\temp.win-amd64-2.7\Release\src\winrandom.pyd.manifes= t >> =A0 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: >> =A021 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, =A0 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 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> /* Define to 1 if you have the declaration of `mpz_powm', and to 0 if y= ou >>> =A0 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 >>> =A0 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 header file. */ >>> #define HAVE_STDINT_H 1 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> 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 mpi= r.lib file into my Python27\libs directory. >>> >>> After copying the files "python setup.py install" was successful. I cre= ated a binary installer with "python setup.py bdist-wininst". >>> >>> There may be a cleaner way to build PyCrypto, but these steps worked fo= r me. >>> >>> casevh >>> -- >>> http://mail.python.org/mailman/listinfo/python-list