antocuni / capnpy

Other
45 stars 26 forks source link

Decoding issue on Raspberry Pi (CPython) #35

Closed agates closed 8 months ago

agates commented 6 years ago

I've been having some decoding errors on the Raspberry Pi using CPython. loads() of any struct ends up returning None without any error.

The python implementation works fine on the platform with PyPy, but in this case I can only really use CPython 3 (unrelated, can't get pypy3 running on arm6), so I need to figure out a way around it and I'd prefer to use capnpy over pycapnp :).

My initial thought is the C code is written specifically for linux/x86, but unfortunately I don't have enough knowledge to find the issue.

I've tested it with both a Raspberry Pi Zero (arm6) and Raspberry Pi 3 (arm7).

agates commented 6 years ago

I've figured out that there is also a compilation issue, both from the command line module or with dynamic loading. For example, with foo.capnp:

@0xd03692e144283d76;
struct Foo {
  bar @0 :Text;
}

The following error:

(capnpy-test) pi@raspberrypi:~/src $ python -m capnpy compile foo.capnp
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/__main__.py", line 65, in <module>
    main()
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/__main__.py", line 60, in main
    compile(args)
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/__main__.py", line 50, in compile
    version_check=args['--version-check'])
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/compiler/compiler.py", line 248, in compile
    m, src = self.generate_py_source(infile, convert_case, pyx, version_check)
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/compiler/compiler.py", line 58, in generate_py_source
    src = m.generate()
  File "/home/pi/.virtualenvs/capnpy-test/lib/python3.5/site-packages/capnpy-0.5.0-py3.5-linux-armv6l.egg/capnpy/compiler/module.py", line 71, in generate
    self.request.emit(self)
AttributeError: 'NoneType' object has no attribute 'emit'
agates commented 6 years ago

I figured out how to install with export USE_CYTHON=0, and compiling + encoding/decoding works correctly :). Obviously it will be very slow on CPython though!

agates commented 8 months ago

Closing because this was on arm6 and probably not relevant anymore.