Godot: Cross compilation for Windows fails OpenSUSE Leap 42.2 64bit

Created on 17 Aug 2017  路  15Comments  路  Source: godotengine/godot

Issue Resolved

If you are running openSUSE leap in any form, download the packages below for 32bit and 64bit compilation.

mingw32-cross-gcc
mingw32-cross-gcc-c++
mingw64-cross-gcc
mingw64-cross-gcc-c++ 

System and Version Info
OS: OpenSUSE Leap 42.2 64 bit
Godot version: 19aff15

Issue description: Cross-Compiling Windows binaries on linux fails

Upon using this command scons p=windows bit=64 tools=no
I get the following output and subsequent error(s?).

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[  3%] Compiling ==> platform/windows/godot_win.cpp
sh: i686-w64-mingw32-g++: command not found
scons: *** [platform/windows/godot_win.windows.debug.64.o] Error 127
scons: building terminated because of errors.

Upon verifying that my mingw32 and mingw-w64 libs were setup correctly I got the correct error returns,

traindoctor@linux:~/workspace/godot> ${MINGW64_PREFIX}gcc
gcc: fatal error: no input files
compilation terminated.
traindoctor@linux:~/workspace/godot> ${MINGW32_PREFIX}gcc
gcc: fatal error: no input files
compilation terminated.

The specific error I get when binding an env variable to the MINGW32_PREFIX or MINGW64_PREFIX looks like this;

sh: /usr/i686-w64-mingw32-g++: No such file or directory
scons: *** [platform/windows/godot_win.windows.debug.64.o] Error 127
scons: building terminated because of errors.

I have downloaded the mingw32 and mingw-w64 packages for openSUSE from these sources:
mingw-32
mingw-w64

Steps to reproduce:
Install all required packages on OpenSUSE 42.2 Leap for godot including the packages for mingw32 and mingw-w64.
Build the Linux binaries for the initial build.
Attempt to build the binaries for Windows using the command above.

Reference to documentation.

Note: I will not be available to answer questions tomorrow as I am traveling soon.

archived bug linuxbsd windows buildsystem

Most helpful comment

I'm trying to find versions of the compatible with openSUSE leap. Other than this appreciate the help.
EDIT: Nevermind I was messing myself up by changing c++ to g++
EDIT 2: IT LIVES HOORAYYY

All 15 comments

For the first error, that is:

sh: i686-w64-mingw32-g++: command not found

Have you tried finding out the directory where i686-w64-mingw32-g++ is and adding that directory to your PATH?

I'm not on OpenSUSE, but I think it should work after that.

/usr/i686-w64-mingw32/, which i mentioned in reference to MINGW64_PREFIX should be the directory. This did not my solve my problem unfortunately but gave me this error:

traindoctor@linux:~/workspace/godot> scons p=windows bits=64 tools=no              
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[  3%] Compiling ==> platform/windows/godot_win.cpp
sh: /usr/i686-w64-mingw32-g++: No such file or directory
scons: *** [platform/windows/godot_win.windows.debug.64.o] Error 127
scons: building terminated because of errors.

I could be wrong but what comes off the top of my head is trying the following:

$ unset MINGW32_PREFIX MINGW64_PREFIX
$ PATH=/usr/i686-w64-mingw32:$PATH
$ scons p=windows bit=64 tools=no

I think that should work. Let me know if it doesn't.

traindoctor@linux:~/workspace/godot> unset MINGW32_PREFIX MINGW64_PREFIX
traindoctor@linux:~/workspace/godot> PATH=/usr/i686-w64-mingw32:$PATH
traindoctor@linux:~/workspace/godot> scons p=windows bit=64 tools=no
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[  3%] Compiling ==> platform/windows/godot_win.cpp
sh: i686-w64-mingw32-g++: command not found
scons: *** [platform/windows/godot_win.windows.debug.32.o] Error 127
scons: building terminated because of errors.

Unfortunately the same error occurred.

I think I see what's happening. Your MinGW binaries have no prefix and platform/windows/detect.py is prepending them automatically. I think there's a bug in auto detecting MinGW.

Could you try this?

$ export MINGW64_PREFIX=""
$ PATH=/usr/i686-w64-mingw32:$PATH
$ scons p=windows bit=64 tools=no
traindoctor@linux:~/workspace/godot> unset MINGW32_PREFIX MINGW64_PREFIX
traindoctor@linux:~/workspace/godot> export MINGW64_PREFIX=""
traindoctor@linux:~/workspace/godot> PATH=/usr/i686-w64-mingw32:$PATH
traindoctor@linux:~/workspace/godot> scons p=windows bit=64 tools=no
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[  3%] Compiling ==> platform/windows/godot_win.cpp
sh: i686-w64-mingw32-g++: command not found
scons: *** [platform/windows/godot_win.windows.debug.32.o] Error 127
scons: building terminated because of errors.
traindoctor@linux:~/workspace/godot> 

Damn...

What you got there seems like the 32 bit toolchain. I could be wrong, it's been some time since I've used MinGW. Mind trying?

$ export MINGW32_PREFIX=""
$ PATH=/usr/i686-w64-mingw32:$PATH
$ scons p=windows bit=32 tools=no

If that doesn't work, I'm honestly out of ideas.

traindoctor@linux:~/workspace/godot> unset MINGW32_PREFIX MINGW64_PREFIX
traindoctor@linux:~/workspace/godot> export MINGW32_PREFIX=""
traindoctor@linux:~/workspace/godot> PATH=/usr/i686-w64-mingw32:$PATH
traindoctor@linux:~/workspace/godot> scons p=windows bit=32 tools=no
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[  3%] Compiling ==> platform/windows/godot_win.cpp
sh: i686-w64-mingw32-g++: command not found
scons: *** [platform/windows/godot_win.windows.debug.32.o] Error 127
scons: building terminated because of errors.

Thanks for the information. I'll look into this.

No problem.

Install mingw32-cross-gcc-c++.

The platform validation code should likely check for both -gcc and -g++ before marking the windows platform as buildable.

And if you want to build for win64, install mingw64-cross-gcc and mingw64-cross-gcc-c++.

BTW, no need to mess with the PATH or prefixes; the required binaries should be in /usr/bin, which should be in your PATH already (if not, your system will break apart ;)). A "not found" error typically means that a package is missing.

I'm trying to find versions of the compatible with openSUSE leap. Other than this appreciate the help.
EDIT: Nevermind I was messing myself up by changing c++ to g++
EDIT 2: IT LIVES HOORAYYY

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n-pigeon picture n-pigeon  路  3Comments

ducdetronquito picture ducdetronquito  路  3Comments

EdwardAngeles picture EdwardAngeles  路  3Comments

mefihl picture mefihl  路  3Comments

Zylann picture Zylann  路  3Comments