Is there an easy way to disable exceptions in OpenFHE?

I would like to build OpenFHE for compatibility with manylinux_2_28, which does not support exceptions. I can compile with -fnoexceptions and then I get

external/openfhe/src/core/lib/utils/prng/blake2engine.cpp:53:9: error: exception handling disabled, use '-fexceptions' to enable
   53 |         OPENFHE_THROW("PRNG: blake2xb failed");

What is the recommended way to turn off exceptions?

We don’t normally do this and there is no mechanism for that, but If you need to disable all exceptions, you can modify src/core/include/utils/exception.h by commenting out most of its content (including some includes), and keeping only two things:

  1. The macro OPENFHE_THROW
  2. The helper function member from OpenFHEException:
    static std::string buildErrorMessage(const std::string& file,
    const std::string& func,
    std::size_t line,
    const std::string& desc) {
    return file + “:l.” + std::to_string(line) + “:” + func + "(): " + desc;
    }

After that, you’ll likely want to make buildErrorMessage() inline and redefine the macro like this:
#define OPENFHE_THROW(desc) { \
std::cerr << buildErrorMessage(_FILE_, _func_, _LINE_, (desc)) << std::endl; \
std::abort(); }

Also, keep the compiler option enabled. It may be needed