Error building with --enable-embedded-cryptopp

Hello, I’m trying to package Urbackup Server to Nix package manager and I’m having some trouble building it.
The error is the following:

$ ./configure --enable-embedded-cryptopp
[...]
$ make
[...]
make[2]: Entering directory '/build/urbackup_backend/cryptoplugin/src'
make  all-am
make[3]: Entering directory '/build/urbackup_backend/cryptoplugin/src'
cp adhoc.cpp.proto adhoc.cpp
make[3]: *** No rule to make target 'cryptlib.cpp', needed by 'libcryptlib_la-cryptlib.lo'.  Stop.
make[3]: *** Waiting for unfinished jobs....
cp: cannot stat 'adhoc.cpp.proto': No such file or directory
make[3]: *** [Makefile:2964: adhoc.cpp] Error 1
make[3]: Leaving directory '/build/urbackup_backend/cryptoplugin/src'
make[2]: *** [Makefile:954: all] Error 2
make[2]: Leaving directory '/build/urbackup_backend/cryptoplugin/src'
make[1]: *** [Makefile:6241: all-recursive] Error 1
make[1]: Leaving directory '/build/urbackup_backend'
make: *** [Makefile:1501: all] Error 2

I replicated the same error both in Nix inside Debian Trixie and in Debian Trixie itself.
When building without --enable-embedded-cryptopp in Debian Trixie it builds sucessfully.

The source code is downloaded from github tag 2.5.20.

Nix expression used:

with import <nixpkgs> {};


stdenv.mkDerivation rec {
  pname = "urbackup-server";
  version = "2.5.20";

  src = fetchgit {
    url = "https://github.com/uroni/urbackup_backend.git";
    rev = "refs/tags/${version}";
    sha256 = "sha256-brP7nYikbIvQP/K+qSKyd8eHWUIK9Ai/4qP09ptr+lE=";
  };

  buildInputs = [
    # cryptopp
    curlWithGnuTls
    
    autoconf
    automake
    gnum4
    sqlite
    autogen
    libtool
    pkg-config
    zlib
    zstd
  ];

  configurePhase = ''
    runHook preInstall

    bash switch_build.sh server
    echo '***'
    autoreconf --install
    echo '****'
    bash configure --enable-embedded-cryptopp
    echo '*****'

    runHook postInstall
  '';

  buildFlags = [
     "-j8"
   ];

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Easy to setup Open Source client/server backup system";
    longDescription = "An easy to setup Open Source client/server backup system, that through a combination of image and file backups accomplishes both data safety and a fast restoration time";
    homepage = "https://www.urbackup.org/index.html";
    license = licenses.agpl3Plus;
    platforms = platforms.linux;
  };
}

Attached is the whole build log.
build.log (24.1 KB)

You’d have to run download_cryptopp.sh first. But perhaps there is a cryptopp package you can use?

Thanks, it now works in Debian Trixie, but in nix it gives a wget error:

 > Resolving buildserver.urbackup.org (buildserver.urbackup.org)... failed: Temporary failure in name resolution.
 > wget: unable to resolve host address 'buildserver.urbackup.org'

There is a cryptopp package in Nix, which seems to be version 8.9.0 but, for some unknown reason, urbackup builder can’t find it (with cryptopp in build inputs and configure without --enable-embedded-cryptopp):

[...]
> checking for curl_free... yes
> checking for crypto++ version >= 5.1... no
> Crypto++ not found. Please install (cryptopp-devel/libcrypto++-dev) or run configure with --enable-embedded-cryptopp

Best option would be to fix the urbackup_backend/m4/cryptopp.m4 at dev · uroni/urbackup_backend · GitHub script to find it.

Why are you using the git tag anyways and not the tar.gz ?

I found that the cryptopp package doesn’t come with headers, only with .so files. Maybe thats why it cant find the package.

And I believe embedded cryptopp is not an option as Nix, by design, doesnt allow internet access. As the package must be available through nixpkgs if understand it correctly.1

[1] “Using DNS in a nix derivation? Temporary failure in name resolution - Help,” NixOS Discourse. Accessed: Dec. 28, 2024. [Online]. Available: Using DNS in a nix derivation? Temporary failure in name resolution - Help - NixOS Discourse

edit:
The headers are packaged together in the same package. They can be accessed by finding the crypto++.dev derivation in the nix store. And should be accessible by the package derivation.

I found how to make cryptopp acessible. Just ./configure --with-crypto-prefix=<cryptopp-dev_nix-store_path> :smile:
Anyway, here is the full nix expression that configure and builds sucessfully. I’m still having issues with installing it but that is more Nix specific.

with import <nixpkgs> {};
 
stdenv.mkDerivation rec {
  pname = "urbackup-server";
  version = "2.5.20";

  src = fetchFromGitHub {
    owner = "uroni";
    repo = "urbackup_backend";
    rev = "refs/tags/${version}";
    hash = "sha256-brP7nYikbIvQP/K+qSKyd8eHWUIK9Ai/4qP09ptr+lE=";
  };

  buildInputs = [
    cryptopp
    curlWithGnuTls
    autoconf
    automake
    libtool
    pkg-config
 #   gnum4
 #   zlib
 #   zstd
  ];
  
  configurePhase = ''
    runHook preConfigure

    bash switch_build.sh server
    autoreconf --install
    sh configure --prefix=$out \
       --with-crypto-prefix=${ builtins.storePath cryptopp.dev }

    runHook postConfigure
  '';
  # --localstatedir="/var/lib"

  doCheck = true;

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Easy to setup Open Source client/server backup system";
    longDescription = "An easy to setup Open Source client/server backup system, that through a combination of image and file backups accomplishes both data safety and a fast restoration time";
    homepage = "https://www.urbackup.org/index.html";
    license = licenses.agpl3Plus;
    platforms = platforms.linux;
  };
}