4

I decided to give Go a try, and thus wrote the following bit of code:

package main

import "fmt"

func main() {
    fmt.Printf("Hello, World\n")
}

I saved that under main.go, and then tried to compile it using gccgo main.go -o main. This worked. However, when I tried ./main, I got the following message:

no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable

runtime stack:
no debug info in ELF executable errno -1
panic during panic

What on earth happened?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Koz Ross
  • 3,040
  • 2
  • 24
  • 44

1 Answers1

4

First, don't use gccgo, it doesn't support Go 1.3.

Second, Go's runtime depends on debug information, which I'm guessing you're using an older version of gcc (probably 4.8) which automaticlly strips it, you would have to run it like gccgo -g main.go -o main.

If you're using ubuntu, this bug is relevant.

OneOfOne
  • 95,033
  • 20
  • 184
  • 185
  • 1
    According to the output of my ``gcc --version``, I'm using version 4.9.1. Apparently, even that strips debug info automatically! Adding ``-g`` fixed that. – Koz Ross Aug 01 '14 at 14:05
  • Odd, it shouldn't, should probably report a bug to the gccgo maintainer of your distro. – OneOfOne Aug 01 '14 at 14:10
  • But like I pointed out, please use `go` itself, gccgo only supports Go 1.2. – OneOfOne Aug 01 '14 at 14:14
  • 3
    `gccgo` has its own merits compared to the `gc` suite and using it might well have legitimate reasons. As an example, one might want to have a dynamically-linked executable (against `libgoN.so` or some such). Another case is `gccgo` currently being more good at optimizing CPU-intensive code (such as doing vectorisation where applicable). So please at least make sure to present both sides of the problem, not just one of them. The release notes also [hint that GCC 4.10 will likely have Go 1.4 implemented](http://tip.golang.org/doc/go1.3#gccgo). – kostix Aug 01 '14 at 15:19