2018-07-30 Building Bitlbee on PureOS

I need to enable debugging symbols for Bitlbee in order to investigate a bug.

a bug

First thing I notice is that I have `libgnutls30` installed but no matching `-dev` exists.

sudo apt install libgnutls28-dev

Nex I notice a mysterious message during configuration: “libgcrypt-config: not found”. This didn’t abort configuration but building still fails.

sudo apt install libgcrypt20-dev

And now it finally builds:

./configure --msn=0 --oscar=0 --twitter=0 --debug=1

I just want Jabber support (and my plugin will provide Mastodon support).

Build and install it:

make && make install

I had to uninstall `bitlbee` and `bitlbee-common`. While they were installed, `systemd` kept listening on port 6667, preventing me from starting my own `bitlbee`.

sudo apt remote bitlbee
sudo apt auto-remove

I also had to make a new config directory:

make install-etc

I didn’t have any special settings in my config file. Just to make sure:

sudo diff /usr/local/etc/bitlbee/bitlbee.conf /etc/bitlbee/bitlbee.conf

I ended up doing the following:

1. uncomment `User = bitlbee`

2. uncomment `CAfile = /etc/ssl/certs/ca-certificates.crt`

At this point, a simple `sudo -u bitlbee ./bitlbee -Dnv` already works but only my Jabber account gets connected as the Bitlbee Mastodon plugin is in the wrong place. In order to recompile it, we need to install the new Bitlbee development stuff:

Bitlbee Mastodon

sudo make install-dev

Now switch to the Bitlbee Mastodon directory:

./configure
make
sudo make install

And now I’m back in business.

sudo bitlbee -D

Verify that it runs as user `bitlbee` and not `root` (remember that change I made to the config file).

$ ps aux | grep bitlbee
bitlbee   8047  0.0  0.0  40404  4536 ?        Ss   11:29   0:00 bitlbee -D
alex      8055  0.0  0.0   5088   936 pts/0    S+   11:30   0:00 grep bitlbee

And that means, I can now attach `gdb` to the running process (taking the process id from the output above), set my breakpoint and using `c` to continue.

sudo gdb
attach 8047
b mastodon-lib.c:789
c

Sadly, Bitlbee’s control flow is too hard to fathom for me. The bug remains unresolved.

Anyway... Deploying!

sudo make install-systemd
sudo systemctl unmask bitlbee
sudo systemctl enable bitlbee
sudo systemctl start bitlbee

​#PureOS ​#Bitlbee