Godot: Building with Mingw64

Created on 7 Jan 2016  ·  48Comments  ·  Source: godotengine/godot

I'm trying to compile Godot with Mingw, but get the following error:

scons: Reading SConscript files ...

MSVC not detected, attempting Mingw.
- gcc detected.
scons: done reading SConscript files.
scons: Building targets ...
run(["core\method_bind.inc", "core\method_bind_ext.inc"], ["core\make_binders.py
"])
g++ -o platform\windows\godot_win.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED
-DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -D
OC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLE
D -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_
ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -
DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLE
D -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_END
IAN -Icore -Icore\math -Itools -Idrivers -I. -Iplatform\windows -Itools\freetype
 -Itools\freetype\freetype\include -Idrivers\builtin_openssl2 -Idrivers\builtin_
zlib\zlib -Iplatform\windows\vorbis -Idrivers\builtin_openssl2\crypto -Idrivers\
builtin_openssl2\openssl -Idrivers\builtin_openssl2\crypto\evp -Idrivers\builtin
_openssl2\crypto\asn1 -Idrivers\builtin_openssl2\crypto\modes -Iplatform\windows
\include platform\windows\godot_win.cpp
=====
g++: error: CreateProcess: No such file or directory

=====
scons: *** [platform\windows\godot_win.windows.opt.tools.32.o] Error 1
scons: building terminated because of errors.

Any ideas?

archived bug needs testing windows buildsystem

Most helpful comment

100% free

:crying_cat_face:

All 48 comments

Looks like you need to add MinGW to your PATH, and apparently opening a new terminal should do the trick: http://stackoverflow.com/questions/3848357/createprocess-no-such-file-or-directory

At any rate it looks like a classic MinGW configuration issue and not Godot related, so I'll archive this issue.

@akien-mga I was running in a cmd and not msys shell before. Running in an msys shell got rid of the CreateProcess problem, but I have another now:

platform/windows/joystick.cpp:182:54: warning: passing NULL to non-pointer argument 3 of 'virtual HRESULT IDirectInputDevice8A::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA, LPVOID, DWORD)' [-Wconversion-null]
  joy->di_joy->EnumObjects(objectsCallback, this, NULL);
                                                      ^
build_res_file(["platform/windows/godot_res.windows.opt.tools.32.o"], ["platform/windows/godot_res.rc"])
scons: *** [platform/windows/godot_res.windows.opt.tools.32.o] Error 1
scons: building terminated because of errors.

Thanks, this one looks like a real bug. Pinging @Hinsbart and @punto- who worked on joystick support recently.

@akien-mga Thanks man! Is the joystick support causing the error in platform/windows/godot_res.windows.opt.tools.32.o?

Ah nevermind, I misread. The thing in platform/windows/joystick.cpp is only a warning (worth fixing, but that's not your issue here).

Just to be sure, which commit are you building?

I just cloned the most recent master branch.

So it looks like yet another silent error of mingw when processing godot_res.rc, as fixed a few weeks ago by @punto- in bec1e00.

That's a complete shot in the dark, but could you try added the missing space between "." and _MKSTR(VERSION_REVISION) here https://github.com/godotengine/godot/blob/master/platform/windows/godot_res.rc#L21 and here https://github.com/godotengine/godot/blob/master/platform/windows/godot_res.rc#L26 ?

@akien-mga No good. Still getting the same error.

Could you post the full build log? maybe as a gist

@Hinsbart As in the console output?

$ scons platform=windows bits=32 target=release_debug
scons: Reading SConscript files ...
sh: pkg-config: command not found
pkg-config not found.. x11 disabled.
scons: done reading SConscript files.
scons: Building targets ...
run(["core/method_bind.inc", "core/method_bind_ext.inc"], ["core/make_binders.py"])
i686-w64-mingw32-g++ -o platform/windows/godot_win.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/godot_win.cpp
i686-w64-mingw32-g++ -o platform/windows/context_gl_win.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/context_gl_win.cpp
build_gles2_headers(["drivers/gles2/shaders/blur.glsl.h"], ["drivers/gles2/shaders/blur.glsl"])
build_gles2_headers(["drivers/gles2/shaders/canvas.glsl.h"], ["drivers/gles2/shaders/canvas.glsl"])
build_gles2_headers(["drivers/gles2/shaders/canvas_shadow.glsl.h"], ["drivers/gles2/shaders/canvas_shadow.glsl"])
build_gles2_headers(["drivers/gles2/shaders/copy.glsl.h"], ["drivers/gles2/shaders/copy.glsl"])
build_gles2_headers(["drivers/gles2/shaders/material.glsl.h"], ["drivers/gles2/shaders/material.glsl"])
i686-w64-mingw32-g++ -o platform/windows/os_windows.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/os_windows.cpp
i686-w64-mingw32-g++ -o platform/windows/ctxgl_procaddr.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/ctxgl_procaddr.cpp
i686-w64-mingw32-g++ -o platform/windows/key_mapping_win.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/key_mapping_win.cpp
i686-w64-mingw32-g++ -o platform/windows/tcp_server_winsock.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/tcp_server_winsock.cpp
i686-w64-mingw32-g++ -o platform/windows/packet_peer_udp_winsock.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/packet_peer_udp_winsock.cpp
i686-w64-mingw32-g++ -o platform/windows/stream_peer_winsock.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/stream_peer_winsock.cpp
i686-w64-mingw32-g++ -o platform/windows/joystick.windows.opt.tools.32.o -c -O2 -DDEBUG_ENABLED -DFREETYPE_ENABLED -DWINDOWS_ENABLED -mwindows -DGLES2_ENABLED -DGLEW_ENABLED -DOC_X86_ASM -DRTAUDIO_ENABLED -DMINGW_ENABLED -DMUSEPACK_ENABLED -DOPENSSL_ENABLED -DSQUISH_ENABLED -DVORBIS_ENABLED -DOPUS_ENABLED -DTHEORA_ENABLED -DTHEORALIB_ENABLED -DPNG_ENABLED -DDDS_ENABLED -DPVR_ENABLED -DJPG_ENABLED -DWEBP_ENABLED -DSPEEX_ENABLED -DTOOLS_ENABLED -DGDSCRIPT_ENABLED -DMINIZIP_ENABLED -DXML_ENABLED -DETC1_ENABLED -DPNG_ARM_NEON_OPT=0 -DOPENSSL_NO_ASM -DOPENSSL_THREADS -DL_ENDIAN -Icore -Icore/math -Itools -Idrivers -I. -Iplatform/windows -Itools/freetype -Itools/freetype/freetype/include -Idrivers/builtin_openssl2 -Idrivers/builtin_zlib/zlib -Iplatform/windows/vorbis -Idrivers/builtin_openssl2/crypto -Idrivers/builtin_openssl2/openssl -Idrivers/builtin_openssl2/crypto/evp -Idrivers/builtin_openssl2/crypto/asn1 -Idrivers/builtin_openssl2/crypto/modes -Iplatform/windows/.\include platform/windows/joystick.cpp
platform/windows/joystick.cpp: In member function 'bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE*)':
platform/windows/joystick.cpp:182:54: warning: passing NULL to non-pointer argument 3 of 'virtual HRESULT IDirectInputDevice8A::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKA, LPVOID, DWORD)' [-Wconversion-null]
  joy->di_joy->EnumObjects(objectsCallback, this, NULL);
                                                      ^
build_res_file(["platform/windows/godot_res.windows.opt.tools.32.o"], ["platform/windows/godot_res.rc"])
scons: *** [platform/windows/godot_res.windows.opt.tools.32.o] Error 1
scons: building terminated because of errors.

ok yeah, sorry that wasn't really needed. My misunderstanding ^^
Anyway, as @akien-mga pointed out this seems to be caused by godot_res.rc.
Unfortunately I can't reproduce it, mingw builds fine for me on windows 10 and linux, strangely I also don't get the passing NULL warning...

Just to check, do you get the same issue if you try to build with bits=64?

@Hinsbart What version of mingw do you have? I'm running under MSYS2 with the latest mingw64.

@akien-mga Same thing with bits=64.

I think my version of mingw64 is a few months old by now. I don't know how to find out which version I have, but gcc is 4.8.2 if that helps.

Try running the following command (in the godot dir) and see what errors it produces:

i686-w64-mingw32-windres --include-dir . -i platform/windows/godot_res.rc -o platform/windows/godot_res.windows.tools.32.o

@Hinsbart It says "command not found"

The executable should be windres not i686-w64-mingw32-windres.
On Jan 7, 2016 12:52 PM, "Hondres" [email protected] wrote:

I think my version of mingw64 is a few months old by now. I don't know how
to find out which version I have, but gcc is 4.8.2 if that helps.

Try running the following command (in the godot dir) and see what errors
it produces:

i686-w64-mingw32-windres --include-dir . -i platform/windows/godot_res.rc -o platform/windows/godot_res.windows.tools.32.o


Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3260#issuecomment-169755261.

ok, sorry I tried that on linux.
Anyway what's the output when running that with "windres"?

@Hinsbart There was no error or any thing output, and it built the correct object file! I tried rerunning scons to see if it would recognize the file, but I'm still getting the same error.

@Hinsbart I think I found the problem. For Windows the mingw prefixes are not necessary so in detect.py L183 the script is attaching a prefix which should not be there in Windows. I edited that line to read:

cmdbase = 'windres --include-dir . '

And now the error I had went away, but another one popped up:

sh: i686-w64-mingw32-ar: command not found

Again, same problem. The i686-w64-mingw32 should not be there for mingw in windows. The command is just "ar" in the MSYS shell.

Ony my windows, it doesn't attach any prefixes. Maybe try overriding or deleting the MINGW32_PREFIX and MINGW64_PREFIX environment variables.

This is the odd part....I don't have those variables set. This is definitely the problem because I renamed a few of the binaries it was asking for and it just moved onto the next.

Mhh, that's odd indeed... it should only set the prefixes if those env vars are present (or if the os is posix, which is also not the case)
But I'm not a mingw or buildsystem guru - sorry to say that I'm as stuck on this one as you are :/

Just to make sure - running

unset MINGW32_PREFIX
unset MINGW64_PREFIX

before the build doesn't make any difference?

I found the offending function in detect.py!!!

def get_opts():

    mingw=""
    mingw32=""
    mingw64=""
    if ( os.name == "posix" ):
        mingw = "i586-mingw32msvc-"
        mingw32 = "i686-w64-mingw32-"
        mingw64 = "x86_64-w64-mingw32-"

        if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
            mingw32 = mingw

    if (os.getenv("MINGW32_PREFIX")):
        mingw32=os.getenv("MINGW32_PREFIX")
        mingw = mingw32
    if (os.getenv("MINGW64_PREFIX")):
        mingw64=os.getenv("MINGW64_PREFIX")


    return [
        ('mingw_prefix','Mingw Prefix',""),
        ('mingw_prefix_64','Mingw Prefix 64 bits',""),
    ]

When I set the third return parameter in this function to an empty string it works!

Edit: Maybe because I am running in an MSYS shell it thinks I'm on a posix environment so its setting those prefixes?

New error of a very different nature:

sh: /mingw32/bin/ar: Argument list too long
scons: *** [drivers/libdrivers.windows.opt.tools.32.a] Error 126

You can throw some print() 's in there to check.
like print(os.name) or print(mingw32)

As for the new error: no idea :/

@primesoftware this new error is likely the same as #3122.

@Hinsbart I wrote a quick python script to test the output of os.name and it is "nt". I also checked to see if MINGW32_PREFIX or MINGW64_PREFIX was set and neither was. This is very odd, but I'm glad its working now if by a hack only.

@vnen Yes, that's it exactly. I don't plan to use openssl so I set openssl=no to trim down the command and its building fine now.

Not going to work on this myself for the time being, Mingw32/W64 running on windows is difficult to support (in comparison to msvc and msvc express which work wonderfully). If anyone more familiar with it wants to work on it, feel free to do it

No problem at all. I'll take the reigns on this one once I'm done with
integrating mbedTLS and libcurl. I've made some good progress on the
latter. I've written some rough scons scripts to build mbedtls and libcurl.
My debug_release build without OpenSSL and without mbedtls/libcurl is 44.3
MB. The same build without OpenSSL but with mbedTLS/libcurl is 44.7 MB. I'm
adding the mbedTLS/libcurl stuff as a module instead of editing the Godot
drivers / core. We can always change that later if you want. I'm confident
with a little more cleaning I should have libcurl optimized in terms of
size. In addition I've got all of this building on MinGW. Once I've cleaned
up my code a bit I will push.

On Fri, Jan 22, 2016 at 8:45 AM, Juan Linietsky [email protected]
wrote:

Not going to work on this myself for the time being, Mingw32/W64 running
on windows is difficult to support. If anyone more familiar with it wants
to work on it, feel free to do it


Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3260#issuecomment-173924745.

What's the status on this issue? Did you manage to build with MinGW on Windows, or is it still problematic?

@akien-mga It builds if you edit the detect.py. I haven't tried to build Godot with Mingw in a few months since I've had to take a detour to getting my REST API setup. Hoping to get back to this soon though.

Not critical for the upcoming 2.1, so moving to the next milestone (also it's still unclear whether the bug can be reproduced).

I think the only issue is that MSYS says it's a posix environment, then Godot's buildsystem tries to compile for Windows as it were on Linux. The Mingw shell don't have this problem and is working fine for me.

I'll try to solve this for 2.2.

Hi. My workaround for the prefix issue has been to add an extra platform check in get_opts():

if ( os.name == "posix" and not platform.system().startswith("MINGW") ):
...

Now I am hitting the "Argument list too long" issue with ar.

getconf ARG_MAX shows 32000 Bytes

The length of the ar args is well over 50k (debug build with tools).

I'll try take a look at this soon (completely forgot about this...)

I forgot to keep or publish a note about it, but if I remember correctly PR #1432, compilation with Mingw64 under Windows was supposed to occur into the Windows Command console and/or the MS Powershell, and NOT into Msys or whatever linux/ported terminal.

If it can help, I left some notes about how to set environment variables for Mingw64 into the detect.py file :

`#####
# Notes about Mingw-w64 and Mingw-w32 under Windows :
#
#   - both can be installed using the official installer :
#       http://mingw-w64.sourceforge.net/download.php#mingw-builds
#
#   - if you want to compile both 32bits and 64bits, don't forget to
#   run the installer twice to install them both.
#
#   - install them into a path that does not contain spaces
#       ( example : "C:/Mingw-w32", "C:/Mingw-w64" )
#
#   - if you want to compile faster using the "-j" option, don't forget
#   to install the appropriate version of the Pywin32 python extension
#   available from : http://sourceforge.net/projects/pywin32/files/
#
#   - before running scons, you must add into the environment path
#   the path to the "/bin" directory of the Mingw version you want
#   to use :
#
#       set PATH=C:/Mingw-w32/bin;%PATH%
#
#   - then, scons should be able to detect gcc.
#   - Mingw-w32 only compiles 32bits.
#   - Mingw-w64 only compiles 64bits.
#
#   - it is possible to add them both at the same time into the PATH env,
#   if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment
#   variables.
#   For instance, you could store that set of commands into a .bat script
#   that you would run just before scons :
#
#           set PATH=C:\mingw-w32\bin;%PATH%
#           set PATH=C:\mingw-w64\bin;%PATH%
#           set MINGW32_PREFIX=C:\mingw-w32\bin\
#           set MINGW64_PREFIX=C:\mingw-w64\bin\

and

# Notes about Mingw under Windows :
#
#   - this is the MinGW version from http://mingw.org/
#   - install it into a path that does not contain spaces
#       ( example : "C:/MinGW" )
#   - several DirectX headers might be missing. You can copy them into
#   the C:/MinGW/include" directory from this page :
#    https://code.google.com/p/mingw-lib/source/browse/trunk/working/avcodec_to_widget_5/directx_include/
#   - before running scons, add the path to the "/bin" directory :
#       set PATH=C:/MinGW/bin;%PATH%
#   - scons should be able to detect gcc.
#

Since last year i have abandoned Mingw in favor of Visual C++ Build Tools 2015 (see #6501) which is faster, 100% free, and lightweight compared to Mingw and Mingw64. So, good luck to @vnen 👍

100% free

:crying_cat_face:

( yeah, "100% free" like "obtainable without any payment", "free of charge", "gratis", "no cost". edit : and "freeware" ; edit2 : and "you probably already indirectly paid it through your official Windows OS license" )

Anyway, it is possible to build with MinGW-w64 and supporting an open source alternative is good IMO. It is also possible to build with Msys (according to some reports) with some tweaks in the build system.

@SuperUserNameMan your PR (#6501) actually broke some stuff for MinGW. VSXXXCOMMONTOOLS vars are defined system-wide, so they're always there even in a regular command prompt (if you installed VS). So if I start the build in a regular prompt, it'll try to use VS, not MinGW. We need a better way to detect the standalone build tools.

@vnen : I had to do some archeology. It was the standard behavior since first initial release back in 2014 .

Mingw was already considered as a fallback if MSVC was not detected via the VSINSTALLDIR env var.

6501 only added extra tests for extra env vars, but it kept the original logic intact.

So i'm not the guilty one here :P (unless i missing your point of course)

I guess the logic behind this behavior is that users are not supposed to install both MSVC and MinGW.

As a workaround, one just have to unset each tested VSXXXCCOMONTOOLS and VSINSTALLDIR env vars :

set VSINSTALLDIR=
set VS100COMNTOOLS=
set VS110COMNTOOLS=
set VS120COMNTOOLS=
set VS140COMNTOOLS=

Though i agree that there could be a better way to allow user to choose whether he/she wants to compile with Mingw or MSVC when both are available at the same time.

edit :

and supporting an open source alternative is good IMO

and i agree with that indeed 👍
because, for now, Microsoft is nice and generous with its free tools, but someday in the future it might change its mind.

@vnen : okay, i think i've found what was going wrong

I think we should have tested for VCINSTALLDIR (with a C) instead of VSINSTALLDIR (with a S).

VCINSTALLDIR ( with a C) is set only into the Visual C++command prompt console, when the VSxxxxx are set all the time.

edit : that's a mistake you did not do in your winrt PR btw

@SuperUserNameMan well, I have both VCINSTALLDIR and VSINSTALLDIR defined in a VS prompt (with VCINSTALLDIR=%VSINSTALLDIR%\VC\).

My point however is that VS140COMNTOOLS is defined also in regular command prompts so it'll never fallback to MinGW. The extra env vars you added will always detect VS is installed, even if using a regular prompt (and the build script will give an error, since the install dir is not defined in this case).

@vnen : yes i think i understood what you meant now.

before #6501, scons failed to detect MSVC Standalone Tools because of the original confusion between VSINSTALLDIR and VCINSTALLDIR.

Here was the real bug that I did not notice when I tried to make it compatible with MSVC standalone tools.

So now, when I revert #6501 and replace faulty VSINSTALLDIR (with S) occurences by VCINSTALLDIR (with C) the MSVC standalone tools are detected.

I think mingw should be detectable again with these changes.

edit : with this changes, when scons called from regular command prompt :

scons: Reading SConscript files ...

MSVC not detected, attempting Mingw.
- could not detect gcc.
Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.

No valid target platform selected.
The following were detected:
        android

Please run scons again with argument: platform=<string>
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

So my workaround for the ar issue has been to uses system libs.

libogg=system libvorbis=system libtheora=system opus=system freetype=system libpng=system libwebp=system openssl=system enet=system glew=system builtin_zlib=no

Although I also had to disable static linking, hack windows/SCsub a bit

env.Replace(LINKFLAGS = ['-Wl,-no-undefined', '-Wl,--subsystem,windows'])
env.Append(LIBS=['opusfile', 'opus', 'freetype', 'enet', 'ssl', 'crypto', 'theora', 'vorbis', 'vorbisfile', 'ogg', 'webp', 'png', 'z', 'glew32'])

But I've got a working debug build in the end (msys2/64bit).

A minor issue atm is that the console output it produces is completely garbled, not sure if this is intended ;)

EEEDE.1y2r34R.1y2r34RCVCcHHHHHHHr{1y2r34RCVCc

Bump. Did anything change on this issue, were there any PR-able workarounds/fixes....

regarding the related issue mentioned by @vnen, I pushed a fix (#6937) that was merged to the master.

as for the issue mentioned by @primesoftware , i don't know if this PR fixed it

This issue is a bit old and quite confusing as many different topics were discussed here, so closing. If there are still issues building with MinGW-w64 on Windows, please open a new issue with recent info.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blurymind picture blurymind  ·  3Comments

ndee85 picture ndee85  ·  3Comments

nunodonato picture nunodonato  ·  3Comments

bojidar-bg picture bojidar-bg  ·  3Comments

SleepProgger picture SleepProgger  ·  3Comments