Skip to content

Commit

Permalink
[crypto] Fix relic build script for ARM
Browse files Browse the repository at this point in the history
Detect if we're compiling on an ARM and drop the unsupported `-march=native` there.

Fixes #809.
  • Loading branch information
huitseeker committed Jun 11, 2021
1 parent d689298 commit 1566b16
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crypto/relic_build.sh
Expand Up @@ -17,12 +17,21 @@ pushd "$DIR/relic/build"
#
GENERAL=(-DTIMER=CYCLE -DCHECK=OFF -DVERBS=OFF)
LIBS=(-DSHLIB=OFF -DSTLIB=ON)
COMP=(-DCOMP="-O3 -funroll-loops -fomit-frame-pointer -march=native -mtune=native")

# "-march=native" is not supported on ARM
ARCH=$(uname -m 2>/dev/null ||true)
ARCH=${ARCH:-x86_64}
if [[ "$ARCH" =~ ^(arm64|armv7|armv7s)$ ]]; then
COMP=(-DCOMP="-O3 -funroll-loops -fomit-frame-pointer -mtune=native")
else
COMP=(-DCOMP="-O3 -funroll-loops -fomit-frame-pointer -march=native -mtune=native")
fi

RAND=(-DRAND=HASHD -DSEED=)

#
BN_REP=(-DALLOC=AUTO -DALIGN=1 -DWSIZE=64 -DBN_PRECI=1024 -DBN_MAGNI=DOUBLE)
ARITH=(-DARITH=EASY)
ARITH=(-DARITH=EASY)
PRIME=(-DFP_PRIME=381)

#
Expand Down Expand Up @@ -51,4 +60,4 @@ make relic_s -j8
rm -f CMakeCache.txt

popd
popd
popd

0 comments on commit 1566b16

Please sign in to comment.