From f14d8401a1ac86b37edc5e0c153b2b7f54c62d7d Mon Sep 17 00:00:00 2001 From: Casey Gardiner <117784577+ONECasey@users.noreply.github.com> Date: Sat, 24 Dec 2022 21:03:52 -0800 Subject: [PATCH] add openssl compatibility on m2 chips using darwin (#4302) Adds support for OpenSSL on MacOS Ventura using m2 chips. --- Makefile | 6 +++--- README.md | 6 +++--- scripts/go_executable_build.sh | 6 +++--- scripts/setup_bls_build_flags.sh | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 47633d7f3..b17964ebc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TOP:=$(realpath ..) -export CGO_CFLAGS:=-I$(TOP)/bls/include -I$(TOP)/mcl/include -I/usr/local/opt/openssl/include -export CGO_LDFLAGS:=-L$(TOP)/bls/lib -L/usr/local/opt/openssl/lib -export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/usr/local/opt/openssl/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl/lib +export CGO_CFLAGS:=-I$(TOP)/bls/include -I$(TOP)/mcl/include -I/opt/homebrew/opt/openssl@1.1/include +export CGO_LDFLAGS:=-L$(TOP)/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib +export LD_LIBRARY_PATH:=$(TOP)/bls/lib:$(TOP)/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib:/opt/homebrew/opt/gmp/lib/:/opt/homebrew/opt/openssl@1.1/lib export LIBRARY_PATH:=$(LD_LIBRARY_PATH) export DYLD_FALLBACK_LIBRARY_PATH:=$(LD_LIBRARY_PATH) export GO111MODULE:=on diff --git a/README.md b/README.md index 01c98dfd5..609ffd57f 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,9 @@ The `make` command should automatically build the Harmony binary & all dependent However, if you wish to bypass the Makefile, first export the build flags: ```bash -export CGO_CFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/usr/local/opt/openssl/include" -export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/usr/local/opt/openssl/lib" -export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/usr/local/opt/openssl/lib +export CGO_CFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/opt/homebrew/opt/openssl@1.1/include" +export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib" +export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib export LIBRARY_PATH=$LD_LIBRARY_PATH export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH export GO111MODULE=on diff --git a/scripts/go_executable_build.sh b/scripts/go_executable_build.sh index f5984c7dd..2c1cc99f0 100755 --- a/scripts/go_executable_build.sh +++ b/scripts/go_executable_build.sh @@ -41,9 +41,9 @@ if [ "$(uname -s)" == "Darwin" ]; then GOOS=darwin LIB[libbls384_256.dylib]=${BLS_DIR}/lib/libbls384_256.dylib LIB[libmcl.dylib]=${MCL_DIR}/lib/libmcl.dylib - LIB[libgmp.10.dylib]=/usr/local/opt/gmp/lib/libgmp.10.dylib - LIB[libgmpxx.4.dylib]=/usr/local/opt/gmp/lib/libgmpxx.4.dylib - LIB[libcrypto.1.1.dylib]=/usr/local/opt/openssl/lib/libcrypto.1.1.dylib + LIB[libgmp.10.dylib]=/opt/homebrew/opt/gmp/lib/libgmp.10.dylib + LIB[libgmpxx.4.dylib]=/opt/homebrew/opt/gmp/lib/libgmpxx.4.dylib + LIB[libcrypto.1.1.dylib]=/opt/homebrew/opt/openssl@1.1/lib/libcrypto.1.1.dylib else MD5=md5sum LIB[libbls384_256.so]=${BLS_DIR}/lib/libbls384_256.so diff --git a/scripts/setup_bls_build_flags.sh b/scripts/setup_bls_build_flags.sh index 9af1ca121..92ee20579 100644 --- a/scripts/setup_bls_build_flags.sh +++ b/scripts/setup_bls_build_flags.sh @@ -19,7 +19,7 @@ case "${HMY_PATH+set}" in fi ;; esac -: ${OPENSSL_DIR="/usr/local/opt/openssl"} +: ${OPENSSL_DIR="/opt/homebrew/opt/openssl@1.1"} : ${MCL_DIR="${HMY_PATH}/mcl"} : ${BLS_DIR="${HMY_PATH}/bls"} export CGO_CFLAGS="-I${BLS_DIR}/include -I${MCL_DIR}/include"