This is a cache of https://discuss.96boards.org/t/compile-on-device-no-gcc-on-linux-image-rootfs-from-buildroot/9940. It is a snapshot of the page at 2024-10-31T02:02:47.159+0000.
Compile on device? no <strong>gcc</strong> on linux image/rootfs from buildroot - TB-96AIoT - 96Boards Forum

Compile on device? no gcc on linux image/rootfs from buildroot

I just followed the steps here to build a new linux image: Build Buildroot Linux Source for TB-96AIoT - 96Boards

My new linux image was successfully installed on my rk1808, but I’d like to be able to have gcc/g++ on the rk1808 to be able to compile code on the device. Is this possible? gcc is not installed by default, and I tried doing a ‘make menuconfig’ from the repo root directory, but could not find anything that would allow me to install gcc or g++.

Any ideas?

Can not support compile code on the device.

I believe you can install a debian buster rootfs and chroot into it. Then you’ll be able to install any debian package. I did it a while ago for another aarch64 platform. From my memory here is how you can do it:

  • From a PC, docker pull a debian image. For example, the tag debian:buster-20200720-slim for linux/arm64/v8. Save the image into a tar file. Untar and find the layer.tar file. This is the rootfs directory.
  • Place the tar on target. Untar.
  • Bind mount /dev, /proc, /sys, /tmp, /var, maybe /dev/pts and other directories. Chroot into the rootfs with bash as the shell.
  • Run apt-get update, then you are ready to install any packages.

You can use gcc to build in the chroot. Or you can copy the installed libraries and binaries to the host, that will be trickier.