Originally created as a faster version of Unum for use in Python-based FRC robot code.
maturin develop --release # This will generate wheels and put a native library in ./fast_unit/
pip install . # Installs to your python interpreter
In order to compile for RoboRIO, you need to copy the contents of /usr/local/lib
off of your RIO and
update the RIO_ROOT
to reflect where you copied them to. This is assuming you have already
installed python on your RIO using RobotPy.
This is the command I used to accomplish this:
scp [email protected]:/usr/local/lib ./RIO_ROOT/usr/local/lib
Rust needs an arm linker to compile arm binaries, which can be installed fairly easily. On debian, run the following:
sudo apt install gcc-arm-linux-gnueabi
Once you have the required tools, running the script below should compile and build the wheels.
# Add RIO's target triple
rustup target add arm-unknown-linux-gnueabi
# Set cross-compilation environment variables
export PYO3_CROSS_PYTHON_VERSION=3.10
export PYO3_CROSS_LIB_DIR="RIO_ROOT/usr/local/lib"
# Build wheels for RIO
maturin build --target=arm-unknown-linux-gnueabi --rustc-extra-args="-C linker=arm-linux-gnueabi-gcc"