I am struggling in trying to cross compile C program using wiringpi library in the ubuntu host, then transfer it to raspberry pi 4. My instruction used old version of wiringpi, which is not available to be downloaded, and it still helps me a lot. But when I try to run it on pi 4, it can not execute. I am using the code example from github WiringPi.
#include "stdio.h" #include "wiringPi.h"#define LED 0
int main (void)
{ wiringPiSetup () ; pinMode (LED, OUTPUT) ;
for(;;) { digitalWrite (LED, HIGH) ; // On delay (500) ; // mS digitalWrite (LED, LOW) ; // Off delay (500) ; } return 0; }
I compile this program by using:
arm-linux-gnueabihf-gcc blink.c -o blink -lwiringPi
Then, i scp it to raspberry pi 4 to run it there and the error popped up.
bash: ./name: cannot execute: required file note found
Can someone help me to figure out what I have done wrong. More thing to say, I can compile it normally by gcc in host and run in pi 4. Also, I run cross-compile using aarch64-linux-gnu in pi 4 successfully.