Search code examples
gogccgo

"no debug info in ELF executable errno" when running a binary built with gccgo


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?


Solution

  • 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.