we are trying to build PALISADE (https://git.njit.edu/palisade/PALISADE) for Android. We have made some Progress by building “gmp” and “ntl” successfully for Android.
GMP is able to cross compile out of the box. NTL was a bit more tricky. We used https://github.com/nemirst/ntl-android but changed the headers and src to the version provided within PALISADE (10.5.0)
We also did some changes to the PALISADE makefiles so they support cross compiling using the android standalone toolchains. The issue is now, when trying to compile PALISADE using the cross compiled NTL and GMP lib we get the following errors:
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
We would greatly appreciate any help in getting this library to build for Android.
EDIT: Spelling