我们正在尝试为 Android构建 PALISADE ( https://git.njit.edu/palisade/PALISADE )。通过为 Android 成功构建“gmp”和“ntl”,我们取得了一些进展。
GMP 能够开箱即用地交叉编译。NTL 有点棘手。我们使用了https://github.com/nemirst/ntl-android但将标头和 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 构建。
编辑:拼写