Impossible to run a.out file through Android terminal - c

I compiled and linked a file on Android (ARM). I have got a a.out file and iwant to execute it on Android (ARM) using android terminal via the command (./). It's written "operation not permitted". I even try "chmod" but it's the same thing.
How can I fix it?

I have found it. The problem is that we can not execute .out file on Android sdcard. So, as i am using an Android terminal emulator called Termux, i copied the a.out file in the Termux home directory or a subdirectory called "Storage" via the command line "cp". In these two directories, i successfully execute the a.out file.
On Sdcard, "a.out" file only have "read" and "write" properties, not, "execute".

Related

gcc won't compile to executable in shared folder

I have dual boot windows - ubuntu on my laptop. I wanted to have a shared partition for my documents so I created a fat partition with my files and mounted it on ubuntu.
The problem is the following:
I tried to create a simple "helloworld" program in C language (I named the file test.c). When the file is in ~/Documents I can compile and run it as expected. When I move test.c in shared directory, a.out file is created but it is not executable. If I chmod +x ./a.out, then the output is ./a.out: command not found.
Any idea?
The possible reason may be c language is not platform independent. So code written in one os won't be accessible from other os. As the folder is shared by two os this problem may have raised.

Not able to execute the .exe file generated from GCC compiler

I am working on creating a system in C language and I have installed GCC compiler via MinGW Installer. After this, I created a basic Hello World program to check if the compiler is working properly. I compiled my code using the command gcc hello.c -o hello and then tried to run the executable file thus created by typing hello into the command prompt. But the system is not running my .exe file and giving an error - The system cannot execute the specified program.
I repeated the whole process on my second system, step by step, and I was able to see the output for the same program on the command prompt without any error.
I am not able to understand the exact reason behind this but I suspect it has something to do with the permission to execute a .exe file.
Open your .exe file with Dependancy Walker (https://www.dependencywalker.com/). It will tell you if there is something wrong with the file.
Also you should be able to see there if it's 32-bit or 64-bit. In case of 64-bit it won't run on your system if you're on a 32-bit Windows.
You could also try with MinGW-w64 built from http://winlibs.com/ (try the 32-bit version first) and follow the hello world instructions on that site.

lld-link.exe: error: failed to open a.exe: permission denied on windows 10

i'm using lld-link to create a .exe file from a obj file but this happen:
I already searched for this error, the common answer was that a.exe was executed and that I have to close it , but I already search for it in the process explorer and there is no a.exe running. I also read that my anti-malware could be the problem so I turned it off but that didn't work as well.
You're trying to write a.exe into C:\Program Files\LLVM\bin. Either cd to your code directory before linking, or specify an absolute path for a.exe to be saved to in the -out:a.exe part of the command.

Gdbserver for Snow Leopard?

So I have this source gdb-1515. I'm using Xcode 3.2.6 command line tools on Snow Leopard (and this gdb source is the source of the gdb included in them).
Trying to run (inside /private/var/root/Downloads/gdb-1515/src/gdb/gdbserver):
gcc -I. -I. -I./../regformats -I./../macosx -I./../../include -I../../bfd -I./../../bfd -I/private/var/root/Downloads/gdb-1515/src/bfd ./../macosx/macosx-nat.c
Fails with:
./../macosx/macosx-nat.c:34:17: error: bfd.h: No such file or directory
./../macosx/macosx-nat.c:35:18: error: defs.h: No such file or directory
./../macosx/macosx-nat.c:36:21: error: gdbcore.h: No such file or directory
./../macosx/macosx-nat.c:37:20: error: serial.h: No such file or directory
./../macosx/macosx-nat.c:38:22: error: ser-base.h: No such file or directory
./../macosx/macosx-nat.c:39:22: error: ser-unix.h: No such file or directory
./../macosx/macosx-nat.c:40:22: error: inferior.h: No such file or directory
./../macosx/macosx-nat.c:41:23: error: objc-lang.h: No such file or directory
./../macosx/macosx-nat.c:42:21: error: infcall.h: No such file or directory
In file included from ./../macosx/macosx-nat-dyld.h:5,
Etc.
Thing is there is no bfd.h anywhere inside the gdb-1515 folder.
find /private/var/root/Downloads/gdb-1515 -name bfd.h
Returns no output.
I want to call attach_to_classic_process (defined inside macosx/macosx-nat.c) from gdbserver/macosx_low.c:476 instead of ptrace - that's why I'm trying to build macosx/macosx-nat.c from the gdbserver directory.
Currently at its place it's used ptrace which fails for rosetta processes.
Ok so I want to debug a classic (Rosetta) process running on Snow Leopard by using remote gdb connection.
It should be obvious cause after all Rosetta applications are using remote connection for debugging anyway.
Additionally gdb application can successfully connect with mentioned PowerPC applications.
I'm trying to compile gdbserver from this apple source however this is Aids - it seems that the way gdbserver included in this packages is fundamentally wrong since the original gdb is using special functions to establish connection to classic process while gdbserver is trying to use ptrace which obviously fails.
Another thing that comes into my mind is why the hell gdbserver has to be so retardedly complicated - why isn't directly co-operating with the functional gdb command line application (maybe a wrapper of sorts)?

Help with C Program Executable - Linux

I just recently made the move to Linux, and now looking to program on it as well.
However, for some reason I cannot get an executable to work.
Here's what I've done:
Downloaded Code::Blocks
Made a new Console Project in Workspace 1 with C source.
Added a getchar() before return(0);
Ran and Compiled - Which works perfectly INSIDE Code::Blocks
Went to the bin/release folder in which the file is saved, tried double clicking, right clicking and selecting: open, open with, tried using terminal to run the name of my program. I copied the folder URL, and then name of the file.. I just can't seem to get the created file to execute!
In windows it made a .exe, I know there is no ending (?) in linux. (Could be wrong).
I'm currently running Ubuntu 11.04.
Most Linux distributions don't include the current directory in the PATH variable that determines where to search for executables. Try opening a terminal, changing to the bin/release directory and explicitly qualifying your executable for the current directory:
./myprogram
This is in contrast to Windows, where you can simply type "myprogram.exe".
You might need to grant your program permission to run as an executable:
sudo chmod +x yourProgram
In the terminal emulator, go to (cd) the folder where the executable is created.
Type ./programname
Where programname is the name of the executable file
(./ tells the shell to look in the current directory for the program to run)

Resources