-/Bin/sh: Command: not found

Source: Internet
Author: User

Original article: http://blog.chinaunix.net/uid-20539088-id-115759.html

On mini2440-/bin/sh: Command: Not found Solution

I transplanted the Linux kernel and the file system according to the mini-2440 porting manual. What's different is that the cross compiler I use is the latest 4.4.1, instead of the Cross Compiler provided by tianyinao technology, when I have transplanted the yaffs file system and want to write a helloworld program to test it on the Development Board, I put the compiled helloworld file under the/usr/bin directory of the yaffs file system, however, when I run the/usr/bin/helloworld command, the message "-/bin/sh:/usr/bin/helloworld: Not Found" appears ", at first, I thought that helloworld didn't have the running permission, but I gave it the running permission and still prompted the same error. I found the cause on the Internet: only the prompt "-/bin/sh:
/Usr/bin/helloworld: Not found ", because I did not copy the library files required by helloworld. Then how can we know which library files are needed for helloworld? In this way, enter the arm-Linux-readelf-A helloworld command in the command line and find program headers in the output content: here is the library file required for helloworld (for readelf, refer to here Reader Note: ($ arm-Linux-readelf-A helloworld | grep-A 20 "program headers") Use this command to locate the problem faster. Grep-A 20 indicates printing the 20 content after the matching row.

It seems that we need the ld-linux.so.3 library, find this library file in your cross compiler and copy it to the/lib directory of our file system. Then, run it on the Development Board and run/usr/bin/helloworld again. The result is "/usr/ bin/helloworld: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: no such file or directory "has an effect. At least not the previous error prompt, which proves that the method is correct, let's take a look at the above error. This time, the required library file is directly prompted. We copied libgcc_s.so.1 to/lib of the file system as prompted, and then run it again, the message "/usr/bin/helloworld:
Error while loading shared libraries: libc. so.6: cannot open shared object file: no such file or directory "is still a small library file. We copied this file to/lib of the file system. This is the final operation, finally, we can see "Hello World ".
Reference:

========================================== ==========================================

I encountered this problem, but I remember that the required library files and connectors have been copied before, but the same problem is still prompted.

Later I found that I copied the library files and connectors in 3.4.5 (Wei Dongshan), while some of my later character device testing programs were compiled using 4.4.3 (mini2440, they compile different dependent libraries, so .....

I re-compiled the test program with the compiler of version 3.4.5 and then succeeded.

Note: the path of my own cross-compilation tool is defined in the/etc/profile file. After modification, enter the command: $ source/etc/profile to make the change take effect immediately for the current shell, note that it is the current shell. If you haven't experienced a restart after the change, you need to open a shell each time to make the source take effect. note this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.