Building Error in macOS

I’m using macOS Monterey version 12.6, make version 3.81, clang version 13.1.6, cmake version 3.24.2
The compiler was working perfectly, and executables of example files could be built without any problem. But now, when I try to build files by calling “make”, it throws errors regarding linker command.

[ 73%] Linking CXX executable ../../bin/examples/pke/depth-bgvrns
Undefined symbols for architecture x86_64:
  "void lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > >::CheckKey<std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > > > >(std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > > > const&, char const*, char const*, unsigned long) const", referenced from:
      lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > >::Encrypt(std::__1::shared_ptr<lbcrypto::PlaintextImpl>, std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<unsigned int> > > > >) const in depth-bgvrns.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/examples/pke/depth-bgvrns] Error 1
make[1]: *** [src/pke/CMakeFiles/depth-bgvrns.dir/all] Error 2
[ 73%] Building CXX object src/pke/CMakeFiles/pke_tests.dir/unittest/UnitTestMultihopPRE.cpp.o

When BUILD_UNITTESTS=ON, it detects more error.

/Users/weideng/openFHE/openfhe-development/src/pke/unittest/utbfvrns/UnitTestBFVrnsCRTOperations.cpp:92:19: error: conversion from 'long' to 'NativeInteger' (aka 'NativeIntegerT<unsigned long long>') is ambiguous
    NativeInteger modulus0 = 1152921504606846577;
                  ^          ~~~~~~~~~~~~~~~~~~~
/Users/weideng/openFHE/openfhe-development/src/core/include/math/hal/intnat/ubintnat.h:219:5: note: candidate constructor [with T = long, $1 = true]
    NativeIntegerT(T val) : m_value(val) {  // NOLINT
/Users/weideng/openFHE/openfhe-development/src/core/include/math/hal/intnat/ubintnat.h:242:5: note: candidate constructor [with T = long, $1 = true]
    NativeIntegerT(T val) : m_value(val.ConvertToInt()) {  // NOLINT

I also tried pervious version v0.9.3 and v0.9.0, but none of them works as well.
Any advice helps.
Thank you.

@dwx03 Hi, I am looking into this

Just merged all fixes in to the dev branch. Please confirm that you don’t see any errors using the dev branch. Thank you


Hi @dsuponitskiy-duality
I am stil getting the same errors. I also tried to run it on my friend’s MacOS Monterey 12.6 with clang version 14.0.0, cmake version 3.24.2, make version 3.81, but it still encountered above errors at around 70% completion. Thank you for your time.

@dwx03 did you try to link it using the dev branch?

@dsuponitskiy-duality My bad, I was cloning the master branch the whole time. It works prefectly right now. Thank you so much!

We will update the main branch with these fixes for the next release. Thank you

Hi, I have the same errors, tried the dev build but doesn’t work fails starting here, [ 71%] Linking CXX executable …/…/bin/examples/pke/advanced-ckks-bootstrapping

Undefined symbols for architecture arm64:

“void lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > > >::CheckKey<std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > > > > >(std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > > > > const&, char const*, char const*, unsigned long) const”, referenced from:

lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > > >::Encrypt(std::__1::shared_ptrlbcrypto::PlaintextImpl, std::__1::shared_ptr<lbcrypto::PublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint > > > >) const in advanced-ckks-bootstrapping.cpp.o

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/examples/pke/advanced-ckks-bootstrapping] Error 1
make[1]: *** [src/pke/CMakeFiles/advanced-ckks-bootstrapping.dir/all] Error 2

Have have the same versions of make, clang and cmake, I’m on an M2 chip. Any pointers or ideas?

Hi, did you link the latest version of dev?

I did use the dev branch and had updated clang to v14. I’m now getting other errors with cmake so looking at trying to fix those errors now. I did notice in the log file it says ‘M1’ was detected not sure if that matters (I’m on an M2).

My question was about the version of the dev branch. Can you check if you linked the latest version of it?

Hi. it should be the latest version I downloaded it a few hours ago to retry, but I’m getting cmake errors so not sure if it’s something unrelated with my system configuration or a compatibility issue?

Maybe something with this error from the CMakeError.log file, OpenMPCheckVersion.c:3:10: fatal error: ‘omp.h’ file not found
#include <omp.h>
1 error generated.
make[1]: *** [CMakeFiles/cmTC_dab4f.dir/OpenMPCheckVersion.c.o] Error 1
make: *** [cmTC_dab4f/fast] Error 2

And this error from cmake output,
CMake Error at CMakeLists.txt:686 (add_subdirectory):
The source directory


does not contain a CMakeLists.txt file.

from the command line:

$ git checkout dev

$ git show -s --format=“%H”

you should get 6b780ab2c151f6413ef19daefa006a3d0f2eb5d3. if you do not get this SHA, then you need to update your dev branch:

$ git pull

Also, did you follow the build instructions on this page:
Installing OpenFHE on MacOS — OpenFHE documentation?

Hi Yes I did follow the instructions. Thx

could you confirm that you used the latest revision of dev? because it looks like you tried to link an older one and I cannot replicate this error

Hi I’m not able to run those commands so will try again later in the day and let you know thank you!

I confirmed the SHA matches. I removed everything and started again, it’s building. Thanks so much for your support. I’m not sure what happened, but when I removed the clone and restarted again and reconfirmed everything (again) it worked. Greatly appreciate it

No problem at all. It did seem like a local problem on your side and I am glad that you managed to resolve it.