I want to compile Godot, but it does not work. Keeps not finding MinGW

Godot Version

4.4.1

Question

So, I wanted to compile the godot templates from scratch iot obtain:

  • encryption with my own key
  • reduction of exe file by omitting stuff I never use, e.g. 3D stuff (I only do 2D games and I suspect I will stick to that)

So I was trying to follow the tutorials:

But I got stuck because the f*cker named scons does NOT want to recognize MinGW.

“ERROR: No valid compilers found, use MINGW_PREFIX environment variable to set MinGW path.”

I have set the environmental variable as said in the tutorial.

I tried a different MinGW version

I found a youtube tutorial of some indian guy who claims to have fixed the problem, turns out he did exactly what I did and the problem remains.

I desperately tried anything, e.g. like moving files such as gcc.exe from the mingw/bin directory to the scons directory just in case, I know it sounds silly, byt maybe just maybe the idiot program will find them in its own mother directory!?

Nope, of course.

He wants them where the environmental variable says they are. But I did set the variable! No mismatch –I copypasted the exact name MINGW_PREFIX and the exact dir, I did NOT write them down by hand.

I have no clue on how to go on. People all around the world seem to happily follow the tutorial, install all the stuff, set up the env variables and et voilà, everything works.

Here nothing works because that idiot of scons does not want to find any compiler. (i also have vscode installed, so I have other c++ compilers installed somewhere; seems those are off limits too, somehow).

Any suggestion? I am VERY angry and discouraged. I spent like 6 hours just to set up this thing that should be straightforward and I don’t see any solution.

Could you show me what your path environment looks like? Usually this can happen if you only added the root folder of the toolchain, and not the bin folder, it can happen by accident.

1 Like

Follow the usual steps to the letter as detailed by the Godot manual. Use a clean clone of the Godot repository. You want to be sure that compilation in general works before any modifications or following someone else’s tutorial.

Keep in mind that setting environment variables via the Windows UI only apply in new Terminal windows, not the ones you may have already open.

Type set in Terminal to see the environment variables. Check that MINGW_PREFIX is listed and correct (see manual).

1 Like

@tibaverus thank you for you reply. first of all, the tutorial make it clear that you don’t have to add the bin folder, but rather the root folder. That said, I tried both, and they both don’t work

I wrote the tutorial, and I specifically made sure to mention that you need to add the bin folder.

2 Likes

@codesmile Thank you for you reply. SET returns nothing; it actually asks me some questions, namely:
Cmdlet Set-Variable in position 1 of command pipeline

Specify the values for the following parameters:

Name[0]:

and I have no idea of what it means. I can only tell you that i DID restart the terminal windows after setting the environmental variables, as stated in the tutorials

Thank you for the reply. Fine, maybe I made confusion with another tutorial which said the opposite. Sorry but I have been working on it all day. That said, I tried both, they both don’t work. I did restart the terminal each time.

Is there a way to manually tell scons where to find the compiler?

Is it possible that he only wants it from env variables? No other way to change it?

Also why is SET returning nothing to me?!

Here’s a snapshot of my env vars:

I recommend putting the path insude the Path variable. Please click on “Path” at the top list, then click on modify, and add the path to the bin folder there.

thank you again. It is not visible in my screenshot because there are many paths, but I did put the path in the path field, both for the “boris” and the “administrator” user. I put both the bin subdir and the main dir as well. And I tried the terminal both as a normal user and as an administrator

ok. Turns out that SET in the power shell and in the standard terminal seem to do different things.

In the humble old terminal window, set effectively shows me all environment variables , and the MINGW_PREFIX is listed correctly there.

I tried again from the standard terminal, both as a std user and as admin, but still does not find, same error: use MINGW_PREFIX etc

That means you are using Powershell, not Terminal (cmd.exe). I avoid PS due to muscle memory friction, according to stackoverflow the equivalent to set is gci env:

You can open Terminal via right-click on the Start Menu, or use Win+R to open the “run command” dialog and enter cmd

@CodeSmile thank you again; as I argued above, I came to the same conclusion, opened the terminal already, and checked that the environmental variable was set correctly.

can you show your Environment variables / Path ?

Sure.

Here it is

might be a dumb question sorry( I am not familiar with the mingw,I only installed GNU compiler) .

Does the mingw bin folder have any contents? or is it empty(happend to me once lol)

1 Like

@Frozen_Fried it is filled with executable files, most notably gcc and g++ exes

Have you tried using the method that the error suggests?

set MINGW_PREFIX=C:\path\to\your\mingw64

I am trying editing the Sconstruct file to force using my compilers.

I tried adding stuff like env = Environment(CXX=”g++.exe”. And deleting other stuff

Even if I have no idea of what I am doing, I am seeing something strange: that is, scons keeps insisting that I have to set the MinGW path.

But where is exactly the part that tells him that MinGW exist, or should be used?! I can’t find that string in the SConstruct file, not any particular reference to miniGW -well actually something I found, and I already deleted it.

EDIT: I found the Sconscript files at last

I am so perplexed that I don’t get an error like “wtf r u doin idiot u messed up the sconstruct file now the world will explode division by zero error”, I can accept that my naive modifications are not working, but WHY on Earth is scons still looking for MinGW? For the sake of God is there a way to let scons forget about that package?!

@Frozen_Fried It’s the very first thing I did my frie(n)d…

1 Like