Receiving an error while trying to use OpenFHE as part of a project

I’m trying to build a project that is using OpenFHE see pTensor which uses OpenFHE for numerical computation. However, I’m running into a build issue:

In file included from /usr/local/include/openfhe/core/math/hal/bigintbackend.h:70,
                 from /usr/local/include/openfhe/core/math/hal.h:55,
                 from /usr/local/include/openfhe/core/openfhecore.h:41,
                 from /usr/local/include/openfhe/pke/openfhe.h:40,
                 from /home/iq/CLionProjects/pTensor/src/p_tensor.h:34,
                 from /home/iq/CLionProjects/pTensor/src/p_tensor.cpp:5:
/usr/local/include/openfhe/core/math/hal/bigintfxd/backendfxd.h: In function ‘const string& GetMathBackendParameters()’:
/usr/local/include/openfhe/core/math/hal/bigintfxd/backendfxd.h:48:57: error: ‘MATHBACKEND’ was not declared in this scope
   48 |     static std::string id = "Backend " + std::to_string(MATHBACKEND) +
      |                                                         ^~~~~~~~~~~
/usr/local/include/openfhe/core/math/hal/bigintfxd/backendfxd.h:48:57: note: the macro ‘MATHBACKEND’ had not yet been defined
In file included from /usr/local/include/openfhe/core/math/hal.h:55,
                 from /usr/local/include/openfhe/core/openfhecore.h:41,
                 from /usr/local/include/openfhe/pke/openfhe.h:40,
                 from /home/iq/CLionProjects/pTensor/src/p_tensor.h:34,
                 from /home/iq/CLionProjects/pTensor/src/p_tensor.cpp:5:
/usr/local/include/openfhe/core/math/hal/bigintbackend.h:75: note: it was later defined here
   75 |     #define MATHBACKEND 2
      |

I’m not sure if it’s an error on my end (including things in the wrong order). This is on a fresh install of the main branch of OpenFHE if that helps. My OpenFHE CMake output was:

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-11 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-11 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building in Release mode
-- BUILD_UNITTESTS:  ON
-- BUILD_EXAMPLES:   ON
-- BUILD_BENCHMARKS: ON
-- BUILD_EXTRAS:     OFF
-- BUILD_DOCS:       OFF
-- BUILD_STATIC:     OFF
-- BUILD_SHARED:     ON
-- GIT_SUBMOD_AUTO:  ON
-- WITH_BE2:         ON
-- WITH_BE4:         ON
-- WITH_NTL:         OFF
-- WITH_TCM:         OFF
-- WITH_INTEL_HEXL:  OFF
-- WITH_OPENMP:      ON
-- NATIVE_SIZE:      64
-- CKKS_M_FACTOR:    1
-- WITH_NATIVEOPT:   OFF
-- WITH_COVTEST:     OFF
-- BUILTIN_INFO_AVAILABLE is defined
***** INSTALL IS AT /usr/local; to change, run cmake with -DCMAKE_INSTALL_PREFIX=/your/path
-- Architecture is x86_64
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of __int128
-- Check size of __int128 - done
-- Check size of uint64_t
-- Check size of uint64_t - done
-- NATIVEINT is set to 64
-- MATHBACKEND is set to 2
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found Git: /usr/bin/git (found version "2.37.0")
-- Submodule update
Synchronizing submodule url for 'third-party/cereal'
Synchronizing submodule url for 'third-party/google-benchmark'
Synchronizing submodule url for 'third-party/google-test'
Synchronizing submodule url for 'third-party/gperftools'
-- LLVM FileCheck Found: /usr/bin/FileCheck
-- git version: v1.5.5-14-ge451e50e normalized to 1.5.5.14
-- Version: 1.5.5.14
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/iq/openfhe-development/build

My MATH_BACKEND was set to 2 as we can see. I’m not sure what is happening here. Could I get some insight?

@iquah Are you still having this issue? Based on the error message, it looks like you tried it before OpenFHE 0.9.0 was released (before the first pre-release).