dizzyd / mcdex

Minecraft Modpack Management
Apache License 2.0
74 stars 8 forks source link

can't build on windows #11

Closed Spongman closed 6 years ago

Spongman commented 7 years ago
E:\play\mcdex>go install mcdex
src\mcdex\curseforge.go:25:2: no Go files in e:\play\mcdex\src\github.com\PuerkitoBio\goquery
src\mcdex\forge.go:37:2: code in directory e:\play\mcdex\src\github.com\xi2\xz expects import "xi2.org/x/xz"

E:\play\mcdex>go get -v -x -t ./...
can't load package: package github.com/xi2/xz: code in directory e:\play\mcdex\src\github.com\xi2\xz expects import "xi2.org/x/xz"
src\mcdex\curseforge.go:25:2: no Go files in e:\play\mcdex\src\github.com\PuerkitoBio\goquery
package github.com/xi2/xz: code in directory e:\play\mcdex\src\github.com\xi2\xz expects import "xi2.org/x/xz"

E:\play\mcdex>go version
go version go1.9 windows/amd64

no idea what i'm doing. go is a mystery to me.

dizzyd commented 7 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?

OrdinatorStouff commented 7 years ago

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.

dizzyd commented 7 years ago

@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?

OrdinatorStouff commented 7 years ago

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.

dizzyd commented 7 years ago

@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?

LiaungYip commented 6 years ago

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:

  1. Install govendor: PS C:\Users\lws\gits\go\src\github.com> go get -u github.com/kardianos/govendor

  2. 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
  3. 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>
    1. Okay, my $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
    1. 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!

dizzyd commented 6 years ago

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.