factorio-server-manager icon indicating copy to clipboard operation
factorio-server-manager copied to clipboard

Building on Windows

Open Mattie112 opened this issue 3 years ago • 8 comments
trafficstars

Hi,

Is there any (up2date) documentation on developing / building on Windows?

The instructions user go build but that asks me to install make (and while that might be possible it is not listed as a dependency)

PS C:\Users\xx\GolandProjects\factorio-server-manager\src> go build .
# github.com/mattn/go-sqlite3
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%

I also found this PR with some commands:

docker build --no-cache -f docker/Dockerfile-build -t ofsm-build --target=build -o dist .

But that outputs the following after about 5 minutes:

[+] Building 127.8s (13/13) FINISHED
 => [internal] load build definition from Dockerfile-build                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 38B                                                                                                                                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                              0.1s
 => => transferring context: 2B                                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                                               0.0s
 => CACHED [build 1/8] FROM docker.io/library/alpine:latest                                                                                                                                                                                    0.0s
 => [internal] load build context                                                                                                                                                                                                              0.5s
 => => transferring context: 1.08MB                                                                                                                                                                                                            0.5s
 => [build 2/8] RUN apk add --no-cache git make musl-dev go nodejs npm zip mingw-w64-gcc                                                                                                                                                       9.5s
 => [build 3/8] COPY docker/build-release.sh /usr/local/bin/build-release.sh                                                                                                                                                                   0.1s
 => [build 4/8] COPY ./ /go/src/factorio-server-manager                                                                                                                                                                                        0.3s
 => [build 5/8] RUN mkdir -p /go/bin                                                                                                                                                                                                           0.2s
 => [build 6/8] RUN chmod u+x /usr/local/bin/build-release.sh                                                                                                                                                                                  0.2s
 => [build 7/8] WORKDIR /go/src/factorio-server-manager                                                                                                                                                                                        0.1s
 => [build 8/8] RUN ["/usr/local/bin/build-release.sh"]                                                                                                                                                                                      115.1s
 => ERROR exporting to client                                                                                                                                                                                                                  2.1s
 => => copying files 30.69MB                                                                                                                                                                                                                   2.1s
------
 > exporting to client:
------
error from receiver: failed to rename dist\go\pkg\mod\github.com\!open!factorio!server!manager\[email protected]\.tmp.013796081 to dist\go\pkg\mod\github.com\!open!factorio!server!manager\[email protected]\rcon.go: rename dist\go\pkg\mod\github.com\!open!factorio!server!manager\[email protected]\.tmp.013796081 dist\go\pkg\mod\github.com\!open!factorio!server!manager\[email protected]\rcon.go: Access is denied.

Is it still possible to build in Windows? I don't mind building in a docker container.

Mattie112 avatar Jan 30 '22 18:01 Mattie112

Hi @Mattie112 , I guess you should use docker.

jannaahs avatar Feb 12 '22 20:02 jannaahs

That is what I tried but that seems to fail.

I got it working by manually installing some stuff in WSL but at least the docker container does not work (yet). Was hoping someone had it running and could point me in the right direction.

Mattie112 avatar Feb 14 '22 08:02 Mattie112

You have to install mingw (minimal gnu for windows), so you have gcc/g++ installed. Install it on the official site or use tdm-gcc Then GO is able to find and link to the gcc parts.

For the frontend only npm is required, use npm run dev to create development js/css files.

(All of this not tested, cause i don't want to develop on windows anymore^^)

Edit: A full visual studio installation could also be enough :thinking:

knoxfighter avatar Feb 24 '22 16:02 knoxfighter

Allright thanks. If Windows is not supported I will create a docker container the next time with the correct dependencies. Did it last time in WSL (with some manually installed dependencies indeed) but didn't wrote it down ofc :)

Mattie112 avatar Feb 24 '22 16:02 Mattie112

We also have a Dockerfile-build file that could potentially do what you want (i never used it though)

knoxfighter avatar Feb 24 '22 16:02 knoxfighter

Yes that is the log from my first post (it fails with that container). But I didn't debug it any further, first wanted to see if anyone got it up and running and could point me to the correct process. But as no one really knows it next time I change something I will also update the Windows build process ;)

Mattie112 avatar Feb 24 '22 16:02 Mattie112

I got it running with vs code docker integration, but it's not pretty cause there's permissions issues that I haven't sorted out yet. If you're interested in a half working solution (I've built successfully but it requires running sudo -i in the terminal before running a bunch of manual make steps) I can make a commit to my fork. If the maintainers are interested, I could make a pull request perhaps after getting the permission things cleaned up.

EphDoering avatar Feb 27 '22 18:02 EphDoering

Yeah I got it to work in WSL (with manually installing some stuff), if you have a working dockerfile then I can try if it works here. Didn't have time yet to look into this.

Mattie112 avatar Feb 27 '22 19:02 Mattie112