From 38626e9ceb10396ee5332a9defd58a9f68709423 Mon Sep 17 00:00:00 2001 From: NathanBSC Date: Fri, 7 Jul 2023 15:43:05 +0800 Subject: [PATCH] fix: make BLST PORTABLE for release binary --- .github/workflows/pre-release.yml | 4 ++++ .github/workflows/release.yml | 4 ++++ Dockerfile | 2 ++ README.md | 9 +++++++++ 4 files changed, 19 insertions(+) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 1e0f30cb6..35239ca42 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -6,6 +6,10 @@ on: tags: - pre-v* +env: + CGO_CFLAGS: "-O -D__BLST_PORTABLE__" + CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" + jobs: build: name: Build Release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b8c12a33..66afb8ceb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,10 @@ on: # Publish `v1.2.3` tags as releases. tags: - v* + +env: + CGO_CFLAGS: "-O -D__BLST_PORTABLE__" + CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" jobs: build: diff --git a/Dockerfile b/Dockerfile index e9c5ad487..31e5c455b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM golang:1.19-alpine AS build-env # Set up dependencies ENV PACKAGES make cmake git libc-dev bash gcc linux-headers eudev-dev curl ca-certificates build-base libc-dev +ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__" +ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" # Set working directory for the build WORKDIR /go/src/github.com/bnb-chain/node diff --git a/README.md b/README.md index 97bb46359..55240bf34 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,15 @@ $ git clone git@github.com:bnb-chain/node.git $ cd node && make build ``` +If you get such error when running the node with self built binary: +```shell +Caught SIGILL in blst_cgo_init, consult /bindinds/go/README.md. +``` +please try to add the following environment variables and build again: +```shell +export CGO_CFLAGS="-O -D__BLST_PORTABLE__" +export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__" +``` To test that installation worked, try to run the cli tool: