Building Solana package already in nixpkgs fails in 24.05-pre

Attempting to build the Solana package on rev 87cc06983c14876bb56a6a84935d1a3968f35999 of nixpkgs which is 24.05-pre fails with an unusual error:

error: failed to run custom build command for `librocksdb-sys v0.8.0+7.4.4`

Caused by:
  process didn't exit successfully: `/build/source/target/release/build/librocksdb-sys-e5d334bfe06f60f3/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /build/solana-cli-1.14.23-vendor.tar.gz/proc-macro2/src/fallback.rs:752:9:
  "enum_(unnamed_at_rocksdb/include/rocksdb/c_h_981_1)" is not a valid Ident

My original attempt was to upgrade the package however after various different errors attempted to build the existing one to ensure its working.

The build scripts includes the following:

  # Used by build.rs in the rocksdb-sys crate. If we don't set these, it would
  # try to build RocksDB from source.
  ROCKSDB_LIB_DIR="${rocksdb}/lib";

My assumption was that rocksdb shouldn’t even be built but unable to find a way around this.

Command to reproduce:

nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/87cc06983c14876bb56a6a84935d1a3968f35999.tar.gz -p solana-cli

Any help would be appreciated even suggestions on a possible path to debug this issue as I’m not as familiar with rust or its toolchain

Try using llvmPackages_15.clangUseLLVM

Thanks, this was resolve after upgrading to 1.16.27: solana-cli: 1.14.23 → 1.16.27 by aikooo7 · Pull Request #280788 · NixOS/nixpkgs · GitHub

Building other dependencies for Solana can be trickier and require patches, this thread has some useful insight: Any tutorials/guides on Solana development? - #32 by rollschild

if anyone comes across this and using Anchor, make sure to wrap Anchor binary with Solana’s custom rust toolchain

1 Like