Search code examples
python-3.xraspberry-pi2gmpbuildrootgmpy

How to get the gmpy2 module in RPI2 Buildroot


I am unable to get the gmpy2 Python module working in a Buildroot build for Raspberry Pi2. Buildroot does not include the gmpy2 module by default.

Buildroot does not include the GCC as well, so I compiled the gmpy2 module from source on Raspbian on another RPI2 board (having the same Python version -- 3.7.2 -- as the Buildroot board) and copied the resulting gmpy2.cpython-37m-arm-linux-gnueabihf.so to Buildroot board's /usr/lib/python3.7/site-packages/ and put a link gmpy2.so in the same directory.

I expected Python to be able to see the module, but instead I get:

# python3
Python 3.7.2 (default, Apr 10 2019, 23:36:01)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: File not found
>>>

Any help is much appreciated!


Solution

  • To create an actual Buildroot package for gmpy2, it should be sufficient to run utils/scanpypi gmpy2. Make sure that package/python-gmpy2/Config.in is sourced from package/Config.in, then you can select it in the normal way from menuconfig.

    If it all works, please send the patch to the Buildroot mailing list for upstream inclusion. Thank you for your contribution!