简体   繁体   English

Palisade 开发库无法编译示例代码

[英]Palisade development library can't compile example code

OS: Linux操作系统:Linux

I have been trying to run this example code from the Palisade FHE library for days.几天来,我一直在尝试从Palisade FHE 库运行此示例代码。 After successfully compiling the library itself, I tried to make a makefile for one of its example programs and get this very long error about a missing namespace.成功编译库本身后,我尝试为其示例程序之一制作 makefile 并得到这个关于缺少命名空间的非常长的错误。 I am a begginer at C++, and cannot decipher this error message.我是 C++ 的初学者,无法解读此错误消息。 For anyone who is specifically familiar with this library, g++ cannot find lbcrypto .对于特别熟悉此库的任何人, g++ 找不到lbcrypto I searched my entire system and did not find a file with this name.我搜索了整个系统,但没有找到具有此名称的文件。 I don't know where the namespace is located or how to include it in my makefile.我不知道命名空间的位置或如何将其包含在我的 makefile 中。 Here is the makefile and the error when I run make .这是 makefile 和我运行时的错误make

Makefile Makefile

CC = g++
 CFLAGS = -Wall -g

 main: simple-integers.o ; $(CC) $(CFLAGS) -l /usr/local/include/palisade/pke/ciphertext.h -o main simple-integers.o

simple-integers.o: simple-integers.cpp ; $(CC) $(CFLAGS) -c simple-integers.cpp -I /usr/local/include/palisade/pke/ -I /usr/local/include/palisade/core -I /usr/local/include/palisade

Error错误

/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:100: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorIlaptop% cat file.txt 
g++ -Wall -g -o main simple-integers.o 
/usr/bin/ld: simple-integers.o: warning: relocation against `_ZTVN8lbcrypto15IntegerEncodingE' in read-only section `.text._ZN8lbcrypto15IntegerEncodingC2ESt10shared_ptrINS_12ILDCRTParamsIN9bigintfxd10BigIntegerIjLj3500EEEEEES1_INS_18EncodingParamsImplEE[_ZN8lbcrypto15IntegerEncodingC5ESt10shared_ptrINS_12ILDCRTParamsIN9bigintfxd10BigIntegerIjLj3500EEEEEES1_INS_18EncodingParamsImplEE]' 
/usr/bin/ld: /usr/bin/ld: DWARF error: could not find variable specification at offset 42f44 
simple-integers.o: in function `main': 
/home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:40: undefined reference to `lbcrypto::CryptoContextFactory<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::genCryptoContextBFVrns(unsigned long, lbcrypto::SecurityLevel, float, unsigned int, unsigned int, unsigned int, MODE, int, unsigned int, unsigned long, unsigned int)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:55: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalMultKeyGen(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:58: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndexKeyGen(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::vector<int, std::allocator<int> > const&, std::shared_ptr<lbcrypto::LPPublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:90: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:91: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:92: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:93: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:100: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:105: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:109: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:111: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:113: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: simple-integers.o:/home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:115: more undefined references to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' follow 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::PlaintextImpl::PlaintextImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>, bool)': 
/usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > >::PolyImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, Format, bool)' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintnat::NativeVector<bigintnat::NativeIntegerT<unsigned long> > >::PolyImpl()' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > >::DCRTPolyImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, Format, bool)' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintnat::NativeVector<bigintnat::NativeIntegerT<unsigned long> > >::~PolyImpl()' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > >::~PolyImpl()' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::CKKSPackedEncoding::CKKSPackedEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/local/include/palisade/core/encoding/ckkspackedencoding.h:67: undefined reference to `vtable for lbcrypto::CKKSPackedEncoding' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::CoefPackedEncoding::CoefPackedEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/local/include/palisade/core/encoding/coefpackedencoding.h:48: undefined reference to `vtable for lbcrypto::CoefPackedEncoding' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::FractionalEncoding::FractionalEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/local/include/palisade/core/encoding/fractionalencoding.h:67: undefined reference to `vtable for lbcrypto::FractionalEncoding' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::IntegerEncoding::IntegerEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/local/include/palisade/core/encoding/integerencoding.h:46: undefined reference to `vtable for lbcrypto::IntegerEncoding' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::PackedEncoding::PackedEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::ScalarEncoding::ScalarEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/local/include/palisade/core/encoding/scalarencoding.h:46: undefined reference to `vtable for lbcrypto::ScalarEncoding' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::StringEncoding::StringEncoding(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>)': 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::KeyGen()': 
/usr/local/include/palisade/pke/cryptocontext.h:939: undefined reference to `lbcrypto::CryptoContextFactory<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::GetContextForPointer(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >*)' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalMult(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>) const': 
/usr/local/include/palisade/pke/cryptocontext.h:2522: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::GetEvalMultKeyVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' 
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE 
collect2: error: ld returned 1 exit status 
make: *** [Makefile:4: main] Error 1 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:100: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorIlaptop% cat file.txt 
g++ -Wall -g -o main simple-integers.o 
/usr/bin/ld: simple-integers.o: warning: relocation against `_ZTVN8lbcrypto15IntegerEncodingE' in read-only section `.text._ZN8lbcrypto15IntegerEncodingC2ESt10shared_ptrINS_12ILDCRTParamsIN9bigintfxd10BigIntegerIjLj3500EEEEEES1_INS_18EncodingParamsImplEE[_ZN8lbcrypto15IntegerEncodingC5ESt10shared_ptrINS_12ILDCRTParamsIN9bigintfxd10BigIntegerIjLj3500EEEEEES1_INS_18EncodingParamsImplEE]' 
/usr/bin/ld: /usr/bin/ld: DWARF error: could not find variable specification at offset 42f44 
simple-integers.o: in function `main': 
/home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:40: undefined reference to `lbcrypto::CryptoContextFactory<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::genCryptoContextBFVrns(unsigned long, lbcrypto::SecurityLevel, float, unsigned int, unsigned int, unsigned int, MODE, int, unsigned int, unsigned long, unsigned int)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:55: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalMultKeyGen(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:58: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndexKeyGen(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::vector<int, std::allocator<int> > const&, std::shared_ptr<lbcrypto::LPPublicKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:90: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:91: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:92: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:93: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalAtIndex(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, int) const' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:100: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:105: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:109: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:111: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: /home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:113: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' 
/usr/bin/ld: simple-integers.o:/home/admin/Libraries/palisade-release/src/pke/examples/simple-integers.cpp:115: more undefined references to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::Decrypt(std::shared_ptr<lbcrypto::LPPrivateKeyImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > >, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::PlaintextImpl>*)' follow 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::PlaintextImpl::PlaintextImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, std::shared_ptr<lbcrypto::EncodingParamsImpl>, bool)': 
/usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > >::PolyImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, Format, bool)' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::PolyImpl<bigintnat::NativeVector<bigintnat::NativeIntegerT<unsigned long> > >::PolyImpl()' 
/usr/bin/ld: /usr/local/include/palisade/core/encoding/plaintext.h:148: undefined reference to `lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > >::DCRTPolyImpl(std::shared_ptr<lbcrypto::ILDCRTParams<bigintfxd::BigInteger<unsigned int, 3500u> > >, Format, bool)' 
/usr/bin/ld: simple-integers.o: in function `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::EvalMult(std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>, std::shared_ptr<lbcrypto::CiphertextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > > const>) const': 
/usr/local/include/palisade/pke/cryptocontext.h:2522: undefined reference to `lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintfxd::BigVectorImpl<bigintfxd::BigInteger<unsigned int, 3500u> > > >::GetEvalMultKeyVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' 
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE 
collect2: error: ld returned 1 exit status 
make: *** [Makefile:4: main] Error 1

The sample code I tried to compile我尝试编译的示例代码

// @file  simple-integers.cpp - Simple example for BFVrns (integer arithmetic).
// @author TPOC: contact@palisade-crypto.org
//
// @copyright Copyright (c) 2019, New Jersey Institute of Technology (NJIT))
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. THIS SOFTWARE IS
// PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "palisade.h"

using namespace lbcrypto;

int main() {
  // Sample Program: Step 1: Set CryptoContext

  // Set the main parameters
  int plaintextModulus = 65537;
  double sigma = 3.2;
  SecurityLevel securityLevel = HEStd_128_classic;
  uint32_t depth = 2;

  // Instantiate the crypto context
  CryptoContext<DCRTPoly> cryptoContext =
      CryptoContextFactory<DCRTPoly>::genCryptoContextBFVrns(
          plaintextModulus, securityLevel, sigma, 0, depth, 0, OPTIMIZED);

  // Enable features that you wish to use
  cryptoContext->Enable(ENCRYPTION);
  cryptoContext->Enable(SHE);

  // Sample Program: Step 2: Key Generation

  // Initialize Public Key Containers
  LPKeyPair<DCRTPoly> keyPair;

  // Generate a public/private key pair
  keyPair = cryptoContext->KeyGen();

  // Generate the relinearization key
  cryptoContext->EvalMultKeyGen(keyPair.secretKey);

  // Generate the rotation evaluation keys
  cryptoContext->EvalAtIndexKeyGen(keyPair.secretKey, {1, 2, -1, -2});

  // Sample Program: Step 3: Encryption

  // First plaintext vector is encoded
  std::vector<int64_t> vectorOfInts1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  Plaintext plaintext1 = cryptoContext->MakePackedPlaintext(vectorOfInts1);
  // Second plaintext vector is encoded
  std::vector<int64_t> vectorOfInts2 = {3, 2, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  Plaintext plaintext2 = cryptoContext->MakePackedPlaintext(vectorOfInts2);
  // Third plaintext vector is encoded
  std::vector<int64_t> vectorOfInts3 = {1, 2, 5, 2, 5, 6, 7, 8, 9, 10, 11, 12};
  Plaintext plaintext3 = cryptoContext->MakePackedPlaintext(vectorOfInts3);

  // The encoded vectors are encrypted
  auto ciphertext1 = cryptoContext->Encrypt(keyPair.publicKey, plaintext1);
  auto ciphertext2 = cryptoContext->Encrypt(keyPair.publicKey, plaintext2);
  auto ciphertext3 = cryptoContext->Encrypt(keyPair.publicKey, plaintext3);

  // Sample Program: Step 4: Evaluation

  // Homomorphic additions
  auto ciphertextAdd12 = cryptoContext->EvalAdd(ciphertext1, ciphertext2);
  auto ciphertextAddResult =
      cryptoContext->EvalAdd(ciphertextAdd12, ciphertext3);

  // Homomorphic multiplications
  auto ciphertextMul12 = cryptoContext->EvalMult(ciphertext1, ciphertext2);
  auto ciphertextMultResult =
      cryptoContext->EvalMult(ciphertextMul12, ciphertext3);

  // Homomorphic rotations
  auto ciphertextRot1 = cryptoContext->EvalAtIndex(ciphertext1, 1);
  auto ciphertextRot2 = cryptoContext->EvalAtIndex(ciphertext1, 2);
  auto ciphertextRot3 = cryptoContext->EvalAtIndex(ciphertext1, -1);
  auto ciphertextRot4 = cryptoContext->EvalAtIndex(ciphertext1, -2);

  // Sample Program: Step 5: Decryption

  // Decrypt the result of additions
  Plaintext plaintextAddResult;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextAddResult,
                         &plaintextAddResult);

  // Decrypt the result of multiplications
  Plaintext plaintextMultResult;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextMultResult,
                         &plaintextMultResult);

  // Decrypt the result of rotations
  Plaintext plaintextRot1;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextRot1, &plaintextRot1);
  Plaintext plaintextRot2;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextRot2, &plaintextRot2);
  Plaintext plaintextRot3;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextRot3, &plaintextRot3);
  Plaintext plaintextRot4;
  cryptoContext->Decrypt(keyPair.secretKey, ciphertextRot4, &plaintextRot4);

  plaintextRot1->SetLength(vectorOfInts1.size());
  plaintextRot2->SetLength(vectorOfInts1.size());
  plaintextRot3->SetLength(vectorOfInts1.size());
  plaintextRot4->SetLength(vectorOfInts1.size());

  std::cout << "Plaintext #1: " << plaintext1 << std::endl;
  std::cout << "Plaintext #2: " << plaintext2 << std::endl;
  std::cout << "Plaintext #3: " << plaintext3 << std::endl;

  // Output results
  std::cout << "\nResults of homomorphic computations" << std::endl;
  std::cout << "#1 + #2 + #3: " << plaintextAddResult << std::endl;
  std::cout << "#1 * #2 * #3: " << plaintextMultResult << std::endl;
  std::cout << "Left rotation of #1 by 1: " << plaintextRot1 << std::endl;
  std::cout << "Left rotation of #1 by 2: " << plaintextRot2 << std::endl;
  std::cout << "Right rotation of #1 by 1: " << plaintextRot3 << std::endl;
  std::cout << "Right rotation of #1 by 2: " << plaintextRot4 << std::endl;

  return 0;
}

Some errors were ommited for brevity.为简洁起见,省略了一些错误。

I would like to ask a clarifying question.我想问一个澄清的问题。 Why are you trying to manually write a Makefile file rather than use the PALISADE-recommended approach based on cmake ?您为什么要尝试手动编写Makefile文件,而不是使用基于cmake的 PALISADE 推荐方法? The instructions are available at https://gitlab.com/palisade/palisade-development/-/wikis/Instructions-for-building-user-projects-that-use-PALISADE .这些说明可在https://gitlab.com/palisade/palisade-development/-/wikis/Instructions-for-building-user-projects-that-use-PALISADE 获得 You should be able to just copy the CmakeList.txt user example and make minor changes to get it to compile.您应该能够只复制CmakeList.txt用户示例并进行细微更改以使其编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM