OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
541 stars 130 forks source link

Building on Windows #307

Open Mattie112 opened 2 years ago

Mattie112 commented 2 years ago

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\rcon@v0.0.0-20120923215419-8fbb8268b60a\.tmp.013796081 to dist\go\pkg\mod\github.com\!open!factorio!server!manager\rcon@v0.0.0-20120923215419-8fbb8268b60a\rcon.go: rename dist\go\pkg\mod\github.com\!open!factorio!server!manager\rcon@v0.0.0-20120923215419-8fbb8268b60a\.tmp.013796081 dist\go\pkg\mod\github.com\!open!factorio!server!manager\rcon@v0.0.0-20120923215419-8fbb8268b60a\rcon.go: Access is denied.

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

jannaahs commented 2 years ago

Hi @Mattie112 , I guess you should use docker.

Mattie112 commented 2 years ago

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.

knoxfighter commented 2 years ago

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:

Mattie112 commented 2 years ago

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 :)

knoxfighter commented 2 years ago

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

Mattie112 commented 2 years ago

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 ;)

EphDoering commented 2 years ago

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.

Mattie112 commented 2 years ago

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.