go and cygwin!

9,856 views
Skip to first unread message

Bardia Jedi

unread,
Jan 28, 2013, 6:24:31 PM1/28/13
to golan...@googlegroups.com
I'm having trouble setting up my work space om Cygwin

So i went to this page and did this:
hg clone https://golang-on-cygwin.googlecode.com/hg/ golang-on-cygwin  
and then i set up my paths 
export GOROOT=home/Bardia/golang-on-cygwin
export GOBIN=home/Bardia/Gocode/bin
export GOARCH=386 //<- I'm using a 32 bit windows
export GOOS=linux // -,-
export PATH=$PATH:$GOBIN

and then Im runing the all.bash in golang-on-cygwin/src
I'm contiguously getting 2 errors:  runtime and install

what am I doing wrong here?

//Bardia Jedi

Dave Cheney

unread,
Jan 28, 2013, 6:26:43 PM1/28/13
to Bardia Jedi, golan...@googlegroups.com
The shortest answer I can give is to install msys and use the official go distribution. 
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group, send email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

brainman

unread,
Jan 28, 2013, 7:20:48 PM1/28/13
to golan...@googlegroups.com, Bardia Jedi
On Tuesday, 29 January 2013 10:26:43 UTC+11, Dave Cheney wrote:
The shortest answer I can give is to install msys and use the official go distribution. 


You really do not need msys (that includes different unix tools, like bash, make and so on). Having gcc (I use mingw) is enough. There is an all.bat file that can be executed by Windows command interpreter to build Go from sources.

Alex

Nate Finch

unread,
Jan 28, 2013, 8:00:34 PM1/28/13
to Bardia Jedi, golan...@googlegroups.com

Do you need cygwin for something specific?  Go compiles just fine on windows,  and in my experience,  Cygwin just makes Windows development worse.

--

Bardia Jedi

unread,
Jan 29, 2013, 4:03:12 AM1/29/13
to golan...@googlegroups.com, Bardia Jedi
well I don't nay of the cmd works fine but vim and Cygwing tools helps a lot.
is there a way way to connect my GOROOT in cygwin to c:\go ..  

Jackie Li

unread,
Jan 29, 2013, 4:22:44 AM1/29/13
to Bardia Jedi, golang-nuts
I'm having the same problem.

Although I can `export GOROOT=/cygdrive/c/go`
but a lot of things go wrong in cygwin terminal.


To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jackie

Dave Cheney

unread,
Jan 29, 2013, 4:45:00 AM1/29/13
to Jackie Li, Bardia Jedi, golang-nuts
Jackie, Bardia,

Go does not support, or compile under cygwin. You will find the
documentation to correctly install Go here,
http://golang.org/doc/install#windows.

Cheers

Dave

Arie van Wingerden

unread,
Jan 29, 2013, 4:59:04 AM1/29/13
to Dave Cheney, Jackie Li, Bardia Jedi, golang-nuts
@Bardia Also I checked that during the build and test phases you don't need to set environment variables, because they default to the right system it runs on.
E.g. the PATH gets reset in the installation bat files.
/Arie


2013/1/29 Dave Cheney <da...@cheney.net>

Volker Dobler

unread,
Jan 29, 2013, 5:34:58 AM1/29/13
to golan...@googlegroups.com
Do not use golang-on-cygwin.

Install the official Go 1.0.03 Windows release and make sure your PATH on
cygwin contains /cygdrive/c/Go/bin.

To set up your GOPATH: Use Windews file paths, not cygwin paths:
  $ export GOPATH="D:/gocode"   # not "/cygdrive/d/gocode"
Test with
  $ go env
which should produce smth. like
set GOARCH=amd64
set GOBIN=C:/Go/bin
set GOCHAR=6
set GOEXE=.exe
set GOGCCFLAGS=-g -O2 -m64 -mthreads
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:/gocode;D:/experimental
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CGO_ENABLED=1

Works fine.

Bardia Jedi

unread,
Feb 2, 2013, 4:01:27 PM2/2/13
to golan...@googlegroups.com
sorry for the delay had some problem w/ my PC 
but now I have a new one w/ Windows 8 64 bit. 
this raises a hole new problem.
I'm able to build a project but the path system is no functioning e.g. when I run a go install the project is benign built in the project folder not the bin nor the pkg.
I also have access to windows Power Shell can I use this in my advantage!!

/Bardia Jedi    

Volker Dobler

unread,
Feb 2, 2013, 4:26:10 PM2/2/13
to golan...@googlegroups.com

Am Samstag, 2. Februar 2013 22:01:27 UTC+1 schrieb Bardia Jedi:
sorry for the delay had some problem w/ my PC 
but now I have a new one w/ Windows 8 64 bit. 
this raises a hole new problem.
I'm able to build a project but the path system is no functioning e.g. when I run a go install the project is benign built in the project folder not the bin nor the pkg.
I also have access to windows Power Shell can I use this in my advantage!

Please post the output of "go env" and the structure of your GOPATH folder. 

Bardia Jedi

unread,
Feb 2, 2013, 5:12:21 PM2/2/13
to golan...@googlegroups.com
C:\Users\Bardia\Gocode this -> sepose to be set as GOPATH
C:\Go\bin -> GOROOT

Shivakumar GN

unread,
Feb 3, 2013, 8:16:16 AM2/3/13
to golan...@googlegroups.com
On Sun, Feb 3, 2013 at 3:42 AM, Bardia Jedi <bardi...@gmail.com> wrote:
C:\Users\Bardia\Gocode this -> sepose to be set as GOPATH
C:\Go\bin -> GOROOT

Please post output of the *command*
    > go env

The command must be executed on the same shell where you are experiencing the problem (to rule a case that it is old shell opened before you installed go!).

Bardia Jedi

unread,
Feb 4, 2013, 6:08:14 AM2/4/13
to golan...@googlegroups.com
sorry nooby misstake
here u go

set GOARCH=amd64
set GOBIN=
set GOCHAR=6
set GOEXE=.exe
set GOGCCFLAGS=-g -O2 -m64 -mthreads
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CGO_ENABLED=1

btw if u can tell me what eche varabels stands for I'll be abel to debug it in the futuer! thank u

Volker Dobler

unread,
Feb 4, 2013, 7:56:32 AM2/4/13
to golan...@googlegroups.com
You *must* set GOPATH.
On cygwin try eg.
  $ export GOPATH="C:/Users/Bardia/Gocode"
and make sure you have src, bin and pkg folders in there

You might want to take a look at
and

Bardia Jedi

unread,
Feb 4, 2013, 8:31:37 AM2/4/13
to golan...@googlegroups.com
thx that worked grate but was wandering if I have to set GOPATH evreytime I start a new session or is there a way to set a constant var...
and GOBIN does it point to the %GOPATH%/bin or %GOROOT%/bin??

Philipp Schumann

unread,
Feb 4, 2013, 8:47:46 AM2/4/13
to golan...@googlegroups.com

mcdt...@gmail.com

unread,
Dec 8, 2014, 3:27:16 PM12/8/14
to golan...@googlegroups.com
These settings in cygwin worked for me to get the go command lines to work as indicated in the tutorial videos:

1. add these 3 lines into your ~/.bashrc file:
export GOPATH='C:\cygwin\home\your_user_name\go_workspace'
export GOBIN='C:\cygwin\home\your_user_name\go_workspace\bin'
export PATH=$PATH:'/cygdrive/c/cygwin/home/your_user_name/go_workspace/bin'

2. source ~/.bashc

3. verify GOBIN is set with "go env" (My output looks like):l
go env
set GOROOT=C:\Go
set GOBIN=C:\cygwin\home\your_user_name\go_workspace\bin
set GOARCH=amd64
set GOCHAR=6
set GOOS=windows
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GOGCCFLAGS=-g -O2 -m64 -mthreads


2/ Create a go workspace directory (name is optional but needs to match the export Env vars in .bashrc):
cd ~/.
mkdir ./go_workspace
mkdir ./go_workspace/src
mkdir ./go_workspace/bin
mkdir ./go_workspace/pkg
mkdir ./go_workspace/pkg/windows_amd64 (NOTE: GOARCH can be determined from the "go env" output... mine is amd64 and cygwin is on windows)

Then the "go install", "go build", "go test" commands all worked without errors.

McD

Frank Davidson

unread,
Dec 15, 2017, 2:24:25 PM12/15/17
to golang-nuts
I'm having trouble with go get and cygwin. I get a bad directory:

davidfr@mybox ~/gocode
# cd .; git clone https://go.googlesource.com/tools C:\cygwin\home\davidfr\gocode\src\golang.org\x\tools
Cloning into 'C:\cygwin\home\davidfr\gocode\src\golang.org\x\tools'...
fatal: Invalid path '/home/davidfr/gocode/C:\cygwin\home\davidfr\gocode\src\golang.org\x\tools': No such file or directory
package golang.org/x/tools/cmd/...: exit status 128

davidfr@mybox ~/gocode
$ go env
set GOARCH=amd64
set GOBIN=C:\cygwin\home\davidfr\gocode\bin
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\cygwin\home\davidfr\gocode
set GORACE=
set GOROOT=C:\Users\davidfr\go
set GOTOOLDIR=C:\Users\davidfr\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\cygwin64\tmp\go-build095468127=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

go build seems fine.

Anyone have any tips?

Frank

Volker Dobler

unread,
Dec 15, 2017, 4:37:49 PM12/15/17
to golang-nuts
On Friday, 15 December 2017 20:24:25 UTC+1, Frank Davidson wrote:
I'm having trouble with go get and cygwin. I get a bad directory:

[...]
fatal: Invalid path '/home/davidfr/gocode/C:\cygwin\home\davidfr\gocode\src\golang.org\x\tools': No such file or directory
[...]

Anyone have any tips?


Yes, but none you'll like. To me it seems impossible to
get it to work. go get is using absolute paths and these
do not play well with cygwin given that you have to use
a Windows-style GOPATH on cygwin.

You'll have to use a Windows-aware shell with Windows
path git. It's a PITA.

Maybe go get could detect Cygwin? Want to open an issue?

V.

Mandolyte

unread,
Dec 16, 2017, 7:26:44 AM12/16/17
to golang-nuts
If not wedded to cigwin try git bash. I liked it much better personally and it gave most of the same benefits

Frank Davidson

unread,
Dec 16, 2017, 7:40:20 AM12/16/17
to Mandolyte, golang-nuts
Can you install ancillary programs like mosh and openSSH, etc, on Git Bash?

I’ll open an issue, but I would think that the Go team probably doesn’t want to be chasing around every possible shell/emulator and not sure I’m a good enough programmer to create a decent pull request!

Frank
On Sat, Dec 16, 2017 at 7:27 AM Mandolyte <ceci...@gmail.com> wrote:
If not wedded to cigwin try git bash. I liked it much better personally and it gave most of the same benefits

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/4DVgcqU3ql4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frank Davidson

unread,
Dec 16, 2017, 8:04:55 AM12/16/17
to golang-nuts
Reply all
Reply to author
Forward
0 new messages