From f4fc770b4462433b83c9639273dce6e9e3e9164c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 13 Oct 2023 23:22:58 +0700 Subject: [PATCH 1/2] fixed an issue with GMP not properly being linked --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d004a8c328..0f377338c9 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,17 @@ DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUI CGO_ENABLED ?= 1 GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/gogo/protobuf) +OS := $(shell uname) + +ifeq ($(OS),Darwin) # macOS + GMP_PREFIX := $(shell brew --prefix gmp 2>/dev/null) +endif +ifeq ($(OS),Linux) # Linux + # Typically on Linux, GMP would be in /usr/include and /usr/lib or /usr/local/include and /usr/local/lib + # but you might want to adjust if different: + GMP_PREFIX := /usr +endif + MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURR_DIR := $(dir $(MAKEFILE_PATH)) @@ -27,12 +38,14 @@ BLS_DIR="$(CURR_DIR)third_party/bls-signatures" CGO_LDFLAGS ?= -L$(BLS_DIR)/build/depends/mimalloc \ -L$(BLS_DIR)/build/depends/relic/lib \ -L$(BLS_DIR)/build/src \ +-L$(GMP_PREFIX)/lib \ -ldashbls -lrelic_s -lmimalloc-secure -lgmp CGO_CXXFLAGS ?= -I$(BLS_DIR)/build/depends/relic/include \ -I$(BLS_DIR)/src/depends/mimalloc/include \ -I$(BLS_DIR)/src/depends/relic/include \ --I$(BLS_DIR)/src/include +-I$(BLS_DIR)/src/include \ +-I$(GMP_PREFIX)/include GO := CGO_ENABLED=$(CGO_ENABLED) CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go From 64e7569f53cf85f6082e6e047b3ef1021c4b5cc6 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 13 Oct 2023 23:27:34 +0700 Subject: [PATCH 2/2] fixed an issue with GMP not properly being linked --- Makefile | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 0f377338c9..67c61379ae 100644 --- a/Makefile +++ b/Makefile @@ -19,17 +19,6 @@ DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUI CGO_ENABLED ?= 1 GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/gogo/protobuf) -OS := $(shell uname) - -ifeq ($(OS),Darwin) # macOS - GMP_PREFIX := $(shell brew --prefix gmp 2>/dev/null) -endif -ifeq ($(OS),Linux) # Linux - # Typically on Linux, GMP would be in /usr/include and /usr/lib or /usr/local/include and /usr/local/lib - # but you might want to adjust if different: - GMP_PREFIX := /usr -endif - MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURR_DIR := $(dir $(MAKEFILE_PATH)) @@ -38,14 +27,20 @@ BLS_DIR="$(CURR_DIR)third_party/bls-signatures" CGO_LDFLAGS ?= -L$(BLS_DIR)/build/depends/mimalloc \ -L$(BLS_DIR)/build/depends/relic/lib \ -L$(BLS_DIR)/build/src \ --L$(GMP_PREFIX)/lib \ -ldashbls -lrelic_s -lmimalloc-secure -lgmp CGO_CXXFLAGS ?= -I$(BLS_DIR)/build/depends/relic/include \ -I$(BLS_DIR)/src/depends/mimalloc/include \ -I$(BLS_DIR)/src/depends/relic/include \ --I$(BLS_DIR)/src/include \ --I$(GMP_PREFIX)/include +-I$(BLS_DIR)/src/include + +OS := $(shell uname) + +ifeq ($(OS),Darwin) # macOS + GMP_PREFIX := $(shell brew --prefix gmp 2>/dev/null) + CGO_LDFLAGS += -L$(GMP_PREFIX)/lib + CGO_CXXFLAGS += -I$(GMP_PREFIX)/include +endif GO := CGO_ENABLED=$(CGO_ENABLED) CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go