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

wchar.go:44:8: error: enumerator value for '__cgo_enum__0' is not an integer constant #2

Closed
sergei-mironov opened this issue Apr 18, 2017 · 7 comments

Comments

@sergei-mironov
Copy link

sergei-mironov commented Apr 18, 2017

Hi. I am building the latest release of geth which depends on hid. Unfortunately, I have the topic error, more of it below. Probably, it is a build environment problem (I'm using NixOS linux distro which is quite unusual).
My go is version 1.7.1.
Could you please suggest a hint regarding the error?

# github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:44:8: error: enumerator value for '__cgo_enum__0' is not an integer constant
   return stringToWchar4(s) // Unix       
        ^                                 
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:52:8: error: enumerator value for '__cgo_enum__7' is not an integer constant
  case 2:                                 
        ^                                 
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:60:2: error: initializer element is not constant
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:60:2: note: (near initialization for '__cgodebug_data[0]')
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:67:2: error: initializer element is not constant
  default:                                
  ^                                       
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:67:2: note: (near initialization for '__cgodebug_data[7]')
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
# github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:44:8: error: enumerator value for '__cgo_enum__0' is not an integer constant
   return stringToWchar4(s) // Unix       
        ^                                 
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:52:8: error: enumerator value for '__cgo_enum__7' is not an integer constant
  case 2:                                 
        ^                                 
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:60:2: error: initializer element is not constant
go/src/github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid/wchar.go:60:2: note: (near initialization for '__cgodebug_data[0]')
@karalabe
Copy link
Owner

Could you try with updating to Go 1.8.1? These error messages seem originate from Go's compiler, not this library golang/go#14669

@sergei-mironov
Copy link
Author

I've tried go1.8 compiler (the latest available on NixOS so far). Errors are still here, but the text is a bit different. As far as I understand the golang/go#14669, one could workaround errors by passing '-O0'. I'll try to do that.

# github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
cgo-dwarf-inference:2:8: error: enumerator value for '__cgo_enum__0' is not an integer constant
cgo-dwarf-inference:10:8: error: enumerator value for '__cgo_enum__7' is not an integer constant
cgo-dwarf-inference:18:2: error: initializer element is not constant
cgo-dwarf-inference:18:2: note: (near initialization for '__cgodebug_data[0]')
cgo-dwarf-inference:25:2: error: initializer element is not constant
cgo-dwarf-inference:25:2: note: (near initialization for '__cgodebug_data[7]')

@javgh
Copy link

javgh commented May 7, 2017

Another NixOS user here - I also ran into this and have been attempting to debug it. It seems to be indeed unrelated to geth and a general problem with the go compiler under NixOS. I have filed a separate issue here: NixOS/nixpkgs#25599 .

@sergei-mironov
Copy link
Author

Thanks to @javaGH, looks like we used gcc instead of clang. So it is really a NixOS issue. Closing this one now.

@javgh
Copy link

javgh commented May 8, 2017

Indeed, the issue was that under NixOS the Go compiler is built using clang, but then while trying to build geth the C compiler was set to gcc. I have an updated NixOS package for geth 1.6.1 over here which works for me: https://github.com/javgh/nixpkgs/blob/master/pkgs/applications/altcoins/go-ethereum.nix . Cheers!

@aaronlevin
Copy link

I just wanted to pop in to say I'm seeing this too (via Nix) and this was a hard issue to track down.

@javgh
Copy link

javgh commented Jun 18, 2017

Just as a FYI: The original guess regarding the compiler mixup was actually incorrect. Everything is built using gcc by default on Nix - including the Go compiler. Switching to clang still helps though as a workaround. The root cause is still unsolved though, as far as I know. This is the most recent issue about it: NixOS/nixpkgs#25959 .

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

No branches or pull requests

4 participants