From 3d97799863910e2253b984e5291e7b159ac64ec1 Mon Sep 17 00:00:00 2001 From: Ilya Raykker Date: Fri, 1 Nov 2024 13:36:19 +0400 Subject: [PATCH] Fix sgx_epid linking issue --- Makefile | 4 ---- go-cosmwasm/Makefile | 5 +++++ go-cosmwasm/api/link_std.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0dab63d85..02d3b8a9a 100644 --- a/Makefile +++ b/Makefile @@ -148,10 +148,6 @@ GO_TAGS := $(build_tags) # -ldflags LD_FLAGS := $(ldflags) -ifeq ($(SGX_MODE), HW) - CGO_LDFLAGS += $(shell pkg-config --libs libsgx_epid) -endif - all: build_all go.sum: go.mod diff --git a/go-cosmwasm/Makefile b/go-cosmwasm/Makefile index c8c3d18dd..0272ebf49 100644 --- a/go-cosmwasm/Makefile +++ b/go-cosmwasm/Makefile @@ -63,6 +63,11 @@ build: build-rust build-go .PHONY: build-rust build-rust: build-enclave + if [[ $(SGX_MODE) == HW ]]; then \ + sed -i 's/sgx_epid_sim/sgx_epid/' ./api/link_std.go; \ + else \ + sed -i 's/sgx_epid/sgx_epid_sim/' ./api/link_std.go; \ + fi; cargo build -Z unstable-options --profile $(BUILD_PROFILE) --features "$(FEATURES_U)" cp target/$(BUILD_PROFILE)/libgo_cosmwasm.$(DLL_EXT) api @ #this pulls out ELF symbols, 80% size reduction! diff --git a/go-cosmwasm/api/link_std.go b/go-cosmwasm/api/link_std.go index 7fb0340b2..481bc5776 100644 --- a/go-cosmwasm/api/link_std.go +++ b/go-cosmwasm/api/link_std.go @@ -3,5 +3,5 @@ package api -// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lgo_cosmwasm -lsgx_dcap_ql -lsgx_dcap_quoteverify +// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lgo_cosmwasm -lsgx_dcap_ql -lsgx_dcap_quoteverify -lsgx_epid import "C"