Bitcoin Core Linking Error on Windows with WSL and Ubuntu 20.04
As a Bitcoin user, you probably know how important it is to ensure that your software is compatible with various operating systems and environments. However, building and installing Bitcoin Core, especially from source code, can be a frustrating experience. In this article, we will explore the linking error you encounter on Windows with WSL (Windows Subsystem for Linux) running Ubuntu 20.04.
The Problem:
When trying to build the Bitcoin v24.2 source code for Windows using WSL, you may encounter the following linker errors:
/usr/bin/gcc
/usr/bin/g++: undefined symbol: __errno__
These error messages indicate that your compiler cannot find an equivalent function named __errno__ in the C standard library.
The Solution:

To fix this problem, you will need to make a few adjustments to your build process. Here is a step-by-step guide:
- Install the GNU Compiler Collection (GCC):
On Ubuntu 20.04, you can install GCC using the following command:
sudo apt update
sudo apt install gcc-9
This version of GCC is compatible with Bitcoin Core.
- Update the
CXXandCPPflags:
After installing GCC, you will need to update your compiler flags for C++ and C code. The correct flags are:
gcc -std=c++11 -I/usr/include/gcc-9 -O2 -Wall -Wextra -pthread -I/usr/lib64/gcc/9/../../../glibc/aarch64-linux-gnu/libc.so -I/usr/local/include
The CXX and CPP flags are used to specify the compiler for C++ code. Replace gcc with g++ if you are using G++.
- Configure and Compile
:
Now that you have the correct build flags, you can configure and compile Bitcoin Core:
cd /path/to/bitcoin/src
./configure --enable-openssl=1 --prefix=/usr/local
make -j$(nproc)
The --enable-openssl=1 option allows the OpenSSL library to compile with cryptography.
- Run the Installer:
After compiling Bitcoin Core, you will need to run the installer:
./installer --build --preinstall --no-synctool --config /usr/local/etc/bitcoin.conf
The --config option specifies a configuration file that contains the settings for your build. The path is relative to the current directory.
- Verify:
Once the installation is complete, verify that Bitcoin Core was installed and linked correctly:
bitcoind --version
This should display version information indicating that Bitcoin Core was built with the correct flags.
By following these steps, you should be able to resolve the linker error and successfully build the Bitcoin v24.2 source code for Windows using WSL running Ubuntu 20.04.
