Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile geth using gccgo not gc #22159

Closed
tkdlqm2 opened this issue Jan 12, 2021 · 9 comments
Closed

compile geth using gccgo not gc #22159

tkdlqm2 opened this issue Jan 12, 2021 · 9 comments

Comments

@tkdlqm2
Copy link

tkdlqm2 commented Jan 12, 2021

System information

image

Geth version: 1.9.1
OS & Version: ubuntu 0.18.0

Expected behaviour

go build -o geth -compiler=gccgo -gccgoflags='-fuse-ld=gold' -v ./go-ethereum/cmd/geth/*go

Actual behaviour

github.com/ethereum/go-ethereum/vendor/github.com/steakknife/hamming
github.com/ethereum/go-ethereum/crypto/bn256/cloudflare
# github.com/ethereum/go-ethereum/vendor/github.com/steakknife/hamming
go-ethereum/vendor/github.com/steakknife/hamming/popcnt_amd64.s:11:10: fatal error: textflag.h: No such file or directory
 #include "textflag.h"
          ^~~~~~~~~~~~
compilation terminated.
# github.com/ethereum/go-ethereum/crypto/bn256/cloudflare
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s: Assembler messages:
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:17: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:17: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:30: Error: junk at end of line, first unrecognized character is `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:31: Error: no such instruction: `cmovqcc b0,a0 CMOVQCC b1,a1 CMOVQCC b2,a2 CMOVQCC b3,a3'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:111: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:111: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:111: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:164: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:164: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:164: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:167: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_amd64.h:167: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:65: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:65: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:65: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:98: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:98: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:98: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:101: Warning: stray `\'
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:101: Error: junk `ADDQ 0(SP)' after expression
go-ethereum/crypto/bn256/cloudflare/mul_bmi2_amd64.h:101: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:39: Error: no such instruction: `text ·gfpNeg(SB),0,$0-16'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:40: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:40: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:41: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:41: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:42: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:42: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:43: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:43: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:45: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:45: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:46: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:46: Error: too many memory references for `sub'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:47: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:47: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:48: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:48: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:49: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:49: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:52: Error: junk at end of line, first unrecognized character is `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:54: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:54: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:55: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:58: Error: no such instruction: `text ·gfpAdd(SB),0,$0-24'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:59: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:59: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:60: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:60: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:62: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:62: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:65: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:65: Error: too many memory references for `add'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:66: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:66: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:67: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:67: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:68: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:68: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:71: Error: junk at end of line, first unrecognized character is `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:73: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:73: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:74: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:77: Error: no such instruction: `text ·gfpSub(SB),0,$0-24'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:78: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:78: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:79: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:79: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:81: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:81: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:83: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:83: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:84: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:84: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:85: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:85: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:86: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:86: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:89: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:89: Error: too many memory references for `sub'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:90: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:90: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:91: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:91: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:92: Error: junk `(SI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:92: Error: too many memory references for `sbb'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:94: Error: no such instruction: `cmovqcc AX,R12'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:95: Error: no such instruction: `cmovqcc AX,R13'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:96: Error: no such instruction: `cmovqcc AX,R14'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:97: Error: no such instruction: `cmovqcc AX,R15'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:99: Error: too many memory references for `add'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:100: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:101: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:102: Error: too many memory references for `adc'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:104: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:104: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:105: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:108: Error: no such instruction: `text ·gfpMul(SB),0,$160-24'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:109: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:109: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:110: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:110: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:113: Error: junk `(SB)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:113: Error: operand size mismatch for `cmp'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:116: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:116: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:117: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:118: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:119: Error: junk at end of line, first unrecognized character is `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:123: Error: junk `(DI)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:123: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:124: Error: junk at end of line, first unrecognized character is `\'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:127: Error: junk `(FP)' after expression
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:127: Error: too many memory references for `movq'
go-ethereum/crypto/bn256/cloudflare/gfp_amd64.s:128: Error: too many memory references for `movq'

I want to know how to compile geth using gccgo. please let me know ...

@holiman
Copy link
Contributor

holiman commented Jan 12, 2021

The hamming-dependency gets removed in #22044. fwiw

@karalabe
Copy link
Member

gccgo is trailing the Go compiler by 3-4 versions and I'm not even sure it fully implements the assembly instructions even in the released ones. Maybe early on gccgo was an interesting project, but it cannot keep up with upstream Go. I don't think we will ever care about building with this strange compiler.

@thinko
Copy link

thinko commented Aug 9, 2021

I don't know if this has changed significantly in the past 6 months, but it doesn't seem like gccgo is trailing the Go compiler, as far as I can tell it's looking like it's become the de facto go compiler.

This issue is still occurring even with a very recent build of gccgo (11.2.1 20210728) and go1.16.5 when trying to build go-ethereum v1.10.6.

@fnerdman
Copy link

Flashbots has an exciting use case for building Geth with gccgo. We're experimenting with running Geth inside SGX to provide privacy for User transactions.

One issue that we're currently experiencing is the not-so-optimal performance. A big performance issue is that Geth compiled with gc syscalls directly into the kernel. Within SGX this cannot be intercepted and requires an expensive interupt. gccgo on the other hand uses libc as an intermediate, which can be intercepted.

I've been trying to compile latest Geth with gccgo version 12.1.0 without success.
build.log

@holiman
Copy link
Contributor

holiman commented Mar 30, 2023

@lead4good looks to me like those failures mostly are dealing with generics. Perhaps your gccgo version is not up to date enough to handle those?

@holiman
Copy link
Contributor

holiman commented Mar 30, 2023

Yeah

https://go.dev/doc/install/gccgo#Releases:

The GCC 12 and 13 releases include a complete implementation of the Go 1.18 standard library. However, GCC does not yet include support for generics.

@fnerdman
Copy link

fnerdman commented Mar 30, 2023

Thanks @holiman !
Let's see if GCC 14 released sometime in spring 2024 will include go generics support

@kajaaz
Copy link

kajaaz commented Nov 28, 2024

Hey @fnerdman, have you finally succeded to compile Geth with GCC 14 ? From my side, with command go build -o geth -compiler=gccgo -gccgoflags='-fuse-ld=gold' -v ./cmd/geth/*go, I have these errors:

rlp/typecache.go:21:2: package maps is not in std (/usr/local/go/src/maps)
log/format.go:6:2: package log/slog is not in std (/usr/local/go/src/log/slog)
core/types/block.go:27:2: package slices is not in std (/usr/local/go/src/slices)
/root/go/pkg/mod/github.com/deckarep/golang-set/v2@v2.6.0/sorted.go:32:2: package cmp is not in std (/usr/local/go/src/cmp)

with Ubuntu 24, go1.22.0 and GCC 14.02

This is because GCCGO is currently on go1.18 and cmp / slices have been introduced in go1.21 (https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1983288.html), and Go-Ethereum requires go1.22.

@fnerdman
Copy link

No, sorry. I've moved on - not using geth anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants