UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer tejaallani
Observer
768 Views
Registered: ‎05-08-2018

Unable to run simple c program in petalinux 2016.4

Jump to solution

Hi,

 

    I have built the petalinux 2016.4 kernel successfully and am able to boot correctly through SD card. I tried to write simple hello world program and cross compile it with gcc linaro. I copied the program to SD card and tried to execute it using

 

./hello

 

I get error message

 

-sh hello: no such file or directory

 

I am thinking something is wrong with my file format as it is not being recognized as executable. Is this issue with my kernel build settings or is it cross compiling issue?

 

0 Kudos
1 Solution

Accepted Solutions
Observer tejaallani
Observer
842 Views
Registered: ‎05-08-2018

Re: Unable to run simple c program in petalinux 2016.4

Jump to solution

I apologize, the question is not in detail as I was in a hurry. The program was not in root directory. I copied it to /root/home through scp.

 

    However, I found out the problem, this was due to linker. The program was looking for ld-linux.so.2 . I have seen that this linker was old version and new version is  ld-linux-armhf.so.3 which is present in /lib . I have created a symbolic link named ld-linux.so.2 to ld-linux-armhf.so.3 and the program is executing.

View solution in original post

0 Kudos
2 Replies
721 Views
Registered: ‎04-20-2017

Re: Unable to run simple c program in petalinux 2016.4

Jump to solution
. /hello looks for your program in the root directory of Linux...

If you want to launch it from SD card you need to mount it first into Linux Filesystem with mount /dev/mmblkXxx /targetpath

Another way, so your pre-built application gets directly built into rootfs of Linux with petalinux-build is to follow the steps described in the petalinux reference manual under the section '' adding pre-built apps''

For development purposes its probably best to use sdk, it deploys your app automatically to your target Plattform in a non persistent way and let you debug it
Observer tejaallani
Observer
843 Views
Registered: ‎05-08-2018

Re: Unable to run simple c program in petalinux 2016.4

Jump to solution

I apologize, the question is not in detail as I was in a hurry. The program was not in root directory. I copied it to /root/home through scp.

 

    However, I found out the problem, this was due to linker. The program was looking for ld-linux.so.2 . I have seen that this linker was old version and new version is  ld-linux-armhf.so.3 which is present in /lib . I have created a symbolic link named ld-linux.so.2 to ld-linux-armhf.so.3 and the program is executing.

View solution in original post

0 Kudos