1

I am developing a cross-platform library, and am trying to test on Android. I have compiled my library with ndk-build, and am trying to compile and run a command-line test fixture we have for the library.

I use adb push to put the test fixture and .so in /data/local/tmp and chmod both to 777.

Then I use adb shell to run the test, but get the following error

shell@android:/data/local/tmp $ ./mytest
./mytest
link_image[1936]:  7289 could not load needed library 'libtconfig.so' for './mytest' (load_library[1091]: Library 'libtconfig.so' not found)CANNOT LINK EXECUTABLE

Both mytest executable and libtconfig.so are in the same directory. I would have assumed it looks in "." directory first?

yano
  • 4,095
  • 3
  • 35
  • 68

1 Answers1

1

I found I can add the path /data/local/tmp to LD_LIBRARY_PATH and it will work, however when using adb shell commands in a script, each "adb shell" is a new instance, so LD_LIBRARY_PATH is reset

yano
  • 4,095
  • 3
  • 35
  • 68
  • 1
    Yes, this is all exactly as expected. As a general unixism, the current directory is usually not on either the executable or library search paths, because having it there lets someone set traps for other users by leaving malicious code with the same name as system commands/libraries in directories which users might visit. – Chris Stratton Jan 09 '13 at 22:13