ethereum/go-ethereum · warning

./bench: ECDH module not enabled.\n

Error message

./bench: ECDH module not enabled.\n

What it means

The bench tool checks, at startup, each optional module's compile-time flag (here ENABLE_MODULE_ECDH). If you ask to benchmark 'ecdh' but the library was configured without --enable-module-ecdh, the macro is undefined and the tool prints this message and exits with EXIT_FAILURE before running anything. It exists to give a clear reason instead of a link error or silent skip.

Source

Thrown at crypto/secp256k1/libsecp256k1/src/bench.c:203

    int invalid_args = have_invalid_args(argc, argv, valid_args, valid_args_size);

    if (argc > 1) {
        if (have_flag(argc, argv, "-h")
           || have_flag(argc, argv, "--help")
           || have_flag(argc, argv, "help")) {
            help(default_iters);
            return EXIT_SUCCESS;
        } else if (invalid_args) {
            fprintf(stderr, "./bench: unrecognized argument.\n\n");
            help(default_iters);
            return EXIT_FAILURE;
        }
    }

/* Check if the user tries to benchmark optional module without building it */
#ifndef ENABLE_MODULE_ECDH
    if (have_flag(argc, argv, "ecdh")) {
        fprintf(stderr, "./bench: ECDH module not enabled.\n");
        fprintf(stderr, "Use ./configure --enable-module-ecdh.\n\n");
        return EXIT_FAILURE;
    }
#endif

#ifndef ENABLE_MODULE_RECOVERY
    if (have_flag(argc, argv, "recover") || have_flag(argc, argv, "ecdsa_recover")) {
        fprintf(stderr, "./bench: Public key recovery module not enabled.\n");
        fprintf(stderr, "Use ./configure --enable-module-recovery.\n\n");
        return EXIT_FAILURE;
    }
#endif

#ifndef ENABLE_MODULE_SCHNORRSIG
    if (have_flag(argc, argv, "schnorrsig") || have_flag(argc, argv, "schnorrsig_sign") || have_flag(argc, argv, "schnorrsig_verify")) {
        fprintf(stderr, "./bench: Schnorr signatures module not enabled.\n");
        fprintf(stderr, "Use ./configure --enable-module-schnorrsig.\n\n");
        return EXIT_FAILURE;

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Reconfigure and rebuild with the module: ./configure --enable-module-ecdh && make -C src bench (in a standalone checkout of the same version)
  2. Or drop 'ecdh' from the bench invocation and benchmark only the enabled modules
  3. Confirm what is enabled in your build by checking config.h / the configure flags used by the build system

Example fix

# before
./configure && make     # ECDH not enabled
./bench ecdh            # -> ECDH module not enabled

# after
./configure --enable-module-ecdh && make
./bench ecdh
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/sh
# probe build config before selecting benchmarks
if grep -q '^#define ENABLE_MODULE_ECDH 1' libsecp256k1/src/../config.h 2>/dev/null; then
  MODS="ecdh"
else
  MODS=""   # skip ecdh on builds without the module
fi
./src/bench $MODS

Prevention

When it happens

Trigger: Invoking ./bench (or ./bench ecdh) on a libsecp256k1 build produced without ./configure --enable-module-ecdh. In geth's repo the vendored copy is built by cgo with a fixed configuration that does not enable ECDH, so any manual bench run asking for 'ecdh' hits this.

Common situations: Manually building the vendored crypto/secp256k1/libsecp256k1 bench after geth switched to the cgo build (which omits optional modules); porting bench commands from a distro libsecp256k1 that enabled all modules.

Related errors


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/e0ee9ebab744f450. Report an issue: GitHub.