Can't run aarch64 compiled binary on aarch64 android (rooted) device





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















I compiled a binary on an aarch64 server & am trying to run it on a Android device that's aarch64 architecture.



I ran readelf -a on the program 'cat' (left side) & ran the same command on my program (right side)



Any ideas why I get this error when trying to run the binary on the device:



:/data/local # ls -lh
total 48M
-rwxrwxrwx 1 root root 1.4M 2018-11-16 10:42 example-app
-rw-rw-rw- 1 root root 47M 2018-11-14 18:03 mnist-traced.pt
drwxrwx--x 3 shell shell 4.0K 2018-11-05 16:58 tmp
:/data/local # ./example-app mnist-traced.pt
/system/bin/sh: ./example-app: No such file or directory



Binary is chmod'd to 751, Android device is rooted, binary runs fine on arm64 server.



enter image description here



Android device info:



# uname -a
Linux localhost 3.18.35 #4 SMP PREEMPT Thu May 17 18:24:00 CST 2018 aarch64



objdump



root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./example-app

./example-app: file format elf64-littleaarch64

Contents of section .interp:
400238 2f6c6962 2f6c642d 6c696e75 782d6161 /lib/ld-linux-aa
400248 72636836 342e736f 2e3100 rch64.so.1.


root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./cat


./cat: file format elf64-littleaarch64 (Android device program)

Contents of section .interp:
0238 2f737973 74656d2f 62696e2f 6c696e6b /system/bin/link
0248 65723634 00 er64.









share|improve this question

























  • Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

    – Onik
    Nov 16 '18 at 19:43













  • Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

    – Suhail Doshi
    Nov 16 '18 at 19:46











  • Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

    – jww
    Nov 17 '18 at 3:40











  • does /lib/ld-linux-aarch64.so.1 exist on android devices?

    – Martin Keßler
    Nov 23 '18 at 17:46











  • as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

    – Martin Keßler
    Nov 23 '18 at 17:56




















2















I compiled a binary on an aarch64 server & am trying to run it on a Android device that's aarch64 architecture.



I ran readelf -a on the program 'cat' (left side) & ran the same command on my program (right side)



Any ideas why I get this error when trying to run the binary on the device:



:/data/local # ls -lh
total 48M
-rwxrwxrwx 1 root root 1.4M 2018-11-16 10:42 example-app
-rw-rw-rw- 1 root root 47M 2018-11-14 18:03 mnist-traced.pt
drwxrwx--x 3 shell shell 4.0K 2018-11-05 16:58 tmp
:/data/local # ./example-app mnist-traced.pt
/system/bin/sh: ./example-app: No such file or directory



Binary is chmod'd to 751, Android device is rooted, binary runs fine on arm64 server.



enter image description here



Android device info:



# uname -a
Linux localhost 3.18.35 #4 SMP PREEMPT Thu May 17 18:24:00 CST 2018 aarch64



objdump



root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./example-app

./example-app: file format elf64-littleaarch64

Contents of section .interp:
400238 2f6c6962 2f6c642d 6c696e75 782d6161 /lib/ld-linux-aa
400248 72636836 342e736f 2e3100 rch64.so.1.


root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./cat


./cat: file format elf64-littleaarch64 (Android device program)

Contents of section .interp:
0238 2f737973 74656d2f 62696e2f 6c696e6b /system/bin/link
0248 65723634 00 er64.









share|improve this question

























  • Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

    – Onik
    Nov 16 '18 at 19:43













  • Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

    – Suhail Doshi
    Nov 16 '18 at 19:46











  • Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

    – jww
    Nov 17 '18 at 3:40











  • does /lib/ld-linux-aarch64.so.1 exist on android devices?

    – Martin Keßler
    Nov 23 '18 at 17:46











  • as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

    – Martin Keßler
    Nov 23 '18 at 17:56
















2












2








2








I compiled a binary on an aarch64 server & am trying to run it on a Android device that's aarch64 architecture.



I ran readelf -a on the program 'cat' (left side) & ran the same command on my program (right side)



Any ideas why I get this error when trying to run the binary on the device:



:/data/local # ls -lh
total 48M
-rwxrwxrwx 1 root root 1.4M 2018-11-16 10:42 example-app
-rw-rw-rw- 1 root root 47M 2018-11-14 18:03 mnist-traced.pt
drwxrwx--x 3 shell shell 4.0K 2018-11-05 16:58 tmp
:/data/local # ./example-app mnist-traced.pt
/system/bin/sh: ./example-app: No such file or directory



Binary is chmod'd to 751, Android device is rooted, binary runs fine on arm64 server.



enter image description here



Android device info:



# uname -a
Linux localhost 3.18.35 #4 SMP PREEMPT Thu May 17 18:24:00 CST 2018 aarch64



objdump



root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./example-app

./example-app: file format elf64-littleaarch64

Contents of section .interp:
400238 2f6c6962 2f6c642d 6c696e75 782d6161 /lib/ld-linux-aa
400248 72636836 342e736f 2e3100 rch64.so.1.


root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./cat


./cat: file format elf64-littleaarch64 (Android device program)

Contents of section .interp:
0238 2f737973 74656d2f 62696e2f 6c696e6b /system/bin/link
0248 65723634 00 er64.









share|improve this question
















I compiled a binary on an aarch64 server & am trying to run it on a Android device that's aarch64 architecture.



I ran readelf -a on the program 'cat' (left side) & ran the same command on my program (right side)



Any ideas why I get this error when trying to run the binary on the device:



:/data/local # ls -lh
total 48M
-rwxrwxrwx 1 root root 1.4M 2018-11-16 10:42 example-app
-rw-rw-rw- 1 root root 47M 2018-11-14 18:03 mnist-traced.pt
drwxrwx--x 3 shell shell 4.0K 2018-11-05 16:58 tmp
:/data/local # ./example-app mnist-traced.pt
/system/bin/sh: ./example-app: No such file or directory



Binary is chmod'd to 751, Android device is rooted, binary runs fine on arm64 server.



enter image description here



Android device info:



# uname -a
Linux localhost 3.18.35 #4 SMP PREEMPT Thu May 17 18:24:00 CST 2018 aarch64



objdump



root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./example-app

./example-app: file format elf64-littleaarch64

Contents of section .interp:
400238 2f6c6962 2f6c642d 6c696e75 782d6161 /lib/ld-linux-aa
400248 72636836 342e736f 2e3100 rch64.so.1.


root@scw-ac272c:~/mnist-torch/build# objdump -j .interp -s ./cat


./cat: file format elf64-littleaarch64 (Android device program)

Contents of section .interp:
0238 2f737973 74656d2f 62696e2f 6c696e6b /system/bin/link
0248 65723634 00 er64.






android linux arm arm64






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 20:00







Suhail Doshi

















asked Nov 16 '18 at 19:40









Suhail DoshiSuhail Doshi

415




415













  • Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

    – Onik
    Nov 16 '18 at 19:43













  • Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

    – Suhail Doshi
    Nov 16 '18 at 19:46











  • Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

    – jww
    Nov 17 '18 at 3:40











  • does /lib/ld-linux-aarch64.so.1 exist on android devices?

    – Martin Keßler
    Nov 23 '18 at 17:46











  • as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

    – Martin Keßler
    Nov 23 '18 at 17:56





















  • Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

    – Onik
    Nov 16 '18 at 19:43













  • Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

    – Suhail Doshi
    Nov 16 '18 at 19:46











  • Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

    – jww
    Nov 17 '18 at 3:40











  • does /lib/ld-linux-aarch64.so.1 exist on android devices?

    – Martin Keßler
    Nov 23 '18 at 17:46











  • as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

    – Martin Keßler
    Nov 23 '18 at 17:56



















Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

– Onik
Nov 16 '18 at 19:43







Try moving the binary to /data/local/tmp instead. If won't help you might consider (if applicable) compiling it with NDK

– Onik
Nov 16 '18 at 19:43















Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

– Suhail Doshi
Nov 16 '18 at 19:46





Same problem: :/data/local/tmp # ./example-app mnist-traced.pt /system/bin/sh: ./example-app: No such file or directory

– Suhail Doshi
Nov 16 '18 at 19:46













Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

– jww
Nov 17 '18 at 3:40





Please show the code and/or state the errors. The text on the picture is too small for some people to read. In addition, the text on the image cannot be indexed by search engines for future visitors.

– jww
Nov 17 '18 at 3:40













does /lib/ld-linux-aarch64.so.1 exist on android devices?

– Martin Keßler
Nov 23 '18 at 17:46





does /lib/ld-linux-aarch64.so.1 exist on android devices?

– Martin Keßler
Nov 23 '18 at 17:46













as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

– Martin Keßler
Nov 23 '18 at 17:56







as shown in your output above, it is the linker ("interpreter") that is defined for your "example-app" binary. the android OS uses a complete different set of system components (e.g. /system/bin/linker64 instead of /lib/ld-linux-aarch64.so.1 as the linker binaries that use shared libraries) you could try compiling your program statically (add -static to invocation of GCC), so no run time linker would be needed. gcc -Wall -O2 -s -static foo.c

– Martin Keßler
Nov 23 '18 at 17:56














0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53344338%2fcant-run-aarch64-compiled-binary-on-aarch64-android-rooted-device%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53344338%2fcant-run-aarch64-compiled-binary-on-aarch64-android-rooted-device%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine