I was testing some c++ executable in my old smartphone (Android 8, no root). Here's the description of the problem:

I have both Termux and Cxxdroid installed in that phone. And in termux, I have clang installed.

Let's enter Termux.

cd /storage/emulated/0/c++    # current dir is now c++ which sits in the internal storage
ls    # this prints 'hello.cpp', a simple hello world program. let's compile it.
clang++ hello.cxx -o hello
ls    # this prints two files now, hello and hello.cxx. let's execute hello.
./hello    # prints: bash: ./hello: Permission denied. let's grant permission.
chmod +x hello
./hello    # prints: bash: ./hello: Permission denied

As you can see, there's no way I can execute hello in the c++ directory. I know that if I move hello in $HOME and run it, it would work right away. But that's not the case.

Now, let's enter Cxxdroid. Enter 'Terminal' from left menu. Let's execute our hello binary.

cd /storage/emulated/0/c++
ls    # contains two files. hello.cxx and hello (which is the binary generated from Termux clang). let's run it.
./hello    # prints 'Hello World'

See? The same binary does not run in Termux but runs right away in Cxxdroid. Why? What technique is Cxxdroid using under the hood? Permission of the hello binary for both Termux and Cxxdroid is:

ls -l hello    # prints: -rw-rw---- 1 root everybody 115588 Apr 25 00:32 hello

Any help is appreciated.

  • "What technique is Cxxdroid using under the hood?" You can ask the developer directly. But files in emulated storage aren't executable. That's the expected behavior. See my answers to android.stackexchange.com/a/217356/218526 and android.stackexchange.com/a/208927/218526 Commented Apr 24, 2021 at 19:53
  • @Irfan Latif Thanks for the suggestions. But, do you know any way to grant execute permission in emulated filesystem without root?
    – SuperNoob
    Commented Apr 24, 2021 at 20:05
  • No you can't, even with root. It's a limitation of the filesystem. That's how Android's storage is designed. Read my answers for details. Commented Apr 24, 2021 at 20:17
  • You can find out yourself. Implement a hello world program that in the end waits for user input, then check via ps what processes are running and where they are located. I would assume that Cxxdroid simply copies the files to be execute to the internal storage where execution is allowed. Or is has a loader wrapper that allows to execute the wrapper which then loads the file to be executed that replaces all the process RAM.
    – Robert
    Commented Apr 25, 2021 at 11:18

1 Answer 1


You need to root access. without root you can try this

cp /storage/emulated/0/c++/hello $HOME
chmod +x $HOME/hello

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .