0

I was following a tutorial on how to find out the dependent libraries of a program and it was explained like this:

  1. whereis firefox shows the folders, where it is installed, take the full path to the binary, and
  2. ldd /usr/bin/firefox put it as argument of the ldd command.

the tutorial also used firefox as an example and therefore I was sure to recreate it, but when I typed:

🌐 whereis firefox
firefox: /usr/bin/firefox /usr/lib/firefox /etc/firefox /usr/share/man/man1/firefox.1.gz
🌐 ldd /usr/bin/firefox
    not a dynamic executable

I got this "not a dynamic executable" message, instead of the list of libraries. Why?

5

The firefox executable is a shell script on your system.

Some applications employ a wrapper script that sets up the execution environment for the application, possibly to allow for better integration with the current flavor of Unix, or to provide alternative ways to run the application (new sets of command line options etc.) that the application itself is not providing. Sometimes a wrapper script is used to pick the correct actual binary to run based on the way that script was called.

For example, the MPI ("Message Passing Interface") C compiler is nothing more than a wrapper script around cc (or whatever compiler it's set up to use) that ensures that the MPI headers are in the search path and that the MPI library is linked in when compiling.

Have a look at this script to see what binaries it's calling under what circumstances.

  • 1
    I think it's just an Ubuntu thing however because on my system file $(readlink -e $(command -v firefox)) gives /usr/lib64/firefox-52.0.1/firefox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6315677124cf311616b98bea20cf063af2acca4f, stripped – Arkadiusz Drabczyk May 21 '17 at 8:31
  • i see, so i need the binaries for the ldd command, but the whereis command also displays scripts....the wrapper, it sounds like what I heard of the .bashrc is for the bash – sharkant May 21 '17 at 9:30
  • 1
    @sharkant It's not quite like .bashrc for bash. It's more as if you wrote a script around ls that set the correct locale environment variables and then called ls, possibly with extra flags. – Kusalananda May 21 '17 at 9:32
3
$ file $(which firefox)
/usr/bin/firefox: Bourne-Again shell script, ASCII text executable

$ tail $(which firefox)
done

# Run the browser
debugging=0
if [ $debugging = 1 ]
then
  echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
fi

exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
  • I do not understand the purpose – sharkant May 21 '17 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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