Problems running a simple program...

Bill Zimmerly
I'm very confused about running a program on the Mini2440. Here are the
steps I followed:

1. I created a simple ARM Linux program with arm-linux-gcc called "cloud."

2. I copied it to the Mini2440's /usr/bin directory with ftp.

3. I ran chmod on the file to make it executable.

4. I can find it with "which" but when I try to execute it...

        [root@FriendlyARM /]# which cloud
        /usr/bin/cloud
        [root@FriendlyARM /]# cloud
        -/bin/sh: cloud: not found
        [root@FriendlyARM /]# ls -l /usr/bin/cloud
        -rwxr-xr-x  1 root   root  9852 Oct  7 03:56 /usr/bin/cloud
        [root@FriendlyARM /]# 

I don't know what to do next ... please help!
- Bill

open-nandra
try echo $PATH if /usr/bin isn't there then you need to run your program
/usr/bin/cloud or add /usr/bin to $PATH variable.

themadmax
./cloud
And verfify if you use binary ftp file transfert.

Fabien
If he can find it with which then it's already in PATH...

try to type directly /usr/bin/cloud and see what happens.
as said above, check the ftp transfer mode.

Bill Zimmerly
Thanks for the replies!

No, the shell returns the same error whether I try ./cloud or
/usr/bin/cloud ... I did notice (when Googling) that there are others who
have a similar problem but nobody seems to know why. sigh. :(

http://www.google.com/search?hl=en&q=Mini2440+%22-%2Fbin%2Fsh%3A%22+...=

Bill Zimmerly
Oh, and yes - it was transfered with ftp's binary mode. (Good thinking on
it guys...)

Bill Zimmerly
Progress!!!

I thought that the problem might be related to libraries that the program
wants to dynamically load and now know I was correct.

I didn't have an "ldd" for arm programs, but I did use this to see what
libraries are expected:

        $ strings cloud | less

...and then checked to see what libraries are missing. I found two of them
that were missing, so I ftp'd them in and now here is what I get on the
Mini2440:

        [root@FriendlyARM /]# cloud
        Segmentation fault

...now THIS I can deal with.  ;)

I guess the conclusion is, if an executable is "not found" but "which"
tells you that it is - then their are likely missing shared objects
(dynamic libraries).

Thanks again for the help guys!

Bill Zimmerly
Ooops - "their" should have been "there."

Erik (ailike)
You can use the following ldd script to see the required libraries:

#!/bin/sh

deplist()
{
        echo $@
        LD_TRACE_LOADED_OBJECTS=1 $@
}

case "$1" in
        --version | --help)
                echo "Erik's dependency lister"
                echo "Invoke as $0 <binary>"
                exit 0
        ;;
        -*)
                echo "$0 unrecognized option"
        ;;
        *)
                 deplist $1 
        ;;
esac