Skip to content

Build on CentOS 8.x

matt335672 edited this page Nov 19, 2021 · 8 revisions

General notes

This process has been tested on the following operating systems:-

  • CentOS 8.4.2105

Although CentOS is used here, any of the other RHEL clones should work in a very similar way.

To build the xrdp pulseaudio module, we need access to the pulseaudio sources and configuration files. This is because the xrdp pulseaudio module makes use of internal pulseaudio interfaces. The simplest known way to obtain all of this is to build pulseaudio on the target machine.

We use the mock tool to build pulseaudio. This allows us to get the pulseaudio sources and configuration simply, and also allows the developer to clean up easily after building the module. It also allows developers to use (for example) a Fedora workstation to build a CentOS 8 module if this is desired.

Note that CentOS 8.4.2105 and probably other clones do not package all of the development RPMs required to build pulseaudio. Some of these were removed in the transition from RHEL 7 to RHEL 8. This makes the step of building pulseaudio more complex, as we need to build these RPMs from source as well as pulseaudio.

The mock tool can be a security risk. If this is a consideration in your environment, make sure you remove it after building the module.

Prerequisites

Allow 2G of disk space for the mock root in /var/lib/mock.

It is assumed that you will be building and installing the package using an existing user account with sudo privileges.

Use these commands to install the mock package, and add the current user to the mock group:-

sudo dnf install epel-release
sudo dnf install mock
sudo usermod -a -G mock $USER

Log out and log in again as the current user, and use the id -Gn command to check you are on the mock group:-

$ id -Gn
... wheel mock

Prepare & build pulseaudio

Make a temporary directory to hold sources while we are working:-

mkdir xrdp-tmp
cd xrdp-tmp

Download the source RPMs you need to build pulseaudio, and build them together:-

 dnf download --source pulseaudio sbc libatomic_ops webrtc-audio-processing
 mock --chain ./sbc-*.src.rpm ./libatomic_ops-*.src.rpm ./webrtc-audio-processing-*.src.rpm ./pulseaudio-*.src.rpm

The last command can take a while to execute. Allow 10-15 minutes on a slow machine.

The build is made in a sub-directory of /var/lib/mock. This can be fairly deep, so is best located with a find command:-

find /var/lib/mock -type d -name pulseaudio-\* 2>/dev/null
/var/lib/mock/epel-8-x86_64/root/builddir/build/BUILD/pulseaudio-14.0

Assign this directory to the environment variable PULSE_DIR. On your system, this value may well be different:-

PULSE_DIR=/var/lib/mock/epel-8-x86_64/root/builddir/build/BUILD/pulseaudio-14.0

Build the xrdp module

Finally, let's build xrdp source / sink modules. You'll have two .so files module-xrdp-sink.so and module-xrdp-source.so.

sudo dnf install autoconf automake make libtool libtool-ltdl-devel pulseaudio-libs-devel git
git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
./bootstrap && ./configure PULSE_DIR=$PULSE_DIR
make
sudo make install

Installation

See the README for installation instructions.

Cleaning up

You can clean up the build machine completely if required:-

  1. Undo the last DNF installation action (installing the build packages) with dnf history undo last
  2. Use mock --clean to remove the mock chroot
  3. Delete the xrdp-tmp directory
  4. Remove the user from the mock group
  5. Remove the mock RPM.
  6. Remove the epel-release RPM.