Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created the following symbolic link:

Source: /usr/local/android-ndk-r5/ndk-build
Destination: /usr/local/bin/ndk-build

However, when I attempt to use ndk-build from my source directory, it fails because it can't find files that the script depends on in the source directory.

How can I get the symbolic link to use the source directory as the working directory?

share|improve this question
up vote 3 down vote accepted

You can't, you need to make a wrapper script.

Assuming that the program relies on the filename for determining the script (likely):

/usr/local/android-ndk-r5/ndk-build "$@"

Assuming that the program relies on the current working directory (unlikely):

cd /usr/local/android-ndk-r5
./ndk-build "#@"

Save one of these files in /usr/local/bin/ndk-build and make it executable:

sudo editor /usr/local/bin/ndk-build
sudo chmod 755 /usr/local/bin/ndk-build
share|improve this answer
FYI, it was the first option. Thanks a bunch :) – Mark Ingram Jul 4 '11 at 19:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.