How To Install libbsd-dev on Ubuntu 18.04

In this tutorial we learn how to install libbsd-dev on Ubuntu 18.04. libbsd-dev is utility functions from BSD systems - development files

Introduction

In this tutorial we learn how to install libbsd-dev on Ubuntu 18.04.

What is libbsd-dev

libbsd-dev is:

This library provides some functions commonly available on BSD systems but not on others like GNU systems.

The currently provided functions are:

  • _time32_to_time, _time_to_time32, _time64_to_time, _time_to_time64, _time_to_long, _long_to_time, _time_to_int, _int_to_time.
  • TIMEVAL_TO_TIMESPEC, TIMESPEC_TO_TIMEVAL.
  • MD5Data, MD5End, MD5File, MD5FileChunk, MD5Final, MD5Init, MD5Pad, MD5Transform, MD5Update.
  • arc4random, arc4random_addrandom, arc4random_buf, arc4random_stir, arc4random_uniform.
  • bsd_getopt.
  • be16dec, be32dec, be64dec, le16dec, le32dec, le64dec.
  • be16enc, be32enc, be64enc, le16enc, le32enc, le64enc.
  • bit_alloc, bit_decl, bit_clear, bit_ffc, bit_ffs, bit_nclear, bit_nset, bit_set, bitstr_size, bit_test.
  • closefrom.
  • expand_number, dehumanize_number, humanize_number, strtonum, fmtcheck.
  • explicit_bzero.
  • errc, verrc, vwarnc, warnc.
  • fgetln, fparseln, fgetwln, flopen, fpurge, funopen.
  • getbsize.
  • getmode, setmode, strmode,
  • getpeereid.
  • getprogname, setprogname.
  • heapsort, radixsort, mergesort, sradixsort.
  • nlist (ELF and a.out support).
  • pidfile_open, pidfile_write, pidfile_close, pidfile_remove.
  • readpassphrase.
  • reallocarray, reallocf.
  • setproctitle (initialized via libbsd-ctor or setproctitle_init).
  • sl_init, sl_add, sl_free, sl_find.
  • strlcpy, strlcat.
  • strnstr.
  • strnvis, strnunvis, strunvis, strunvisx, strvis, strvisx, unvis, vis.
  • timeradd, timersub, timerclear, timerisset, timercmp.
  • timespecadd, timespecsub, timespecclear, timespecisset, timespeccmp.
  • wcslcat, wcslcpy.

Also included are some queue macro definitions not present on includes from glibc.

There are three methods to install libbsd-dev on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libbsd-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libbsd-dev using apt-get by running the following command:

sudo apt-get -y install libbsd-dev

Install libbsd-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libbsd-dev using apt by running the following command:

sudo apt -y install libbsd-dev

Install libbsd-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libbsd-dev using aptitude by running the following command:

sudo aptitude -y install libbsd-dev

How To Uninstall libbsd-dev on Ubuntu 18.04

To uninstall only the libbsd-dev package we can use the following command:

sudo apt-get remove libbsd-dev

Uninstall libbsd-dev And Its Dependencies

To uninstall libbsd-dev and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libbsd-dev

Remove libbsd-dev Configurations and Data

To remove libbsd-dev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libbsd-dev

Remove libbsd-dev configuration, data, and all of its dependencies

We can use the following command to remove libbsd-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libbsd-dev

References

Summary

In this tutorial we learn how to install libbsd-dev package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.