
I download last version of PyPy source from https://github.com/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-unknown-1\gcctest.c: In function 'main': e:\tem\usession-unknown-1\gcctest.c:25:51: error: 'uintptr_t' undeclared (first use in this function) this is how I fix this bug: diff -crN pypy\rpython\tool\rfficache.py pypy\rpython\tool\rfficache.bookaa.py *** pypy\rpython\tool\rfficache.py Mon May 21 14:45:32 2012 --- pypy\rpython\tool\rfficache.bookaa.py Wed May 23 08:07:33 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,19 ---- from pypy.tool.gcc_cache import build_executable_cache def ask_gcc(question, add_source=""): ! includes = ['stdlib.h', 'stdio.h', 'sys/types.h', 'stdint.h'] if os.name != 'nt': includes += ['inttypes.h'] include_string = "\n".join(["#include <%s>" % i for i in includes]) diff -crN pypy\rlib\rposix.py pypy\rlib\rposix.bookaa.py *** pypy\rlib\rposix.py Mon May 21 14:45:32 2012 --- pypy\rlib\rposix.bookaa.py Wed May 23 08:29:36 2012 *************** *** 24,29 **** --- 24,30 ---- separate_module_sources =[''' /* Lifted completely from CPython 3.3 Modules/posix_module.c */ #include <malloc.h> /* for _msize */ + #include <stdint.h> /* for intptr_t */ typedef struct { intptr_t osfhnd; char osfile;

Hi I don't know about the github mirror, the official one is on bitbucket. Cheers,\ fijal On Wed, May 23, 2012 at 6:07 AM, bookaa <rorsoft@gmail.com> wrote:
**
I download last version of PyPy source from https://github.com/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-unknown-1\gcctest.c: In function 'main': e:\tem\usession-unknown-1\gcctest.c:25:51: error: 'uintptr_t' undeclared (first use in this function)
this is how I fix this bug:
diff -crN pypy\rpython\tool\rfficache.py pypy\rpython\tool\ rfficache.bookaa.py *** pypy\rpython\tool\rfficache.py Mon May 21 14:45:32 2012 --- pypy\rpython\tool\rfficache.bookaa.py Wed May 23 08:07:33 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,19 ---- from pypy.tool.gcc_cache import build_executable_cache
def ask_gcc(question, add_source=""): ! includes = ['stdlib.h', 'stdio.h', 'sys/types.h', 'stdint.h'] if os.name != 'nt': includes += ['inttypes.h'] include_string = "\n".join(["#include <%s>" % i for i in includes]) diff -crN pypy\rlib\rposix.py pypy\rlib\rposix.bookaa.py *** pypy\rlib\rposix.py Mon May 21 14:45:32 2012 --- pypy\rlib\rposix.bookaa.py Wed May 23 08:29:36 2012 *************** *** 24,29 **** --- 24,30 ---- separate_module_sources =[''' /* Lifted completely from CPython 3.3 Modules/posix_module.c */ #include <malloc.h> /* for _msize */ + #include <stdint.h> /* for intptr_t */ typedef struct { intptr_t osfhnd; char osfile;
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev

Hi Bookaa, On Wed, May 23, 2012 at 6:07 AM, bookaa <rorsoft@gmail.com> wrote:
! includes = ['stdlib.h', 'stdio.h', 'sys/types.h', 'stdint.h']
The MSVC compiler before 2010 doesn't provide a 'stdint.h', so this change would break it. You need to come up with a more complicated solution. Armin

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):

yes, it should be like this. thank you Bookaa From: Amaury Forgeot d'Arc Sent: Wednesday, May 23, 2012 9:26 PM To: bookaa Cc: pypy-dev@python.org Subject: Re: [pypy-dev] bug with MinGW32 2012/5/23 bookaa <rorsoft@gmail.com> if platform.platform.cc.startswith('mingw32'): This is better written as: from pypy.translator.platform import platform if platform.name == 'minwg32' See rlib/libffi.py for an example. -- Amaury Forgeot d'Arc

On 25/05/2012 3:35 AM, bookaa wrote:
yes, it should be like this. thank you Bookaa
*From:* Amaury Forgeot d'Arc <mailto:amauryfa@gmail.com> *Sent:* Wednesday, May 23, 2012 9:26 PM *To:* bookaa <mailto:rorsoft@gmail.com> *Cc:* pypy-dev@python.org <mailto:pypy-dev@python.org> *Subject:* Re: [pypy-dev] bug with MinGW32
2012/5/23 bookaa <rorsoft@gmail.com <mailto:rorsoft@gmail.com>>
if platform.platform.cc <http://platform.platform.cc>.startswith('mingw32'):
This is better written as: from pypy.translator.platform import platform if platform.name <http://platform.name> == 'minwg32' See rlib/libffi.py for an example.
-- Amaury Forgeot d'Arc
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
Thanks bookaa. I committed this to the default branch, also allowing cc=gcc, i.e. --cc=gcc or $export CC=gcc Support for mingw seems not to be complete: $/c/Python27/python pytest.py pypy/rlib/test/test_rposix.py shows failing tests with cc set via environment variable CC. Matti
participants (5)
-
Amaury Forgeot d'Arc
-
Armin Rigo
-
bookaa
-
Maciej Fijalkowski
-
Matti Picus