Skip to content

Instantly share code, notes, and snippets.

@loyd
Created January 4, 2015 20:50
Show Gist options
  • Select an option

  • Save loyd/185c8fa9b34d3dc5e143 to your computer and use it in GitHub Desktop.

Select an option

Save loyd/185c8fa9b34d3dc5e143 to your computer and use it in GitHub Desktop.
Workaround for cross compiling with rust (rustc, cargo, etc.).
#!/bin/sh
RUST=~/builds/pi-rust
TOOLCHAIN=~/builds/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
LINKER=arm-linux-gnueabihf-gcc
# Rust uses `cc` as linker.
if [ ! -f "$TOOLCHAIN/bin/cc" ]; then
ln -s "$LINKER" "$TOOLCHAIN/bin/cc"
fi
# Usage.
if [ $# -eq 0 ]; then
echo "Usage:"
echo " $(basename $0) cargo ..."
for i in $(ls "$RUST/bin"); do
echo " $(basename $0) $i ..."
done
exit 1;
fi
export LD_LIBRARY_PATH="$RUST/lib:$LD_LIBRARY_PATH"
export PATH="$TOOLCHAIN/bin:$RUST/bin:$PATH"
"$@" --target=arm-unknown-linux-gnueabihf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment