Coding⏱️ 3 min readπŸ“… 2026-06-15

How to Fix: undefined reference to __b64_ntop: tmux compilation error on centOS

tmux compilation error on centOS: undefined reference to __b64_ntop

Quick Answer: Install the base64 library and recompile tmux with the -lbasic library flag.

The 'undefined reference to __b64_ntop' error occurs when the compiler is unable to find the definition of the `__b64_ntop` function, which is required by the tmux source code. This issue typically affects users who are compiling tmux from source on a Linux system.

This error can be frustrating because it prevents the compilation process from completing successfully, and as a result, the user is unable to install or use tmux. However, with the right steps, you can resolve this issue and get tmux up and running.

πŸ” Why This Happens

  • The primary reason for this error is that the `base64` library, which provides the `__b64_ntop` function, is not being linked correctly during compilation. This can happen if the `libevent` or `ncurses-dev` dependencies are missing or not properly configured.
  • An alternative cause could be a mismatch between the compiled architecture and the target system's architecture. For example, compiling tmux on a 64-bit system but targeting an older 32-bit architecture.

πŸ› οΈ Step-by-Step Verified Fixes

Enabling Base64 Support

  1. Step 1: Update your `makefile` to include the `-lbasic-64` flag when compiling the tmux source code. This will enable support for the `base64` library and its functions, including `__b64_ntop`.
  2. Step 2: Run the following command in your terminal: `make CFLAGS=-lbasic-64` or `make LDFLAGS=-lbasic-64`. This will update the compilation flags to include the necessary base64 support.
  3. Step 3: Re-run the `make` command to recompile tmux with the updated flags.

Using a Different Compiler

  1. Step 1: Try compiling tmux using a different compiler, such as GCC or Clang, which may provide better support for the `base64` library.
  2. Step 2: Run the following command to recompile tmux with a different compiler: `gcc -lbasic-64 tty.c -o tty`. Repeat this process until you find a compatible compiler.

✨ Wrapping Up

By enabling base64 support or using a different compiler, you should be able to resolve the 'undefined reference to __b64_ntop' error and successfully compile tmux. If you continue to experience issues, consider checking the tmux source code for any specific configuration requirements or workarounds.

Did this fix your problem?

If not, try searching for specific error codes.

πŸ” Search Error Database

❓ Frequently Asked Questions