简体   繁体   English

交叉编译 PALSIADE for android

[英]Cross Compiling PALSIADE for android

we are trying to build PALISADE ( https://git.njit.edu/palisade/PALISADE ) for Android.我们正在尝试为 Android 构建 PALISADE ( https://git.njit.edu/palisade/PALISADE )。 We have made some Progress by building “gmp” and “ntl” successfully for Android.我们通过为 Android 成功构建“gmp”和“ntl”取得了一些进展。

GMP is able to cross compile out of the box. GMP 能够开箱即用地进行交叉编译。 NTL was a bit more tricky. NTL 有点棘手。 We used https://github.com/nemirst/ntl-android but changed the headers and src to the version provided within PALISADE (10.5.0)我们使用了https://github.com/nemirst/ntl-android但将标头和 src 更改为 PALISADE (10.5.0) 中提供的版本

We also did some changes to the PALISADE makefiles so they support cross compiling using the android standalone toolchains.我们还对 PALISADE makefile 进行了一些更改,以便它们支持使用 android 独立工具链进行交叉编译。 The issue is now, when trying to compile PALISADE using the cross compiled NTL and GMP lib we get the following errors:现在的问题是,当尝试使用交叉编译的 NTL 和 GMP 库编译 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

We would greatly appreciate any help in getting this library to build for Android.我们将非常感谢任何帮助让这个库为 Android 构建。

EDIT: Spelling编辑:拼写

This is a little late in response, but if you are still interested, newer versions of Palisade do not require GMP or NTL (those are only enabled when the user explicitly enables them in the CMake build process), so it may be easier to build now.这响应有点晚,但如果您仍然感兴趣,新版本的 Palisade 不需要 GMP 或 NTL(只有当用户在 CMake 构建过程中明确启用它们时才会启用它们),因此构建可能更容易现在。 You should be using the newest stable version at https://gitlab.com/palisade/palisade-release or if you are willing to try it out, the development version at https://gitlab.com/palisade/palisade-development您应该使用https://gitlab.com/palisade/palisade-release 上的最新稳定版本,或者如果您愿意尝试,请使用 https://gitlab.com/palisade/palisade-development 上的开发版本

Cross compiling is a bit tricky, but it can be done.交叉编译有点棘手,但可以做到。 We are working on some embedded targets but they are not yet in the release stream.我们正在研究一些嵌入式目标,但它们尚未在发布流中。

We are looking into supporting an Android port in a future release, so any progress you make that you can share with us is most appreciated.我们正在考虑在未来版本中支持 Android 端口,因此非常感谢您可以与我们分享的任何进展。 Dave Cousins -- PALISADE Development team. Dave Cousins——PALISADE 开发团队。

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

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