Skip to content

Instantly share code, notes, and snippets.


fanquake/ Secret

Last active May 8, 2019
What would you like to do?
Reviewing #15968

Reviewing #15968 - Fix portability issue with pthreads


The recently merged #15849 broke compilation on BSD based platforms.

This is due to missing includes for the usage of pthread_set_name_np.

This wasn't caught at merge-time or by Travis because the PR wasn't tested/compiled on a BSD machine, and Travis doesn't have BSD containers.

See here for the relevant platform checks.

Testing is essentially just checking that the fix in #15968 compiles on a BSD machine.


If you don't have easy access to a BSD machine, Vagrant is one easy way to spin one up. After getting setup with a new vagrant BSD VM, you can follow the instructions in the OpenBSD build guide to install dependencies and compile.


there is a Vagrantfile in core-review that automates most of the process. If you'd like to use it there are steps below. Please look through the vagrant file, and install script before running anything.

git clone

pushd core-review/vagrant

# Normally you'd just do something like "vagrant up vm_name"
# However, this vagrantfile is setup so you can pass it a PR to checkout during setup.
# NOTE: The first time a VM is provisioned it may take a while as dependencies are installed etc
# Subsequent `vagrant up`s will be significantly faster.

# If you want to see the compilation failure before testing the fix run:
vagrant up openbsd64

# This will provision a VM and clone bitcoin/bitcoin master and skip to the compilation steps below.

# If you'd rather skip straight to the fix, pass --pr=15968, which will checkout PR during setup.
vagrant --pr=15968 up openbsd64


Once provisioned, you connect to the OpenBSD VM via vagrant ssh and then compile as usual.

vagrant ssh openbsd64

# in the openBSD vm
./configure --with-gui=no CC=cc CXX=c++ \
    BDB_LIBS="-L/home/vagrant/bitcoin/db4/lib -ldb_cxx-4.8" \
gmake check -j6

# If you're first testing master, this step will eventually fail. 
# When it does exit the VM, then run:
vagrant --pr=15968 up openbsd64

# Which will clean the VM, and merge the PR branch. You can then ssh back in, and check compiling completes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment