Trying to run bitcoin-qt (0.22), ldd shows missing dependencies

I’m trying to run the latest Bitcoin 0.22 version, specifically the bitcoin-qt gui app (downloaded binary version). However, it fails to start with “No such file or directory”, and ldd is showing the following missing dependencies:

libfontconfig.so.1
libfreetype.so.6
libxcb.so.1
libxkbcommon-x11.so.0
libxkbcommon.so.0

However, I have in my configuration.nix the following, which I thought would supply these dependencies:

environment.systemPackages = with pkgs; [
    ...
    fontconfig
    freetype
    ftgl
    xorg.libxcb
    libxkbcommon
    ...
];

Any pointers on what may be the problem?

$> pwd
/zdata1/Applications/Bitcoin/bitcoin-core-22.0/bitcoin-22.0-x86_64-linux-gnu/bin

$> ls    
Permissions Links Size User    Group Date Modified    Name
.rwxr-xr-x      1 2.2M bgibson users 2021-09-08 11:15 bitcoin-cli*
.rwxr-xr-x      1  36M bgibson users 2021-09-08 11:15 bitcoin-qt*
.rwxr-xr-x      1 2.8M bgibson users 2021-09-08 11:15 bitcoin-tx*
.rwxr-xr-x      1 2.0M bgibson users 2021-09-08 11:15 bitcoin-util*
.rwxr-xr-x      1 7.5M bgibson users 2021-09-08 11:15 bitcoin-wallet*
.rwxr-xr-x      1  13M bgibson users 2021-09-08 11:15 bitcoind*
.rwxr-xr-x      1  21M bgibson users 2021-09-08 11:15 test_bitcoin*

$> ./bitcoin-qt 
zsh: no such file or directory: ./bitcoin-qt

$> ldd bitcoin-qt 
	linux-vdso.so.1 (0x00007ffd587d2000)
	libpthread.so.0 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libpthread.so.0 (0x00007fdc20e8a000)
	librt.so.1 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/librt.so.1 (0x00007fdc20e7f000)
	libfontconfig.so.1 => not found
	libfreetype.so.6 => not found
	libxcb.so.1 => not found
	libxkbcommon-x11.so.0 => not found
	libxkbcommon.so.0 => not found
	libdl.so.2 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libdl.so.2 (0x00007fdc20e78000)
	libm.so.6 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libm.so.6 (0x00007fdc20d37000)
	libgcc_s.so.1 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libgcc_s.so.1 (0x00007fdc20d1d000)
	libc.so.6 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib/libc.so.6 (0x00007fdc20b56000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/z56jcx3j1gfyk4sv7g8iaan0ssbdkhz1-glibc-2.33-56/lib64/ld-linux-x86-64.so.2 (0x00007fdc230b1000)

What do you mean by “downloaded binary”? As in precompiled by them?

You need to use patchelf to do some interpreter as well as rpath patching.

Best is to wrap in a derivation and use autoPatchelfHook.

2 Likes

A Nix package is a function. So a given package has its dependencies provided as inputs to the function. Nix then sets things up so that binaries can find their dependencies at runtime.

In practice this means that if you “install” a library so that a program can find it, it won’t work because the program won’t know where to find the library; Libraries are not installed in NixOS like thry are in other distros.

You should be able to install bitcoin from Nix. We have 0.22.

2 Likes

Thanks, I ended up rebuilding with the version in nixpkgs. Nice to see Russel O’connor and Pavol Rusnak are the maintainers of it and it’s the most current version, should have guessed.