Skip to content

Compile Shadow Utils

I found a bug in shadow-maint/shadow by accident and submitted this pull request to fix it. Below are the steps to build and test the project.

Install Orbstack

Build and install the Shadow project on macOS using Orbstack.

bash
brew install orbstack

Open the Orbstack application (change the image repository, optional).

Install Dependencies

Enter the container.

bash
docker run -it --name shadow ubuntu:22.04 /bin/bash

First, update the packages.

bash
apt-get update

Install vim and git.

bash
apt-get install -y vim git

Refer to the shadow project documentation to install the necessary dependencies.

bash
apt-get build-dep -y shadow

The following error is usually reported.

bash
E: You must put some 'deb-src' URIs in your sources.list

Use vim to edit /etc/apt/sources.list and add the deb-src source.

bash
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted

Remove the comment from the # deb-src line above, then run again.

bash
apt-get update

Install the necessary dependencies again, this time it should not report an error.

bash
apt-get build-dep -y shadow

Configuration

Download the source code.

bash
git clone https://github.com/shadow-maint/shadow.git

Run the project's configuration script autogen.sh.

bash
./autogen.sh --without-selinux --enable-man --with-yescrypt

The following errors occur.

bash
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --force
autoreconf: running: /usr/bin/autoconf --force
configure.ac:35: error: possibly undefined macro: LT_LIB_DLLOAD
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:135: error: possibly undefined macro: AC_MSG_WARN
autoreconf: error: /usr/bin/autoconf failed with exit status: 1

There are a few errors here, first handle LT_LIB_DLLOAD.

bash
apt-get install -y libltdl-dev

Run ./autogen.sh again.

bash
configure.ac:135: error: possibly undefined macro: AC_MSG_WARN
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: error: /usr/bin/autoconf failed with exit status: 1

Then install pkg-config.

bash
apt-get install -y pkg-config

Running ./autogen.sh again will still report an error.

bash
configure: error: readpassphrase() is missing, either from libc or libbsd

Install libbsd-dev.

bash
apt-get install -y libbsd-dev

Running ./autogen.sh again should not report an error.

Build & Install

bash
make -j4
bash
make install