Closed Spongman closed 6 years ago
Hi @Spongman - I don't actually build on Windows; I cross-compile using mingw in a Docker container. That said, you need to use govendor to install the dependencies, not just go get. Does this help?
I was able to clamour my way through installing govendor and then some more headaches with gcc to compile sqlite3 and etc and got mcdex to compile (win10x64).
Then I had to mess with envion variables for JAVA_HOME and then things like mod.list was not giving any output in the command prompt window and I kinda of around that point decided "ok this wasn't really meant to run in Windows that's maybe just a consolation" and gave up.
For what it's worth, it was compileable, though.
@OrdinatorStouff @Spongman - so, I provide cross-compiled builds for all the major platforms; are those not sufficient or are you looking to be able to contribute?
The provided exe worked for me I was more curious if I could figure out how to compile on my own mostly just out of curiosity.
@OrdinatorStouff - ok. It is supposed to work on Windows (just building is really meant to be done on a cross-compiler, not native). Wrt. to mod.list not working, did you install the database? (I.e. db.update) first?
I'd like to contribute.
I'm on Windows, new to govendor
, and not very experienced with make
or makefiles.
Go version, $GOPATH
, and $GOROOT
on my system:
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> go version
go version go1.8.3 windows/amd64
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> $env:GOPATH
C:\Users\lws\gits\go
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> $env:GOROOT
C:\bin\go
What I've tried:
Install govendor
: PS C:\Users\lws\gits\go\src\github.com> go get -u github.com/kardianos/govendor
Download the mcdex
source and vendored dependencies:
PS C:\Users\lws\gits\go\src\github.com> govendor get github.com/LiaungYip/mcdex
can't load package: package github.com/LiaungYip/mcdex: no buildable Go source files in C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex
Try using make windows
:
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> ls
Directory: C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2017-10-26 21:22 src
d----- 2017-10-26 21:23 vendor
-a---- 2017-10-26 21:22 22 .dockerignore
-a---- 2017-10-26 21:22 342 .gitignore
-a---- 2017-10-26 21:22 161 Dockerfile
-a---- 2017-10-26 21:22 11357 LICENSE
-a---- 2017-10-26 21:22 84 linux.env
-a---- 2017-10-26 21:22 1077 Makefile
-a---- 2017-10-26 21:22 2971 README.md
-a---- 2017-10-26 21:22 122 windows.env
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-pc-msys
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> make windows
CGO_ENABLED=1 GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc GOROOT=/usr/lib/go-1.8 PATH=$GOROOT/bin:$PATH GOPATH=/mcdex go install -ldflags "-X main.version=v0.7.3-0-gcf4cd02" -x -v mcdex
go: cannot find GOROOT directory: C:\bin\DevKit\lib\go-1.8
make.exe": *** [windows] Error 2
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex>
$GOROOT
definitely isn't in C:\bin\Devkit\lib\go-1.8
- that makes no sense.Looks like some trouble with environment variables.
Let's try editing C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex\windows.env
which looks like:
CGO_ENABLED=1
GOOS=windows
GOARCH=386
CC=i686-w64-mingw32-gcc
GOROOT=/usr/lib/go-1.8 <- Delete this line - use my normal $GOPATH
PATH=$GOROOT/bin:$PATH
GOPATH=/mcdex <- Delete this line - use my normal $GOROOT
Try again:
PS C:\Users\lws\gits\go\src\github.com\LiaungYip\mcdex> make windows CGO_ENABLED=1 GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc PATH=$GOROOT/bin:$PATH go install -ldflags "-X main.version=v0.7.3-0-gcf4cd02" -x -v mcdex can't load package: package mcdex: cannot find package "mcdex" in any of: C:\bin\go\src\mcdex (from $GOROOT) C:\Users\lws\gits\go\src\mcdex (from $GOPATH) make.exe": *** [windows] Error 1
Out of ideas - not experienced enough with go
to figure out what's wrong here.
TL; DR: A CONTRIBUTING.md
file, targeted at novice Go users (who may be on Windows), would be greatly appreciated!
I've gone back and forth about how to handle this. I don't develop on Windows, though I do test on it. If a Windows developer wants to collaborate on how to make mcdex build natively there, I'm happy to chat, but I'm not going to dig in and spend a lot of time doing that. :)
Thank you @Spongman @OrdinatorStouff and @LiaungYip for your thoughts. If you find something not working (i.e. functionality-wise) on Windows, I'd be very glad to hear about it.
no idea what i'm doing. go is a mystery to me.