Page 1 of 1

Compiling Minetest on Windows

PostPosted: Wed Dec 20, 2017 15:23
by Enrikoo
I don't know how to compile a minetest client on windows 10, i tried to compile but i have not any tools to work now.
Does someone compiling on windows and how long you need to compile on windows?

Re: Compiling Minetest on Windows

PostPosted: Wed Dec 20, 2017 16:53
by trainwrecktony
http://dev.minetest.net/Compiling_Minet ... on_Windows

I used cygwin with its mingw to crosscompile. i previously used to build pidgin and its plugins for windows so it was familiar to me and i also use its ssh server for double secure rdp and proxy to my server remotely. i forget all the packages required but for 64bit you'll need like mingw64-x86_64 binutils libpng libjpeg libvorbis etc. There were some issues with the early mingw-gcc6 releases on cygwin so its been a while and i moved to cross compling on arch-linux which has a newer mingw-gcc7. Crosscompiling on linux will be similar you'll be using whatever version on mingw from that distro. you might be able to use the ubunutu based linux on windows10 feature to also crosscompile

clone minetest from git if building 64bit edit the toolchain_mingw64.cmake to set compliers. i find it easiest to edit files with notepad++ on windows you'll need to edit the file to match this

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

run the buildwin64.sh in /util/buildbot it will pull down support libs. you may need to edit the paths in buildwin64.sh before/after and may need to rerun the cygwin install if any missing support dev libraries

once you get that all ironed out it if built successful will dump a zip install into the _build folder. you can extract that to wherever but will need to copy some dlls from your cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin folder to your minetest\bin folder. i believe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll . You'll get errors if they're missing from your minetest\bin folder. If/when cygwin has mingw updates you'll need to copy the updated dll's from cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin to your minetest\bin folder again.

once you get your building environment set then updating is just running the buildwin64.sh script it'll pull down latest minetest and minetest game git and build

Re: Compiling Minetest on Windows

PostPosted: Wed Dec 20, 2017 17:09
by Enrikoo
trainwrecktony wrote:http://dev.minetest.net/Compiling_Minetest#Compiling_on_Windows

I used cygwin with its mingw to crosscompile. i previously used to build pidgin and its plugins for windows so it was familiar to me and i also use its ssh server for double secure rdp and proxy to my server remotely. i forget all the packages required but for 64bit you'll need like mingw64-x86_64 binutils libpng libjpeg libvorbis etc. There were some issues with the early mingw-gcc6 releases on cygwin so its been a while and i moved to cross compling on arch-linux which has a newer mingw-gcc7. Crosscompiling on linux will be similar you'll be using whatever version on mingw from that distro. you might be able to use the ubunutu based linux on windows10 feature to also crosscompile

clone minetest from git if building 64bit edit the toolchain_mingw64.cmake to set compliers. i find it easiest to edit files with notepad++ on windows you'll need to edit the file to match this

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

run the buildwin64.sh in /util/buildbot it will pull down support libs. you may need to edit the paths in buildwin64.sh before/after and may need to rerun the cygwin install if any missing support dev libraries

once you get that all ironed out it if built successful will dump a zip install into the _build folder. you can extract that to wherever but will need to copy some dlls from your cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin folder to your minetest\bin folder. i believe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll . You'll get errors if they're missing from your minetest\bin folder. If/when cygwin has mingw updates you'll need to copy the updated dll's from cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin to your minetest\bin folder again.

once you get your building environment set then updating is just running the buildwin64.sh script it'll pull down latest minetest and minetest game git and build

How to use CMAKE and where i can open it?

Re: Compiling Minetest on Windows

PostPosted: Mon Dec 25, 2017 04:59
by srifqi
You can download CMake from their website. Install it. It should shows up in Start Menu if you use default option.

Re: Compiling Minetest on Windows

PostPosted: Mon Dec 25, 2017 10:37
by Enrikoo
Oops i downloaded a cmake source code i need to download the stable cmake. What is the source code you selected and build what you selected?

Re: Compiling Minetest on Windows

PostPosted: Mon Dec 25, 2017 18:34
by Enrikoo
I don't know where is a directory, i tried this

Re: Compiling Minetest on Windows

PostPosted: Tue Dec 26, 2017 04:30
by srifqi
Notice: You can read this article if you still don't understand.

After you install CMake. You have to get Minetest source code. You can download from any branch (e.g. master), stable branches (e.g. stable-0.4), or version specific (e.g. 0.4.16).

After that, you extract that zipped folder into a folder, for example: minetest (C:\minetest\minetest). Then, create new folder to place some files required for compiling process, for example: mtbuild (C:\minetest\mtbuild).

Download libraries required to compile Minetest. (Read here.) Place those in another folder, for example: mtlibs (C:\minetest\mtlibs).

Open CMake. Set your source code location to your minetest folder (C:\minetest\minetest\). Set your build location to your mtbuild folder (C:\minetest\mtbuild\).

Click Configure.

Set the configuration to be like this:
Code: Select all
   BUILD_CLIENT               [X]
   BUILD_SERVER               [ ]
   CMAKE_BUILD_TYPE           Release
   CMAKE_INSTALL_PREFIX       DIR/minetest-install
   RUN_IN_PLACE               [X]
   WARN_ALL                   [ ]
   GETTEXT_BIN_DIR            DIR/gettext/bin
   GETTEXT_INCLUDE_DIR        DIR/gettext/include
   GETTEXT_LIBRARIES          DIR/gettext/lib/libintl.lib
   IRRLICHT_SOURCE_DIR        DIR/irrlicht-1.8.1
   IRRLICHT_LIBRARY           DIR/irrlicht-1.8.1/lib/?/Irrlicht.lib
   OGG_INCLUDE_DIR            DIR/libogg-1.3.1/include
   OGG_LIBRARIES              DIR/libogg-1.3.1/?/libogg.lib
   VORBIS_INCLUDE_DIR         DIR/libvorbis-1.3.3/include
   VORBIS_LIBRARY             DIR/libvorbis-1.3.3/?/libvorbis.lib
   VORBISFILE_INCLUDE_DIR     DIR/libvorbis-1.3.3/include
   VORBISFILE_LIBRARY         DIR/libvorbis-1.3.3/?/libvorbisfile.lib
   OPENAL_INCLUDE_DIR         %programfiles%\OpenAL\include
   OPENAL_LIBRARY             %programfiles%\OpenAL\lib\OpenAL32.lib
   ZLIB_DLL                   DIR/zlib125dll/dll32/zlibwapi.dll
   ZLIB_INCLUDE_DIR           DIR/zlib-1.2.5
   ZLIB_LIBRARIES             DIR/zlib125dll/dll32/zlibwapi.lib

where DIR is your mtlibs folder (C:\minetest\mtlibs).

Click Configure again.

Click Generate.

From the article, I quote:
Code: Select all
 If using MSVC:
       - Open the generated minetest.sln
       - Switch the configuration from "Debug" to "Release", unless you want to
       debug some stuff (it's slower and might not even work at all)
       - Build the ALL_BUILD project
       - Build the INSTALL project
       You may want to use console commands to compile Minetest:
           - Find MSBuild.exe in %windir%\Microsoft.NET\Framework\v?.?.?\MSBuild.exe
           - Add the path to your system PATH variable
           - Compile Minetest by switching to your DIR\minetest-build
               MSBuild.exe ALL_BUILD.vcxproj /p:Configuration=Release
       - You should now have a working game with the executable in
           DIR/minetest-install/bin/minetest.exe
       - Additionally you may create a zip package by building the PACKAGE
         project.
   If using MinGW:
       - Using the command line, browse to the build directory and run 'make'
         (or mingw32-make or whatever it happens to be)
       - You may need to copy some of the downloaded DLLs into bin/, see what
         running the produced executable tells you it doesn't have.
       - You should now have a working game with the executable in
           DIR/minetest/bin/minetest.exe


Hope this helps!

Re: Compiling Minetest on Windows

PostPosted: Tue Dec 26, 2017 04:35
by srifqi
Also, you are using Windows 10, right? You can activate Developer Mode to get Windows Subsystem for Linux and then using Bash on Ubuntu on Windows just run buildwin64.sh. :D

*This is what I do to compile Minetest.

Re: Compiling Minetest on Windows

PostPosted: Tue Dec 26, 2017 10:03
by Enrikoo
Yes i use windows 10

Re: Compiling Minetest on Windows

PostPosted: Tue Dec 26, 2017 10:23
by Enrikoo
Post some images as example what you have in your mtlibs folder

Is this a mistake?
Code: Select all
CMAKE_CONFIGURATION_TYPES = Debug;Release;MinSizeRel;RelWithDebInfo


Output error
Code: Select all
Configuring incomplete, errors occurred!
See also "C:/Users/Enrico/Downloads/minetest/mtlibs/CMakeFiles/CMakeOutput.log".


Source code misunderstand.
I haven't a DIR. Post me images as examples.
Doesn't work.

Do i need to download directory or make a directory in mtlibs?

Re: Compiling Minetest on Windows

PostPosted: Tue Dec 26, 2017 14:12
by addi
Some time ago I wrote a build script to download and build Minetest and its dependencies.

I hope this will make your live easier:
viewtopic.php?f=14&t=18558

Re: Compiling Minetest on Windows

PostPosted: Thu Jan 04, 2018 20:15
by Enrikoo
We need Buildbot to build Minetest?

Re: Compiling Minetest on Windows

PostPosted: Fri Jan 05, 2018 10:27
by addi
You does not need it, you can still do it manually, it just saves you a lot of time.