Giter VIP home page Giter VIP logo

Comments (7)

conradoplg avatar conradoplg commented on August 18, 2024

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.

YangRongAtGit avatar YangRongAtGit commented on August 18, 2024

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.

conradoplg avatar conradoplg commented on August 18, 2024

You need to set the architecture for RELIC with cmake -DARCH=arm -DWORD=32 . before running make.

from relic.

dfaranha avatar dfaranha commented on August 18, 2024

The present in https://github.com/relic-toolkit/relic/blob/master/preset/armdroid-pbc-128.sh may help you too.

from relic.

YangRongAtGit avatar YangRongAtGit commented on August 18, 2024

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.

YangRongAtGit avatar YangRongAtGit commented on August 18, 2024

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.

dfaranha avatar dfaranha commented on August 18, 2024

True, I now modified the official present to include the CP module. :)

from relic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.