Find Package Dependency During Source Code Compilation

Found this sandboxing tool, mbox (really crappy name) via HN. Sandboxing is like a container which isolates and assign limited resources for a guest program. Similarly, is like another form of virtualization.

Since there is not Debian package, I had to clone the source and try to compile it. But still, the tool still can't run in Ubuntu due to a memory issue which is way beyond me to fix it.
$ ./mbox ls
Stop executing pid=22065: It's not allowed to call mmap on 0x400000
Sandbox Root:
> /tmp/sandbox-22061

Since the Debian package is missing, we've to resolve to code compilation according to the README.

Clone the source from github, configure, and compile it.
$ git clone
$ cd src
$ cp {.,}configsbox.h
$ ./configure
$ make

Unfortunately, you should encounter error during compilation as certain required libraries are missing. That why having a .deb package is useful as we can check the dependency list of a package. For example to find a dependency of ack program which I've just installed.

Install the ack program
$ sudo apt-get install ack

Go to the cached location where all the Debian packages were stored.
$ cd /var/cache/apt/archives

Check the dependency of the program and install those required packages.
$ sudo dpkg -I ack_1.39-12_amd64.deb | grep -i depends
Depends: libc6 (>= 2.4)

Or you can forcefully install by letting apt-get resolves the unmet dependencies.
$ sudo apt-get install -f ack_1.39-12_amd64.deb

Now, how can we find the dependency list through source code compilation? The only way I know is to rerun the configure script, capture the output, filter all those line with 'no' keyword, and lastly find those packages with those missing header file. Example as shown below.

Capture the output of the configuration script.
$ ./configure | tee configure.log

Find those header file, sample line given.
$ cat configure.log | grep no
checking libaio.h usability... no

Find the package that contains this file libaio.h. But first we must install apt-file program.
$ sudo apt-get install apt-file
$ sudo apt-file update
$ apt-file search libaio.h
libaio-dev: /usr/include/libaio.h

Install the found package.
$ sudo apt-get install libaio-dev

Repeat for other missing header files as well. Note that certain header files are supposed to be not found as the script was checking for platform specific header files.

No comments:

Post a Comment