Building FreeSwitch from source under De{bi,vu}an

FreeSwitch does not let just anyone download its "open source" software any more. You need to have a Personal Access Token.

Once you have a PAT, you can use it to fetch the FreeSwitch GPG keyring, and set up apt authentication:

wget -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://signalwire:pat_xxxxx12345xxxxx@freeswitch.signalwire.com/repo/deb/debian-release/signalwire-freeswitch-repo.gpg
echo "machine freeswitch.signalwire.com login signalwire password pat_xxxxx12345xxxxx" >/etc/apt/auth.conf.d/freeswitch.conf
chown root: /etc/apt/auth.conf.d/freeswitch.conf
chmod 600 /etc/apt/auth.conf.d/freeswitch.conf

You also need to include a reference to the GPG key in sources.list:

deb     [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ buster main
deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/debian-release/ buster main

Then you can finally start getting the source code…

Preparing the tools

# apt build-dep freeswitch
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libsamplerate0 linux-image-4.19.0-14-amd64 linux-image-4.19.0-17-amd64 linux-image-4.19.0-9-amd64
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  libjack-jackd2-0
The following NEW packages will be installed:
  bison ca-certificates-java default-jdk default-jdk-headless default-jre default-jre-headless dh-python
  doxygen flite1-dev gdal-data gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-rsvg-2.0
  git git-man icu-devtools imagemagick-6-common java-common ladspa-sdk libaec0 libarmadillo9 libarpack2
  libasound2-dev libavcodec-dev libavformat-dev libavresample-dev libavresample4 libavutil-dev
  libbison-dev libblas3 libblkid-dev libbroadvoice-dev libbsd-dev libbz2-dev libcairo-script-interpreter2
  libcairo2-dev libcharls2 libclang1-6.0 libcodec2-dev libcurl4-openssl-dev libdap25 libdapclient6v5
  libdapserver7v5 libdb-dev libdb5.3-dev libdc1394-22 libdc1394-22-dev libde265-0 libdjvulibre-dev
  libdjvulibre-text libdjvulibre21 libedit-dev libepsilon1 liberror-perl libeudev-dev libevent-2.1-6
  libevent-core-2.1-6 libevent-pthreads-2.1-6 libexif-dev libexif12 libexpat1-dev libfabric1 libffi-dev
  libfftw3-double3 libflac-dev libfontconfig1-dev libfreetype6-dev libfreexl1 libfyba0 libgd3 libgdal20
  libgdbm-compat-dev libgdbm-dev libgdcm2-dev libgdcm2.8 libgdk-pixbuf2.0-dev libgeos-3.7.1 libgeos-c1v5
  libgeotiff2 libgfortran5 libgif7 libgirepository-1.0-1 libgl2ps1.4 libglib2.0-bin libglib2.0-dev
  libglib2.0-dev-bin libgmp-dev libgmpxx4ldbl libgnutls-dane0 libgnutls-openssl27 libgnutls28-dev
  libgnutlsxx28 libgphoto2-6 libgphoto2-dev libgphoto2-port12 libhashkit-dev libhashkit2 libhdf4-0-alt
  libhdf5-103 libhdf5-openmpi-103 libheif1 libhiredis-dev libhiredis0.14 libhwloc-plugins libhwloc5
  libibverbs1 libice-dev libicu-dev libidn2-dev libilbc-dev libilbc1 libilmbase-dev libilmbase23
  libjack-dev libjack0 libjbig-dev libjpeg-dev libjpeg62-turbo-dev libjsoncpp1 libkmlbase1
  libkmlconvenience1 libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1 liblapack3 liblcms2-dev
  libldap2-dev libldns-dev liblept5 libllvm6.0 liblqr-1-0 liblqr-1-0-dev libltdl-dev liblzma-dev liblzo2-2
  libmagickcore-6-arch-config libmagickcore-6-headers libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra
  libmagickcore-6.q16-dev libmagickcore-dev libmagickwand-6.q16-6 libmariadb-dev libmemcached-dev
  libminizip1 libmono-2.0-dev libmono-corlib4.5-cil libmono-microsoft-csharp4.0-cil libmono-security4.0-cil
  libmono-system-configuration4.0-cil libmono-system-core4.0-cil libmono-system-numerics4.0-cil
  libmono-system-security4.0-cil libmono-system-xml4.0-cil libmono-system4.0-cil libmonosgen-2.0-1
  libmonosgen-2.0-dev libmount-dev libmp3lame-dev libmpg123-dev libnetcdf-c++4 libnetcdf13 libnl-3-200
  libnl-route-3-200 libnspr4 libnss3 libogdi3.2 libogg-dev libopencore-amrnb-dev libopencv-calib3d-dev
  libopencv-calib3d3.2 libopencv-contrib-dev libopencv-contrib3.2 libopencv-core-dev libopencv-core3.2
  libopencv-dev libopencv-features2d-dev libopencv-features2d3.2 libopencv-flann-dev libopencv-flann3.2
  libopencv-highgui-dev libopencv-highgui3.2 libopencv-imgcodecs-dev libopencv-imgcodecs3.2
  libopencv-imgproc-dev libopencv-imgproc3.2 libopencv-ml-dev libopencv-ml3.2 libopencv-objdetect-dev
  libopencv-objdetect3.2 libopencv-photo-dev libopencv-photo3.2 libopencv-shape-dev libopencv-shape3.2
  libopencv-stitching-dev libopencv-stitching3.2 libopencv-superres-dev libopencv-superres3.2
  libopencv-ts-dev libopencv-video-dev libopencv-video3.2 libopencv-videoio-dev libopencv-videoio3.2
  libopencv-videostab-dev libopencv-videostab3.2 libopencv-viz-dev libopencv-viz3.2 libopencv3.2-java
  libopencv3.2-jni libopenexr-dev libopenexr23 libopenjp2-7-dev libopenmpi3 libopus-dev libopusfile-dev
  libopusfile0 libout123-0 libp11-kit-dev libpci-dev libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5
  libpcsclite1 libperl-dev libpixman-1-dev libpmix2 libpng-dev libpoppler82 libportaudiocpp0 libpq-dev
  libproj13 libpsm-infinipath1 libpsm2-2 libpthread-stubs0-dev libpython-all-dev libpython-dev
  libpython2-dev libpython2.7 libpython2.7-dev libpython3-dev libpython3.7-dev libqhull7 librabbitmq-dev
  librabbitmq4 libraw1394-11 libraw1394-dev librdmacm1 librsvg2-dev libsasl2-dev libselinux1-dev
  libsensors4-dev libsepol1-dev libshout3-dev libsilk-dev libsm-dev libsndfile1-dev libsnmp-dev
  libsocket++1 libsofia-sip-ua-dev libsoundtouch-dev libspandsp3-dev libspatialite7 libspeex-dev
  libspeexdsp-dev libsqlite3-dev libssl-dev libsuperlu5 libswresample-dev libswscale-dev libsz2
  libtasn1-6-dev libtbb-dev libtbb2 libtcl8.6 libtesseract4 libtheora-dev libtiff-dev libtiff5-dev
  libtiffxx5 libtk8.6 libtool-bin libtpl-dev libudev-dev libunbound8 liburiparser1 libusb-1.0-0 libv8-6.1
  libv8-6.1-dev libvlc-dev libvlc5 libvlccore9 libvorbis-dev libvtk6.3 libwmf-dev libwmf0.2-7 libwrap0-dev
  libx11-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxdmcp-dev libxerces-c3.2
  libxext-dev libxft2 libxml2-dev libxpm4 libxrender-dev libxss1 libxt-dev libxt6 libyaml-dev mono-4.0-gac
  mono-gac mono-mcs mono-runtime mono-runtime-common mono-runtime-sgen nettle-dev ocl-icd-libopencl1
  odbcinst odbcinst1debian2 openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless
  pkg-config portaudio19-dev proj-data python-all python-all-dev python-dev python2-dev python2.7-dev
  python3-dev python3-distutils python3-lib2to3 python3.7-dev unixodbc-dev uuid-dev x11proto-core-dev
  x11proto-dev x11proto-xext-dev xorg-sgml-doctools xtrans-dev yasm zlib1g-dev
0 upgraded, 350 newly installed, 1 to remove and 0 not upgraded.
Need to get 579 MB of archives.
After this operation, 1,535 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Incidentally, what the devil is FreeSwitch (a telephony system) doing installing stuff for OpenCV (a computer vision library)?

Building the package

When you first run dpkg-buildpackage -b -uc -us you'll probably find that it terminates with an error message: checking for libks >= 1.8.2… configure: error: You need to either install libks or disable mod_verto in modules.conf

Hm, so much for build-dep installing everything you need to be able to build the package…

Even more mysterious: libks is installed: State: installed (1.7.0-75~buster-75), upgrade available (1.8.2-79~buster-79)

Huh? Why isn't it upgraded?

Running aptitude upgrade now wants to upgrade 143 packages, of which 141 have names starting with freeswitch, one is libfreeswitch1 and one is libks. Weird.

After this, dpkg-buildpackage -b -uc -us spends a long time doing something which looks pretty much like you'd expect it to (assuming you've compiled things in the past).

There are an interesting number of messages during the build process along the lines of:

dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/freeswitch-mod-lua/usr/lib/freeswitch/mod/mod_lua.so was not linked against libcrypto.so.1.1 (it uses none of the library's symbols)

This possibly also indicates why a binary installation of FreeSwitch brings in such an astonishing number of additional packages…

Finally, after 25 minutes, the build process finished with:

dh_shlibdeps: Aborting due to earlier error
make: *** [debian/rules:43: binary] Error 255
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

Oh, very helpful. What was the "earlier error" I wonder?

A repeat run of dpkg-buildpackage -b -uc -us (which presumably has to do far less work, since everything buildable has already been built, and therefore might show the error message where you can see it, rather than several hundred lines up your scroll buffer) still takes 6 minutes to do whatever it wants to, and this time ends with the message:

mv: cannot move './debian/libesl-perl/usr/lib/debug' to './debian/libesl-perl-dbg/usr/lib/debug': Directory not empty
make[1]: *** [debian/rules:98: override_dh_strip] Error 1
make[1]: Leaving directory '/home/antony/freeswitch-1.10.9~release~21~a615e85afc~buster'
make: *** [debian/rules:43: binary] Error 2

Huh.

So, starting again from scratch (delete the source tree, download it again, re-build) but this time teeing the output to a file results half an hour later in a 5 Mbyte text file, containing the significant line:

dpkg-shlibdeps: error: no dependency information found for /usr/lib/x86_64-linux-gnu/libsystemd.so.0 (used by debian/freeswitch/usr/bin/fs_epmd)

After installing libsystemd0 (which is available in Devuan), the package builds.

Or, should I say, packages: it actually creates 347 of them!

Still, at least it builds now.

Changing the version "number"

It took me quite some time to work out how to change the version number of the packages being built.

The version I started from was downloaded as freeswitch-1.10.9~release~21~a615e85afc~buster and this was building packages with the version 1.10.9~release~21~a615e85afc~buster-1~buster+1

After looking for and in various files which might contain the string buster+1 I eventually discovered that the version to build is simply taken from the first version listed in the debian/changelog file. This came as something of a surprise to me.

The first version listed was:

freeswitch (1.10.9~release~21~a615e85afc~buster-1~buster+1) stable; urgency=medium

I added some lines to the top of the file, starting with:

freeswitch (1.10.9~release~21~enhancedMWI) stable; urgency=medium

and then build process then created packages with version 1.10.9~release~21~enhancedMWI.

However, this changes the version of the packages being built, but strangely does not change the version reported by FreeSwitch once it is running:

# fs_cli -x "version"
FreeSWITCH Version 1.10.9-release-21-a615e85afc~64bit (-release-21-a615e85afc 64bit)

That is my next objective…


Go up
Return to main index.