我们正在尝试为Android构建PALISADE(https://git.njit.edu/palisade/PALISADE)。通过成功为Android构建“gmp”和“ntl”,我们取得了一些进展。

GMP可以立即进行交叉编译。 NTL有点棘手。我们使用了https://github.com/nemirst/ntl-android,但将 header 和src更改为PALISADE(10.5.0)中提供的版本

我们还对PALISADE makefile进行了一些更改,因此它们支持使用android独立工具链进行交叉编译。现在的问题是,当尝试使用交叉编译的NTL和GMP lib编译PALISADE时,出现以下错误:

PALISADE/bin/build/toolchains/aarch64-linux-android/bin/aarch64-linux-android-gcc --sysroot=PALISADE/bin/build/toolchains/aarch64-linux-android/sysroot -g -Wall -Werror -O3 -fopenmp -pthread -I src -Isrc/core/lib -Isrc/pke/lib -Isrc/abe/lib -Isrc/signature/lib -I test -I /opt/local/include/libomp -fopenmp -I third-party/include -I third-party/include/rapidjson -c -o bin/build/core/lib/math/benative-math-impl.o src/core/lib/math/benative-math-impl.cpp
In file included from src/core/lib/math/benative-math-impl.cpp:28:
In file included from src/core/lib/utils/../math/backend.h:43:
src/core/lib/math/native_int/binint.h:956:79: error: no viable conversion from 'const unsigned long' to 'NTL::wide_double'
                return (uint_type)NTL::MulModPrecon(this->m_value,b.m_value,modulus.m_value,bInv.m_value);
                                                                                            ^~~~~~~~~~~~
src/core/lib/math/transfrm.cpp:192:33: note: in instantiation of member function 'native_int::NativeInteger<unsigned long>::ModMulPreconOptimized' requested here
                                                        InputToFFT[i]=element[i].ModMulPreconOptimized((*rootOfUnityTable)[i],modulus,preconTable[i]);
                                                                                 ^
third-party/include/NTL/sp_arith.h:405:4: note: candidate constructor not viable: no known conversion from 'const unsigned long' to 'const NTL::wide_double &' for 1st argument
   wide_double(const wide_double& x) : data(x.data) { }
   ^
third-party/include/NTL/sp_arith.h:812:62: note: passing argument to parameter 'bninv' here
inline long MulModPrecon(long a, long b, long n, wide_double bninv)
                                                             ^
In file included from src/core/lib/math/benative-math-impl.cpp:36:
src/core/lib/math/transfrm.cpp:107:48: error: too many arguments to function call, expected 4, have 5
                                preconRootOfUnityInverseTable, cycloOrder, ans);
                                                                           ^~~
src/core/lib/math/transfrm.cpp:300:38: note: in instantiation of member function 'lbcrypto::NumberTheoreticTransform<native_int::NativeVector<native_int::NativeInteger<unsigned long> > >::InverseTransformIterative' requested here
                NumberTheoreticTransform<VecType>::InverseTransformIterative(element, *rootOfUnityITable,
                                                   ^
src/core/lib/math/transfrm.h:67:3: note: 'ForwardTransformIterative' declared here
                static void ForwardTransformIterative(const VecType& element, const VecType &rootOfUnityTable, const usint cycloOrder, VecType* result) {
                ^
In file included from src/core/lib/math/benative-math-impl.cpp:28:
In file included from src/core/lib/utils/../math/backend.h:43:
src/core/lib/math/native_int/binint.h:975:88: error: no viable conversion from 'const unsigned long' to 'NTL::wide_double'
                this->m_value = (uint_type)NTL::MulModPrecon(this->m_value,b.m_value,modulus.m_value,bInv.m_value);
                                                                                                     ^~~~~~~~~~~~
src/core/lib/math/transfrm.cpp:313:21: note: in instantiation of member function 'native_int::NativeInteger<unsigned long>::ModMulPreconOptimizedEq' requested here
                                                        (*OpIFFT)[i].ModMulPreconOptimizedEq((*rootOfUnityITable)[i],nativeModulus,preconTable[i]);
                                                                     ^
third-party/include/NTL/sp_arith.h:405:4: note: candidate constructor not viable: no known conversion from 'const unsigned long' to 'const NTL::wide_double &' for 1st argument
   wide_double(const wide_double& x) : data(x.data) { }
   ^
third-party/include/NTL/sp_arith.h:812:62: note: passing argument to parameter 'bninv' here
inline long MulModPrecon(long a, long b, long n, wide_double bninv)
                                                             ^
3 errors generated.
make[1]: *** [bin/build/core/lib/math/benative-math-impl.o] Error 1
make: *** [all] Error 2

我们非常感谢您为该库构建Android版。

编辑:拼写

最佳答案

这有点迟了,但如果您仍然感兴趣,则较新版本的Palisade不需要GMP或NTL(仅当用户在CMake构建过程中明确启用它们时才启用它们),因此构建起来可能会更容易现在。您应该使用https://gitlab.com/palisade/palisade-release上的最新稳定版本,或者如果愿意尝试,可以使用https://gitlab.com/palisade/palisade-development上的开发版本。
交叉编译有些棘手,但是可以做到。我们正在开发一些嵌入式目标,但它们尚未发布。
我们正在考虑在将来的版本中支持Android端口,因此,您能与我们共享的任何进展都将受到赞赏。
Dave Cousins-PALISADE开发团队。

关于android - 适用于Android的交叉编译PALSIADE,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55966842/

10-12 01:54