- gcc arm executable «no such file orr directory», wrong dynamic lib
- G++/GCC installed but still: error trying to exec ‘cc1plus’: execvp: No such file or directory
- cross compilation for ARM: error no such file or directory/command not found
- How to fix the error “gcc no such file or directory”
- Resolve the problem “gcc no such file or directory”?
- Reason: Missing GCC
- Solution: Install the GCC
- Method 1: Using apt
- Method 2: Using build essentials
- Conclusion
gcc arm executable «no such file orr directory», wrong dynamic lib
I am trying to make a usable setup for gcc-linaro-arm-linux-gnueabihf-4.8-2013.11 on windows. Something happens at dynamic link:
$(CC)-gcc -o test main.c -Wall -lc
The program compiles fine, but when deployed to ARM shows: «No such file or directory» Searching the issue, seems that static build works but executable is huge:
$(CC)-gcc -static -o test main.c -Wall -lc
Now I have a VisualGDB toolchain installed that builds (in IDE) with it’s own toolchain a similar executable (small, dynamic) that works so I guess this is nothing wrong with my ARM distribution. Am I missing something or wrong include from gcc-linaro-arm-linux-gnueabihf-4.8-2013.11 ? Thanks very much in advance, One more investigation:
file test working (compiled with VisualGDB toolchain) test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped mot working (compiled with gcc-linaro-arm-linux-gnueabihf-4.8-2013.11) test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.1.1, BuildID[sha1]=0x13accf06af902cd8b96d85b8a412e1d7822a302b, not stripped my ARM 3.8.13
Dynamic section at offset 0x474 contains 24 entries: Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libc.so.6] 0x0000000c (INIT) 0x82a0 0x0000000d (FINI) 0x8434 0x00000019 (INIT_ARRAY) 0x10468 0x0000001b (INIT_ARRAYSZ) 4 (bytes) 0x0000001a (FINI_ARRAY) 0x1046c 0x0000001c (FINI_ARRAYSZ) 4 (bytes) 0x00000004 (HASH) 0x8194 0x00000005 (STRTAB) 0x820c 0x00000006 (SYMTAB) 0x81bc 0x0000000a (STRSZ) 65 (bytes) 0x0000000b (SYMENT) 16 (bytes) 0x00000015 (DEBUG) 0x0 0x00000003 (PLTGOT) 0x1055c 0x00000002 (PLTRELSZ) 32 (bytes) 0x00000014 (PLTREL) REL 0x00000017 (JMPREL) 0x8280 0x00000011 (REL) 0x8278 0x00000012 (RELSZ) 8 (bytes) 0x00000013 (RELENT) 8 (bytes) 0x6ffffffe (VERNEED) 0x8258 0x6fffffff (VERNEEDNUM) 1 0x6ffffff0 (VERSYM) 0x824e 0x00000000 (NULL) 0x0
Dynamic section at offset 0x4d0 contains 24 entries: Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libc.so.6] 0x0000000c (INIT) 0x8274 0x0000000d (FINI) 0x8490 0x00000019 (INIT_ARRAY) 0x104c4 0x0000001b (INIT_ARRAYSZ) 4 (bytes) 0x0000001a (FINI_ARRAY) 0x104c8 0x0000001c (FINI_ARRAYSZ) 4 (bytes) 0x00000004 (HASH) 0x8168 0x00000005 (STRTAB) 0x81e0 0x00000006 (SYMTAB) 0x8190 0x0000000a (STRSZ) 65 (bytes) 0x0000000b (SYMENT) 16 (bytes) 0x00000015 (DEBUG) 0x0 0x00000003 (PLTGOT) 0x105b8 0x00000002 (PLTRELSZ) 32 (bytes) 0x00000014 (PLTREL) REL 0x00000017 (JMPREL) 0x8254 0x00000011 (REL) 0x824c 0x00000012 (RELSZ) 8 (bytes) 0x00000013 (RELENT) 8 (bytes) 0x6ffffffe (VERNEED) 0x822c 0x6fffffff (VERNEEDNUM) 1 0x6ffffff0 (VERSYM) 0x8222 0x00000000 (NULL) 0x0
execve("/usr/bin/test", ["test"], [/* 15 vars */]) = 0 brk(0) = 0x17000 uname() = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f8a000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat64(3, ) = 0 mmap2(NULL, 54751, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f57000 close(3) = 0 open("/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0@\321\0\0004\0\0\0". 512) = 512 fstat64(3, ) = 0 mmap2(NULL, 152384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6f31000 mprotect(0xb6f4f000, 28672, PROT_NONE) = 0 mmap2(0xb6f56000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1d) = 0 xb6f56000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\210\177\1\0004\0\0\0". 512) = 512 fstat64(3, ) = 0 mmap2(NULL, 1246600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e00000 mprotect(0xb6f24000, 28672, PROT_NONE) = 0 mmap2(0xb6f2b000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x123) = 0xb6f2b000 mmap2(0xb6f2e000, 9608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb 6f2e000 close(3) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f89000 set_tls(0xb6f896d0, 0xb6f89da8, 0xb6f8c058, 0xb6f896d0, 0xb6f8c058) = 0 mprotect(0xb6f2b000, 8192, PROT_READ) = 0 mprotect(0xb6f8b000, 4096, PROT_READ) = 0 munmap(0xb6f57000, 54751) = 0 brk(0) = 0x17000 brk(0x38000) = 0x38000 close(1) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++
G++/GCC installed but still: error trying to exec ‘cc1plus’: execvp: No such file or directory
Full error message:
arm-linux-gnueabihf-g++: error trying to exec ‘cc1plus’: execvp: No such file or directory So I have got this error message while trying to build a C++ project on my machine shortly after a home directory deletion and recovery on Ubuntu 18.04. I’m doubtful that this is because of something in my environment since I built my program not too long ago with the same settings. After researching the error, I found that pretty much everyone says that it’s because I have either not installed gcc/g++, incorrectly installed gcc/g++, or have a version mismatch between gcc/g++. However this appears to not be my problem:
jayz@joshz:/usr$ gcc --version gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. jayz@joshz:/usr$ g++ --version g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sudo apt-get update sudo apt-get install --reinstall build-essential
jayz@joshz:/usr$ locate cc1plus /home/jayz/raspi/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.9/cc1plus /home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/libexec/gcc/arm-bcm2708-linux-gnueabi/4.7.1/cc1plus /home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/libexec/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/cc1plus /home/jayz/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/4.9.3/cc1plus /home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus /home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
so perhaps it’s a linker issue? One thing that I have noticed is that I have no /usr/local/libexec or /usr/libexec directories but I am not sure if this is a problem or what it might imply.
cross compilation for ARM: error no such file or directory/command not found
I have written simple Hello world program and compiled it with gcc-arm-linux-gnueabi compiler. It compiles well but when i try to execute it on ARM machine it complains «no such file or directory». I think gcc-arm-linux-gnueabi is for embedded Linux only due to e(mbedded)abi. Is it different from ARM Linux ABI? Please help me to solve this problem code is here
#include "stdio.h" int main(void)
When i execute this crosscomp on target ARM machine error is crosscomp no such file or dir EDIT When I was using arm-linux-gnueabi-gcc the entry point was not matching with the target machine entry point (readelf -l crosscom) but when I compiled with aarch64-linux-gnu-gcc entry point matched with target machine. But now error becomes permission denied on ./crosscomp. I tried with sudo which says crosscomp: no such command. Note I posted same question on askubuntu https://askubuntu.com/questions/904685/cross-compilation-for-arm-error-no-such-file-or-directory but got no response. The output of readelf is as below ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: AArch64 Version: 0x1 Entry point address: 0x400470 Start of program headers: 64 (bytes into file) Start of section headers: 4488 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 8 Size of section headers: 64 (bytes) Number of section headers: 29 Section header string table index: 26
How to fix the error “gcc no such file or directory”
The GCC (GNU Compiler Collection) is a standard compiler used in Linux to compile C/C++ programs. With the help of GCC, we can compile the program straight in the terminal. Often times when dealing with GCC, an error can be prompted with the statement “unable to execute gcc no such file or directory”.
This article provides possible reasons that invoke the problem with the statement “gcc no such file or directory”. Furthermore, we have demonstrated the solution as well.
Resolve the problem “gcc no such file or directory”?
There are some diverse reasons that can invoke this error. In this section reasons for the problem will be explained as well as the methods of how to fix it.
Reason: Missing GCC
The first most obvious reason is that your system does not have the gcc installed on it. You can verify the installation of GCC using the following command in your Linux terminal:
If this command returns the following error, this means that gcc is not installed on your system:
Solution: Install the GCC
To fix the issue you simply need to install the GNU compiler collection onto your system. Let’s elaborate on how GCC will be installed. There are two distinct methods through which this can be achieved.
Method 1: Using apt
The simplest way is to use the apt installer to install GCC. Simply run the following command:
The snippet above shows that gcc will successfully be installed using the apt installer.
Method 2: Using build essentials
The second method is to install build-essentials onto your system which will also include the gcc. Run the commands below into the terminal to execute it:
$ sudo apt update $ sudo apt install build-essential
Once you have installed gcc on your system using either of the methods, it can be double-checked using the command mentioned below:
This proves that GCC has now been installed. The process should remove the “gcc no such file or directory” error during an attempt to compile any files.
Conclusion
The “gcc no such file or directory” issue occurs when the gcc is not installed in your system. To install GCC, you can use either the command “sudo apt install gcc” or the alternate command “sudo apt install build-essential” command. Here, you have learned the reason for the error “gcc no such file or directory” and the two methods to fix this error.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY