[pypy-dev] bug with MinGW32

bookaa rorsoft at gmail.com
Wed May 23 14:46:44 CEST 2012


Re Armin and fijal


I download last version of PyPy source pypy-pypy-4a38b43757e3.zip from 
https://bitbucket.org/pypy/pypy
in MinGW32 (mingw-get-inst-20120426.exe), run:
	pypy/bin/py.py --cc=mingw32-gcc
get error:
	pypy.translator.platform.CompilationError: CompilationError(err="""
	        e:\tem\usession-default-0\gcctest.c: In function 'main':
	        e:\tem\usession-default-0\gcctest.c:25:51: error: 'uintptr_t' 
undeclared (first use in this function)

this is how I fix this bug:

diff -crN pypy-pypy-4a38b43757e3/pypy/rlib/rposix.py 
pypy-pypy-4a38b43757e3.bookaa/pypy/rlib/rposix.py
*** pypy-pypy-4a38b43757e3/pypy/rlib/rposix.py	Tue May 22 14:03:20 2012
--- pypy-pypy-4a38b43757e3.bookaa/pypy/rlib/rposix.py	Wed May 23 20:25:10 
2012
***************
*** 75,80 ****
--- 75,85 ----
              return 0;
          }
      ''',]
+     from pypy.translator import platform
+     if platform.platform.cc.startswith('mingw32'):
+         separate_module_sources[0] = """
+             #include <stdint.h> /* for intptr_t */
+         """ + separate_module_sources[0]
      export_symbols = ['_PyVerify_fd']
  else:
      separate_module_sources = []
diff -crN pypy-pypy-4a38b43757e3/pypy/rpython/tool/rfficache.py 
pypy-pypy-4a38b43757e3.bookaa/pypy/rpython/tool/rfficache.py
*** pypy-pypy-4a38b43757e3/pypy/rpython/tool/rfficache.py	Tue May 22 
14:03:20 2012
--- pypy-pypy-4a38b43757e3.bookaa/pypy/rpython/tool/rfficache.py	Wed May 23 
20:38:08 2012
***************
*** 13,19 ****
  from pypy.tool.gcc_cache import build_executable_cache

  def ask_gcc(question, add_source=""):
!     includes = ['stdlib.h', 'stdio.h', 'sys/types.h']
      if os.name != 'nt':
          includes += ['inttypes.h']
      include_string = "\n".join(["#include <%s>" % i for i in includes])
--- 13,23 ----
  from pypy.tool.gcc_cache import build_executable_cache

  def ask_gcc(question, add_source=""):
!     from pypy.translator import platform
!     if platform.platform.cc.startswith('mingw32'):
!         includes = ['stdlib.h', 'stdio.h', 'sys/types.h', 'stdint.h']
!     else:
!         includes = ['stdlib.h', 'stdio.h', 'sys/types.h']
      if os.name != 'nt':
          includes += ['inttypes.h']
      include_string = "\n".join(["#include <%s>" % i for i in includes])
diff -crN pypy-pypy-4a38b43757e3/pypy/translator/platform/posix.py 
pypy-pypy-4a38b43757e3.bookaa/pypy/translator/platform/posix.py
*** pypy-pypy-4a38b43757e3/pypy/translator/platform/posix.py	Tue May 22 
14:03:20 2012
--- pypy-pypy-4a38b43757e3.bookaa/pypy/translator/platform/posix.py	Wed May 
23 20:41:12 2012
***************
*** 55,60 ****
--- 55,62 ----

          if relto:
              response_file = relto.bestrelpath(response_file)
+         if self.cc.startswith('mingw32'):
+             return ["-Wl,--export-all-symbols,--version-script=%s" % 
(response_file,)]
          return ["-Wl,--export-dynamic,--version-script=%s" % 
(response_file,)]

      def _link(self, cc, ofiles, link_args, standalone, exe_name):
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bookaa.dif
Type: application/octet-stream
Size: 2507 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120523/32ba4aeb/attachment.obj>


More information about the pypy-dev mailing list