I am trying to build a simple "hello_there" Ada app to run on a Raspberry Pi 2/Raspbian machine but have come across a linkage issue.
So far, I've done the following and had the following issues:
Downloaded the "Raspberry Pi 2 Linux" GNAT GPL Ada toolchain for cross compiling (linux-on-linux) on the host machine (Ubuntu 16.04)
Ran "doinstall" on the host machine successfully.
Created a simple "hello_there.adb" file which just prints a message to the console.
Ran {INSTALL_ROOT}/gnat-gpl-2016-raspberrypi-linux-linux-bin/bin/arm-linux-gnueabihf-gnatmake -v hello_there.adb to build this small app.
That complained that the crt1.o | crti.o | crtn.o files cannot be found and since I couldn't use the ones under /usr/lib/x86_64-linux-gnu/ on the host machine (as I assume, these can only be used for a x86 target) the only solution I could find was to copy these files from the target machine which are located under /usr/lib/arm-linux-gnueabihf to the gnatmake command dir. That stopped the linker complaining about these.
Ran again {INSTALL_ROOT}/gnat-gpl-2016-raspberrypi-linux-linux-bin/bin/arm-linux-gnueabihf-gnatmake -v hello_there.adb but now the linker is complaining with the following error:
{INSTALL_ROOT}/gnat-gpl-2016-raspberrypi-linux-linux-bin/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.4/ld: cannot find -lc
It looks like compilation and binding complete fine but but linking fails. The full output is the following:
GNATMAKE GPL 2016 (20160515-49) Copyright (C) 1992-2016, Free Software Foundation, Inc. "hello_there.ali" being checked ... -> "hello_there.ali" missing. arm-linux-gnueabihf-gcc -c hello_there.adb End of compilation arm-linux-gnueabihf-gnatbind -x hello_there.ali arm-linux-gnueabihf-gnatlink hello_there.ali /home/savvas/opt/GNAT/gnat-gpl-2016-raspberrypi-linux-linux-bin/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.4/ld: cannot find -lc collect2: error: ld returned 1 exit status arm-linux-gnueabihf-gnatlink: error when calling /home/savvas/opt/GNAT/gnat-gpl-2016-raspberrypi-linux-linux-bin/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gnatmake: *** link failed.
Is the linker looking for a clib (or some other filename?) file somewhere in the library path or is there something else going on? I'm new to gcc compilation/linking and am trying to make sense of this.
Any pointers, much appreciated.
Thanks