ohio813 / pyreplib

Automatically exported from code.google.com/p/pyreplib
0 stars 0 forks source link

Can't build in Win7/64 bit #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set up a working command line environment for VS 2008. (environment vars
include INCLUDE, LIB and PATH. Requires the Windows Platform SDK as well.)
2. check out the tree and run `python setup.py install`
3. Output follows, with DISTUTILS_DEBUG set.

What is the expected output? What do you see instead?
I copied the important lines right here; after them is the verbose output.

LINK : error LNK2001: unresolved external symbol initpyreplib\_unpack
build\temp.win32-2.6\Release\src\_unpack.lib : fatal error LNK1120: 1
unresolved externals

C:\Users\Owen\Documents\pyreplib\pyreplib-read-only>setup.py install
Distribution.parse_config_files():
options (after parsing config files):
no commands known yet
options (after parsing command line):
option dict for 'install' command:
  {}
running install
Distribution.get_command_obj(): creating 'install' command object
pre-finalize_{unix,other}:
  prefix: None
  exec_prefix: None
  home: None
  user: 0
  install_base: None
  install_platbase: None
  root: None
  install_purelib: None
  install_platlib: None
  install_lib: None
  install_headers: None
  install_scripts: None
  install_data: None
  compile: None
  compile: True
  optimize: None
  force: None
  skip_build: 0
  record: None
post-finalize_{unix,other}():
  prefix: C:\Python26
  exec_prefix: None
  home: None
  user: 0
  install_base: C:\Python26
  install_platbase: C:\Python26
  root: None
  install_purelib: $base/Lib/site-packages
  install_platlib: $base/Lib/site-packages
  install_lib: None
  install_headers: $base/Include/$dist_name
  install_scripts: $base/Scripts
  install_data: $base
  compile: None
  compile: True
  optimize: None
  force: None
  skip_build: 0
  record: None
post-expand_basedirs():
  prefix: C:\Python26
  exec_prefix: None
  home: None
  user: 0
  install_base: C:\Python26
  install_platbase: C:\Python26
  root: None
  install_purelib: $base/Lib/site-packages
  install_platlib: $base/Lib/site-packages
  install_lib: None
  install_headers: $base/Include/$dist_name
  install_scripts: $base/Scripts
  install_data: $base
  compile: None
  compile: True
  optimize: None
  force: None
  skip_build: 0
  record: None
config vars:
{'base': 'C:\\Python26',
 'dist_fullname': 'pyreplib-0.0.1',
 'dist_name': 'pyreplib',
 'dist_version': '0.0.1',
 'exec_prefix': 'C:\\Python26',
 'platbase': 'C:\\Python26',
 'prefix': 'C:\\Python26',
 'py_version': '2.6.4',
 'py_version_nodot': '26',
 'py_version_short': '2.6',
 'sys_exec_prefix': 'C:\\Python26',
 'sys_prefix': 'C:\\Python26',
 'userbase': 'C:\\Users\\Owen\\AppData\\Roaming\\Python',
 'usersite':
'C:\\Users\\Owen\\AppData\\Roaming\\Python\\Python26\\site-packages
'}
post-expand_dirs():
  prefix: C:\Python26
  exec_prefix: None
  home: None
  user: 0
  install_base: C:\Python26
  install_platbase: C:\Python26
  root: None
  install_purelib: C:\Python26/Lib/site-packages
  install_platlib: C:\Python26/Lib/site-packages
  install_lib: None
  install_headers: C:\Python26/Include/pyreplib
  install_scripts: C:\Python26/Scripts
  install_data: C:\Python26
  compile: None
  compile: True
  optimize: None
  force: None
  skip_build: 0
  record: None
after prepending root:
  prefix: C:\Python26
  exec_prefix: None
  home: None
  user: 0
  install_base: C:\Python26
  install_platbase: C:\Python26
  root: None
  install_purelib: C:\Python26\Lib\site-packages
  install_platlib: C:\Python26\Lib\site-packages
  install_lib: C:\Python26\Lib\site-packages\
  install_headers: C:\Python26\Include\pyreplib
  install_scripts: C:\Python26\Scripts
  install_data: C:\Python26
  compile: None
  compile: True
  optimize: None
  force: None
  skip_build: 0
  record: None
Distribution.get_command_obj(): creating 'build' command object
running build
running build_py
Distribution.get_command_obj(): creating 'build_py' command object
creating build
creating build\lib.win32-2.6
creating build\lib.win32-2.6\pyreplib
copying pyreplib\actions.py -> build\lib.win32-2.6\pyreplib
copying pyreplib\replay.py -> build\lib.win32-2.6\pyreplib
copying pyreplib\utils.py -> build\lib.win32-2.6\pyreplib
copying pyreplib\__init__.py -> build\lib.win32-2.6\pyreplib
running build_ext
Distribution.get_command_obj(): creating 'build_ext' command object
building 'pyreplib\_unpack' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
creating build\temp.win32-2.6\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include -IC:\Python26\PC
/Tcsrc\pyunpack.c /Fobuild\temp.win32-2.6\Release\src\pyunpack.obj
pyunpack.c
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include -IC:\Python26\PC
/Tcsrc\unpack.c /Fobuild\temp.win32-2.6\Release\src\unpack.obj
unpack.c
src\unpack.c(359) : warning C4996: 'fopen': This function or variable may
be unsafe. Consider using fopen_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
        C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\INCLUDE\stdio.h(237) : see declaration of 'fopen'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
/nologo /INCREMENTAL:NO /LIBPATH:C:\Python26\libs
/LIBPATH:C:\Python26\PCbuild /EXPORT:initpyreplib\_unpack
build\temp.win32-2.6\Release\src\pyunpack.obj
build\temp.win32-2.6\Release\src\unpack.obj
/OUT:build\lib.win32-2.6\pyreplib\_unpack.pyd
/IMPLIB:build\temp.win32-2.6\Release\src\_unpack.lib
/MANIFESTFILE:build\temp.win32-2.6\Release\src\_unpack.pyd.manifest
LINK : error LNK2001: unresolved external symbol initpyreplib\_unpack
build\temp.win32-2.6\Release\src\_unpack.lib : fatal error LNK1120: 1
unresolved externals
Traceback (most recent call last):
  File "C:\Users\Owen\Documents\pyreplib\pyreplib-read-only\setup.py", line
15, in <module>
    ext_modules=[pyunpack])
  File "C:\Python26\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\install.py", line 577, in run
    self.run_command('build')
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build.py", line 134, in run
    self.run_command(cmd_name)
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 449, in
build_extensions
    self.build_extension(ext)
  File "C:\Python26\lib\distutils\command\build_ext.py", line 531, in
build_extension
    target_lang=language)
  File "C:\Python26\lib\distutils\ccompiler.py", line 845, in
link_shared_object

    extra_preargs, extra_postargs, build_temp, target_lang)
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 639, in link
    raise LinkError(msg)
distutils.errors.LinkError: command '"C:\Program Files (x86)\Microsoft
Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120

What version of the product are you using? On what operating system?
svn revision 48

Please provide any additional information below.

I tried screwing with the linker flags. The problem is
/EXPORT:initpyreplib\_unpack - I haven't done any serious C/C++ linking
work, but I can't figure out why there's a "initpyreplib\" in the symbol
name, and I can't find a symbol called _unpack in the source anywhere.

When I change that flag to /EXPORT:init_unpack it installs, but Python
can't import the module; here's the output, verbose again:

>>> from pyreplib import replay, utils
# C:\Python26\lib\encodings\cp437.pyc matches
C:\Python26\lib\encodings\cp437.py

import encodings.cp437 # precompiled from C:\Python26\lib\encodings\cp437.pyc
import pyreplib # directory pyreplib
# pyreplib\__init__.pyc matches pyreplib\__init__.py
import pyreplib # precompiled from pyreplib\__init__.pyc
# pyreplib\replay.pyc matches pyreplib\replay.py
import pyreplib.replay # precompiled from pyreplib\replay.pyc
import datetime # builtin
# C:\Python26\lib\struct.pyc matches C:\Python26\lib\struct.py
import struct # precompiled from C:\Python26\lib\struct.pyc
import _struct # builtin
import cStringIO # builtin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyreplib\replay.py", line 5, in <module>
    from pyreplib import _unpack
ImportError: DLL load failed: %1 is not a valid Win32 application.

Original issue reported on code.google.com by ojr...@gmail.com on 20 Nov 2009 at 6:52

GoogleCodeExporter commented 9 years ago
After a good night's rest (and messing around with command line options for a 
while),
I managed to compile it manually like so:

cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include 
-IC:\Python26\PC
/Tcsrc\pyunpack.c /Fobuild\temp.win32-2.6\Release\src\pyunpack.obj

cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\include 
-IC:\Python26\PC
/Tcsrc\unpack.c /Fobuild\temp.win32-2.6\Release\src\unpack.obj

link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python26\libs
/LIBPATH:C:\Python26\PCbuild /EXPORT:init_unpack
build\temp.win32-2.6\Release\src\pyunpack.obj
build\temp.win32-2.6\Release\src\unpack.obj
/OUT:build\lib.win32-2.6\pyreplib\_unpack.pyd
/IMPLIB:build\temp.win32-2.6\Release\src\_unpack.lib
/MANIFESTFILE:build\temp.win32-2.6\Release\src\_unpack.pyd.manifest

I've attached the built package, in case this doesn't get resolved and other 
Windows
users with less patience for linker errors can make use of it. ;)

Original comment by ojr...@gmail.com on 21 Nov 2009 at 4:45

Attachments: