goclipse icon indicating copy to clipboard operation
goclipse copied to clipboard

Executable file doesn't exist

Open AlvinAlvin82 opened this issue 8 years ago • 6 comments

i'm new to Go and GoClipse and i'm not able to compile a simple "hello World" on my linux machine. Here is my configuration:

  • Eclipse Mars.2
  • GoClipse 0.16.1

On Windows->Preferences->Go:

  • Go installation: /usr/lib/go-1.7
  • GOPATH: :/root/go

On Windows->Preferences->Go->tools:

  • gocode: /root/go/bin/gocode
  • guru: /root/go/bin/guru
  • godef: /root/go/bin/godef
  • gofmt: /usr/lib/go-1.7/bin/gofmt (Use default location)

The output of go env is:

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build306567185=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

I've tried t compile the following "hello world" code

package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

But i have this error message:

Executable file (/root/workspace/Test/bin/Test) doesnt exist.

What's wrong? How can i configure eclipse properly? Thanks

AlvinAlvin82 avatar Jan 08 '17 09:01 AlvinAlvin82

What's the output of the Go build console when you build your project? The build console looks like this: image

With your GOPATH setting, the executable should have been outputted to /root/go/bin/Test

bruno-medeiros avatar Feb 17 '17 19:02 bruno-medeiros

I also met same problem, I can't understand why the executable outputted to system variable "GOBIN".

shadow1163 avatar Apr 23 '17 10:04 shadow1163

Which error do you have? Are you using Eclipse on Linux? Did you have installed Go with apt install? You should configure the path in your eclipse project

AlvinAlvin82 avatar Apr 25 '17 08:04 AlvinAlvin82

The error is "Executable file does not exists", I have install Golang, Eclipse on my windows machine. Maybe I should change default build command to solve the problem.

shadow1163 avatar Apr 25 '17 09:04 shadow1163

I'm using eclipse on linux, but the problem is the same. Try this:

  1. Create an "hello world" go project in eclipse
  2. Right click on your folder project and then click on Properties
  3. Go Compiler -> Go Installation
  4. Set the folder where your Go binaries are installed
  5. Then build and run you project

AlvinAlvin82 avatar Apr 25 '17 10:04 AlvinAlvin82

I managed to find the issue, It is no configuration issue or anything. You have to do 3 things as follows,

  1. Make sure GOPATH value is different from GOROOT.
  2. Make sure GOBIN value is empty.
  3. Your package name on the go file in eclipse should be main and not the package name "hello". This should be the case for at least the file that has main function. To do this, File->New go file->Source file type should be -> Command source file-> Empty main function. Then type your code after which you can build to see the the .exe file in GOPATH/bin and the program run.

Worked for me.

ghost avatar Jul 14 '17 09:07 ghost