[Numpy-discussion] "Symbol table not found" compiling numpy from git repository on Windows

Ondřej Čertík ondrej.certik@gmail....
Wed Jul 18 05:38:25 CDT 2012


On Wed, Jul 18, 2012 at 12:30 PM, Ondřej Čertík <ondrej.certik@gmail.com> wrote:
> On Wed, Jul 18, 2012 at 2:20 AM, Ondřej Čertík <ondrej.certik@gmail.com> wrote:
>> On Thu, Jan 5, 2012 at 8:22 PM, John Salvatier
>> <jsalvati@u.washington.edu> wrote:
>>> Hello,
>>>
>>> I'm trying to compile numpy on Windows 7 using the command: "python setup.py
>>> config --compiler=mingw32 build" but I get an error about a symbol table not
>>> found. Anyone know how to work around this or what to look into?
>>>
>>> building library "npymath" sources
>>> Building msvcr library: "C:\Python26\libs\libmsvcr90.a" (from
>>> C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_750b37ff97f4f68b\msvcr90.dll)
>>> objdump.exe:
>>> C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_750b37ff97f4f68b\msvcr90.dll:
>>> File format not recognized
>>> Traceback (most recent call last):
>>>   File "setup.py", line 214, in <module>
>>>     setup_package()
>>>   File "setup.py", line 207, in setup_package
>>>     configuration=configuration )
>>>   File "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\core.py", line
>>> 186, in setup
>>>     return old_setup(**new_attr)
>>>   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:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\build.py", line
>>> 37, in run
>>>     old_build.run(self)
>>>   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:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\build_src.py",
>>> line 152, in run
>>>     self.build_sources()
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\build_src.py",
>>> line 163, in build_sources
>>>     self.build_library_sources(*libname_info)
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\build_src.py",
>>> line 298, in build_library_sources
>>>     sources = self.generate_sources(sources, (lib_name, build_info))
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\build_src.py",
>>> line 385, in generate_sources
>>>     source = func(extension, build_dir)
>>>   File "numpy\core\setup.py", line 646, in get_mathlib_info
>>>     st = config_cmd.try_link('int main(void) { return 0;}')
>>>   File "C:\Python26\lib\distutils\command\config.py", line 257, in try_link
>>>     self._check_compiler()
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\command\config.py",
>>> line 45, in _check_compiler
>>>     old_config._check_compiler(self)
>>>   File "C:\Python26\lib\distutils\command\config.py", line 107, in
>>> _check_compiler
>>>     dry_run=self.dry_run, force=1)
>>>   File "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\ccompiler.py",
>>> line 560, in new_compiler
>>>     compiler = klass(None, dry_run, force)
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\mingw32ccompiler.py",
>>> line 94, in __init__
>>>     msvcr_success = build_msvcr_library()
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\mingw32ccompiler.py",
>>> line 362, in build_msvcr_library
>>>     generate_def(dll_file, def_file)
>>>   File
>>> "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\mingw32ccompiler.py",
>>> line 282, in generate_def
>>>     raise ValueError("Symbol table not found")
>>> ValueError: Symbol table not found
>>
>>
>> Did you find a workaround? I am having exactly the same problem.
>
> So this happens both in Windows and in Wine and the problem is that
> the numpy distutils is trying to read the symbol table using "objdump"
> from msvcr90.dll but it can't recognize the format:
>
> objdump.exe: C:\windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_deadbeef\msvcr90.dll:
> File format not recognized
>
> The file exists:
>
>
> $ file ~/.wine/drive_c/windows/winsxs/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_deadbeef/msvcr90.dll
> /home/ondrej/.wine/drive_c/windows/winsxs/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_deadbeef/msvcr90.dll:
> PE32 executable for MS Windows (DLL) (unknown subsystem) Intel 80386
> 32-bit
>
>
> But objdump doesn't work on it.

So the following patch fixes it:


diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompi
index 5b9aa33..72ff5ed 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -91,11 +91,11 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCComp
         build_import_library()

         # Check for custom msvc runtime library on Windows. Build if it doesn't
-        msvcr_success = build_msvcr_library()
-        msvcr_dbg_success = build_msvcr_library(debug=True)
-        if msvcr_success or msvcr_dbg_success:
-            # add preprocessor statement for using customized msvcr lib
-            self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR')
+        #msvcr_success = build_msvcr_library()
+        #msvcr_dbg_success = build_msvcr_library(debug=True)
+        #if msvcr_success or msvcr_dbg_success:
+        #    # add preprocessor statement for using customized msvcr lib
+        #    self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR')

         # Define the MSVC version as hint for MinGW
         msvcr_version = '0x%03i0' % int(msvc_runtime_library().lstrip('msvcr'))




Now things work and start compiling. Any ideas what is going on here?
Why is it trying to "build the msvcr" library?

Ondrej


More information about the NumPy-Discussion mailing list