Comments (7)
I did it once. The easier way is to build a standalone toolchain. With the CC variable exported as described there, just call cmake and make according the RELIC's instructions. This will result in a .a library which can be called by your Android application (you will still need to write the necessary JNI Java glue to call it)
from relic.
Hi conradoplg, thanks for your reply, I tried to follow the google guild. I am able to call <relic_root>\build\cmake ..
to config the project. But when I call <relic_root>\build\make
I got following errors:
arm-linux-androideabi-gcc-4.9.x: error: unrecognized command line option '-m64'
src/CMakeFiles/relic.dir/build.make:62: recipe for target 'src/CMakeFiles/relic.dir/relic_err.c.o' failed
make[2]: *** [src/CMakeFiles/relic.dir/relic_err.c.o] Error 1
CMakeFiles/Makefile2:120: recipe for target 'src/CMakeFiles/relic.dir/all' failed
make[1]: *** [src/CMakeFiles/relic.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Did you have the same problem when you build the library for android?
from relic.
You need to set the architecture for RELIC with cmake -DARCH=arm -DWORD=32 .
before running make
.
from relic.
The present in https://github.com/relic-toolkit/relic/blob/master/preset/armdroid-pbc-128.sh may help you too.
from relic.
Thanks for your suggestions. I modified the script that dfaranha suggested (since I am targeting different api level). It compiled successfully.
DROID_API_LV=android-22
#export NDK=/opt/android-ndk
#export NDK=$ANDROID_NDK
export NDK=<ndk_path>
SYSROOT=$NDK/platforms/$DROID_API_LV/arch-arm
COMPILER_PREFIX=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
export CC="${COMPILER_PREFIX}gcc --sysroot=$SYSROOT"
export CXX="${COMPILER_PREFIX}g++ --sysroot=$SYSROOT"
export LD= "${COMPILER_PREFIX}ld --sysroot=$SYSROOT"
export CPP="${COMPILER_PREFIX}cpp --sysroot=$SYSROOT"
export AS="${COMPILER_PREFIX}as --sysroot=$SYSROOT"
export OBJCOPY="${COMPILER_PREFIX}objcopy --sysroot=$SYSROOT"
export OBJDUMP="${COMPILER_PREFIX}objdump --sysroot=$SYSROOT"
export STRIP="${COMPILER_PREFIX}strip --sysroot=$SYSROOT"
export RANLIB="${COMPILER_PREFIX}ranlib --sysroot=$SYSROOT"
export CCLD="${COMPILER_PREFIX}gcc --sysroot=$SYSROOT"
export AR="${COMPILER_PREFIX}ar --sysroot=$SYSROOT"
cmake -DWITH="DV;BN;MD;FP;EP;FPX;EPX;PP;PC" -DCHECK=off -DARITH=arm-asm-254 -DARCH=ARM -DCOLOR=off -DOPSYS=DROID -DFP_PRIME=254 -DFP_QNRES=on -DFP_METHD="INTEG;INTEG;INTEG;MONTY;EXGCD;SLIDE" -DFPX_METHD="INTEG;INTEG;LAZYR" -DPP_METHD="LAZYR;OATEP" -DCOMP="-O3 -funroll-loops -fomit-frame-pointer -I$NDK/platforms/$DROID_API_LV/arch-arm/usr/include" -DLINK="-L/opt/android-ndk/platforms/$DROID_API_LV/arch-arm/usr/lib/ -llog" -DTIMER=HREAL -DWORD=32 -DSTLIB=on -DSHLIB=off $1
Then in the build folder:
relic/build$: cmake ..
relic/build$: make
from relic.
To fix the linking errors:
./../../SCF/libs/OC/OwnerClient/main.cpp:192: error: undefined reference to 'cp_bgn_gen'
./../../SCF/libs/Common/commonfunc.cpp:878: error: undefined reference to 'cp_bgn_enc1'
./../../SCF/libs/Common/commonfunc.cpp:879: error: undefined reference to 'cp_bgn_enc2'
./../../SCF/libs/Common/commonfunc.cpp:883: error: undefined reference to 'cp_bgn_enc1'
./../../SCF/libs/Common/commonfunc.cpp:884: error: undefined reference to 'cp_bgn_enc2'
./../../SCF/libs/Common/commonfunc.cpp:904: error: undefined reference to 'cp_bgn_dec1'
./../../SCF/libs/Common/commonfunc.cpp:907: error: undefined reference to 'cp_bgn_dec2'
./../../SCF/libs/Common/commonfunc.cpp:1028: error: undefined reference to 'cp_bgn_enc1'
./../../SCF/libs/Common/commonfunc.cpp:1029: error: undefined reference to 'cp_bgn_enc1'
./../../SCF/libs/Common/commonfunc.cpp:1032: error: undefined reference to 'cp_bgn_enc2'
./../../SCF/libs/Common/commonfunc.cpp:1033: error: undefined reference to 'cp_bgn_enc2'
./../../SCF/libs/Common/commonfunc.cpp:1034: error: undefined reference to 'cp_bgn_mul'
./../../SCF/libs/Common/commonfunc.cpp:1035: error: undefined reference to 'cp_bgn_mul'
./../../SCF/libs/Common/commonfunc.cpp:1036: error: undefined reference to 'cp_bgn_mul'
./../../SCF/libs/Common/commonfunc.cpp:1050: error: undefined reference to 'cp_bgn_mul'
./../../SCF/libs/Common/commonfunc.cpp:1094: error: undefined reference to 'cp_bgn_add'
./../../SCF/libs/Common/commonfunc.cpp:1097: error: undefined reference to 'cp_bgn_add'
./../../SCF/libs/Common/commonfunc.cpp:1100: error: undefined reference to 'cp_bgn_add'
./../../SCF/libs/Common/commonfunc.cpp:1106: error: undefined reference to 'cp_bgn_add'
./../../SCF/libs/Common/commonfunc.cpp:1219: error: undefined reference to 'cp_bgn_dec'
./../../SCF/libs/Common/commonfunc.cpp:1245: error: undefined reference to 'cp_bgn_dec'
./../../SCF/libs/Common/commonfunc.cpp:1247: error: undefined reference to 'cp_bgn_dec'
./../../SCF/libs/Common/commonfunc.cpp:1253: error: undefined reference to 'cp_bgn_dec'
The module Cryptographic protocols
is required. The parameter CP
is required in the definition of WITH
.
Instead of using
-DWITH="DV;BN;MD;FP;EP;FPX;EPX;PP;PC"
-DWITH="DV;BN;MD;FP;EP;FPX;EPX;PP;PC;CP"
is required
from relic.
True, I now modified the official present to include the CP module. :)
from relic.
Related Issues (20)
- Is it possible to implement DH Key Exchange X25519 with Relic? HOT 1
- test_ep fails with x64-pbc-bls12-381 preset HOT 4
- RISCV64 Support HOT 1
- How to convert a fp12_t value into bn_t HOT 6
- Error thrown in Optimal Ate Pairing HOT 2
- bench_rand.c not compiling with RAND=CALL HOT 1
- Error in the KSS-18-638 curve initialization function HOT 5
- Unable to install presets on M1 chip arm64 HOT 3
- Error in ep_param_set() HOT 8
- can not deduce the macro WSIZE on Apple M2 HOT 4
- BLS signatures with point compression HOT 2
- Want to use BN_254 curve HOT 1
- Build failure since recent commit HOT 1
- Compile failure on recent master HOT 4
- Compiling on M1 Mac HOT 1
- Compile Failue with x64-ecc-128 preset HOT 3
- cmake error the target not found HOT 2
- Homegaming HOT 1
- Leak the Secret Key of BBS Short Signature in Relic via Rowhammer HOT 4
- /demo/ers-etrs code running error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relic.