Makefiles error when build geth
Opened this issue · 2 comments
[root@192 bsc]# go version
go version go1.21.5 linux/amd64
###make geth find errors####
[root@192 bsc]# make geth
go run build/ci.go install ./cmd/geth -std=c99
/usr/local/go/bin/go build -ldflags "-X github.com/ethereum/go-ethereum/internal/version.gitCommit=f45305b1ad8914201611f47d6dafb4f1279c7d76 -X github.com/ethereum/go-ethereum/internal/version.gitDate=20240517 -extldflags '-Wl,-z,stack-size=0x800000'" -tags urfave_cli_no_docs,ckzg -trimpath -v -o /usr/local/bnb/bsc/build/bin/geth ./cmd/geth
github.com/supranational/blst/bindings/go
github.com/supranational/blst/bindings/go
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go: In function 'go_pairing_init':
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go:44:10: error: 'for' loop initial declarations are only allowed in C99 mode
// for(size_t i = 0; i < DST_len; i++) dst[i] = DST[i];
^
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go:44:10: note: use option -std=c99 or -std=gnu99 to compile your code
^Csignal: interrupt
make: *** [geth] Error 1
###if not use-std=c99###
go run build/ci.go install ./cmd/geth
/usr/local/go/bin/go build -ldflags "-X github.com/ethereum/go-ethereum/internal/version.gitCommit=f45305b1ad8914201611f47d6dafb4f1279c7d76 -X github.com/ethereum/go-ethereum/internal/version.gitDate=20240517 -extldflags '-Wl,-z,stack-size=0x800000'" -tags urfave_cli_no_docs,ckzg -trimpath -v -o /usr/local/bnb/bsc/build/bin/geth ./cmd/geth
github.com/supranational/blst/bindings/go
github.com/supranational/blst/bindings/go
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go: In function 'go_pairing_init':
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go:44:10: error: 'for' loop initial declarations are only allowed in C99 mode
// for(size_t i = 0; i < DST_len; i++) dst[i] = DST[i];
^
/root/go/pkg/mod/github.com/supranational/blst@v0.3.11/bindings/go/blst.go:44:10: note: use option -std=c99 or -std=gnu99 to compile your code
and gcc version is 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
pls refer https://github.com/bnb-chain/bsc/blob/master/README.md
please try to add the following environment variables and build again:
export CGO_CFLAGS="-O -D__BLST_PORTABLE__"
export CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"