[pypy-dev] Porting PyPy to OpenBSD/amd64

Laurence Tratt laurie at tratt.net
Tue Aug 2 20:14:40 CEST 2011


Hello all,

I'm looking to port PyPy to OpenBSD (specifically amd64/x86_64, as I no
longer have any i386 machines; that might be the cause of some of my woes).
Getting much of PyPy to run on OpenBSD/amd64 is simple - partly basing things
on the FreeBSD parts - and compilation on my laptop merrily steams ahead for
half an hour or more. It then stumbles over time types which, in terms of
RPython / PyPy, I must admit ignorance. Any help is much appreciated!

My current problem centres around pypy/module/rctime/interp_time.py. The
offending code is here:

  t = (((c_time(lltype.nullptr(rffi.TIME_TP.TO))) / YEAR) * YEAR)
  # we cannot have reference to stack variable, put it on the heap
  t_ref = lltype.malloc(rffi.TIME_TP.TO, 1, flavor='raw')
  t_ref[0] = t
  p = c_localtime(t_ref)

That last line (#210) then causes this error message:

  E         TypeError: <Array of INT > items:
  E         expect <INT>
  E            got <Signed>

This is surprising because, naively, all the types in interp_time.py seem to
match up with what I'd expected. On line 320 of that module there is
something which gave me an idea. So if I change the first line of that
excerpt to:

  t = rffi.r_time_t((((c_time(lltype.nullptr(rffi.TIME_TP.TO))) / YEAR) * YEAR))

I don't get the error. Is it the right patch? Dunno. But, if it is, I doubt
it's OpenBSD specific (is it a 64 bit thing perhaps?).

However, things then die a little later:

  [translation:ERROR]  TyperError: don't know how to convert from <FloatRepr Float> to <IntegerRepr INT>
  [translation:ERROR] .. (pypy.module.rctime.interp_time:287)_get_inttime
  [translation:ERROR] .. block at 121 with 1 exits
  [translation:ERROR] .. v1 = simple_call((type r_INT), v0)

So I'm not sure if this is a one-off problem; or if the wrong types are
being used in other places too; or if PyPy is getting confused by some of
OpenBSD's types; or... who knows. Unfortunately the backtraces I get are in
the guts of RPython, and only seem to tell me the point of the error, and
not the full backtrace that led to it - I'm not sure what function called
_get_inttime.

If anyone has any suggestions, I'm all ears!


Laurie
-- 
http://tratt.net/laurie/ -- Personal
http://fetegeo.org/      -- Free text geocoding
http://convergepl.org/   -- The Converge programming language


More information about the pypy-dev mailing list