Issue
I have a couple of libraries built by the NDK for which I am trying to view the exported symbols, the available function names to be precise. One is a .so file and the other a .a file. I was helped in this question (How to obtain readelf and objdump binaries for OS X?) to find the utilities that I think I need. They are specific to the NDK installation. I am on OS X fyi.
In my NDK installation I found nm and objdump in prebuilt/darwin-x86_64/arm-linux-androideabi/bin. Their file type is "Alias". When I ran nm -g libMylib.so
nothing happened -- at all. When I ran objdump -TC libMylib.so
I got: "objdump: command not found"
. Then I found the arm-linux-androideabi-nm and arm-linux-androideabi-objdump files (file type listed as "Unix Executable File" in Finder) in the prebuilt/darwin-x86_64/bin dir. The attempt to use both of them resulted in "command not found". In all these attempts I placed libMylib.so right in the very folder with the utility I'm trying to run.
Solution
I think this is basically a general issue about how to call binaries in unix; even if you are in the same directory when you run nm -g libMylib.so
, since .
normally isn't part of your $PATH
. To run the right one, do ./nm -g libMylib.so
, or without using cd
to enter this directory first, just do path/to/your/NDK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm -g libMylib.so
, or add this directory to your path first:
export PATH=path/to/your/NDK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$PATH
arm-linux-androideabi-nm -g libMylib.so
(It's preferrable to add this directory to the path instead of the arm-linux-androideabi
directory, since it is clear which tool you want to invoke when you call when you do arm-linux-androideabi-nm
, while if you add the other directory and call nm
, it is up to the order of the directories in $PATH
.)
See e.g. Why do you need ./ (dot-slash) before script name to run it in bash? for more explanations about $PATH
.
Answered By - mstorsjo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.