1

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.

2
  • Thanks for mention me @jsotola Commented May 2 at 13:57
  • Is my post now verified? @jsotola Commented May 3 at 2:32

1 Answer 1

0

So I tried to run on pi 4 32-bit,... and it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.