Try to clean ELF header from generated executable when compiling for Android #11912
Replies: 5 comments
|
@fabriciopashaj - can you provide a minimal project or some source code that I can run in |
|
Of course. apt update && apt upgrade
apt install git clang termux-elf-cleanerIf you create a, i.e. C file named main.c with the contents below int main() {
return 0;
}and then you do: cc main.c -o main
./mainIt will print termux-elf-cleaner main
./mainNothing will be printed. To build V do this: git clone https://github.com/vlang/v
cd v
make
./v symlinkAnd then you have it. |
Thanks @fabriciopashaj |
|
@medvednikov @spytheman @spaceface777 - I can probably fix this relatively easy. I'm a little unsure if this is even V's job in the first place? Cleaning up after specific compiler executables with thirdparty tools if detected? What do you think? What's the general stance on this? |
|
The main issue is that it's annoying, especially when using the repl. For each line that is evaluated, the warning is printed and the terminal becomes polluted. Maybe add an option like |
Uh oh!
There was an error while loading. Please reload this page.
When the C compiler generates an executable on/for Android, the executable includes what is called an ELF header, and everytime you run it, it will always prints this
When compiling C, you can clean the ELF header using the Makefile, but V has its own build system and strategy.
If the compilation is happening inside an Android device and the
termux-elf-cleanercommand is detected, run that with the path of the executable as the first argument. You can detect if the device is Android by check if one of the environment variablesANDROID_DATAorANDROID_PATHare set.All reactions