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

exec: "FR": executable not found in %PATH% #317

Closed
an0rak-dev opened this issue Feb 27, 2018 · 3 comments
Closed

exec: "FR": executable not found in %PATH% #317

an0rak-dev opened this issue Feb 27, 2018 · 3 comments

Comments

@an0rak-dev
Copy link

Hi !
Thanks for your library, it's really a good job :)

I faced an issue when doing a go get -v github.com/veandco/go-sdl2/sdl :

# github.com/veandco/go-sdl2/sdl
exec: "FR": executable not found in %PATH%

My configuration is :

  • Windows10 64bit
  • MinGW-w64/x86_64.7.2.0-posix-seh-rt_v5-rev1
  • go1.9.4 windows/amd64
  • SDL-2.0.7

The MinGW bin directories are added to my PATH.

When I run a go build -v -work -x -n, I can see that the library use cgo, which in turn call the C compilation command, by using FR instead of gcc.

FR -I "C:\\Users\\me\\Documents\\Projects\\src\\github.com\\veandco\\go-sdl2\\sdl" -m64 -mthreads ...

As a workaround, I create a copy of my gcc.exe file in theMinGW\bin directory, and rename it FR.exe (ugly, but do the job).

I'm still analysing why the cgo executable will change the executable's name, but if you have an info about this, I'm interested :)

@veeableful
Copy link
Contributor

Hmm strange. Does it also do that when compiling a simple cgo program? Perhaps you can try go run on this snippet and see if it does the same thing.

package main

/*
static int twice(int x)
{
        return x * 2;
}
*/
import "C"

func main() {
        x := C.twice(2)
        println(x)
}

@malashin
Copy link
Collaborator

malashin commented Feb 28, 2018

@s-nieuwlandt-dev
Can you please run this commands in your windows console and see if it returns FR?

echo %CC%
echo %GCC%

This is how compiler used by cgo is set. It basically takes one from CC or GCC if they are set or defaults to "gcc".

// gccBaseCmd returns the start of the compiler command line.
// It uses $CC if set, or else $GCC, or else the compiler recorded
// during the initial build as defaultCC.
// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
func (p *Package) gccBaseCmd() []string {
	// Use $CC if set, since that's what the build uses.
	if ret := strings.Fields(os.Getenv("CC")); len(ret) > 0 {
		return ret
	}
	// Try $GCC if set, since that's what we used to use.
	if ret := strings.Fields(os.Getenv("GCC")); len(ret) > 0 {
		return ret
	}
	return strings.Fields(defaultCC(goos, goarch))
}

func defaultCC(goos, goarch string) string {
	switch goos+`/`+goarch {
	}
	return "gcc"
}

So you either have environment variable set for CC or GCC, or something else (console) replaces "gcc" to "FR" with alias after that.

@an0rak-dev
Copy link
Author

Hi !

Thanks for your answers :)

I can reproduce the error on the snippet, and effectively, my %CC% var is set to FR (which is strange because I tried the same install on a different windows10_64bits computer, and was unable to reproduce this behavior).

So clearly this is not a go-sdl2 issue :)

Thanks for the informations and your time !

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

3 participants