Building modules on Windows

BlitzMax Forums/BlitzMax Module Tweaks/Building modules on Windows

marksibly(Posted 2007) [#1]
Mingw is the collection of C/C++ compilers and tools used to build BlitzMax on Windows.

You only need to install Mingw if you plan to rebuild Blitz Research or third party modules. BlitzMax can be used 'as is' to create applications without having to install Mingw.

As of v1.26, BlitzMax uses Mingw v5-1-3. The Mingw auto installer is available here:

http://sourceforge.net/project/downloading.php?group_id=2435&use_mirror=jaist&filename=MinGW-5.1.3.exe&2597933

Select 'current' when asked which package to install.

Select 'MinGW base tools' and 'g++ compiler' when asked which components to install.

Vista users: Once installed, you will need to copy the contents of the MinGW\libexec\gcc\mingw32\3.4.2 directory into MinGW\bin.

Finally, make sure to add C:\MinGW\bin (or equivalent) to your system PATH environment variable. This can be done on most versions of windows by right-clicking 'My Computer' and selecting Properties/Advanced/Environment Variables.

You will also need to add a new environment variable, MINGW , setting it to C:\MinGW (or equivalent).


Amon(Posted 2007) [#2]
An addition to Vista users. You must also create a new Variable called "MinGW" and set it to c:\MinGW.

After I did that I was able to build modules.

[edit] Under User Variables Click New and name it MinGW. Set its variable to wherever you installed MinGW.


TaskMaster(Posted 2007) [#3]
And, how does one get BlitzMax 1.26?

Duh, nevermind, I downloaded it.


Grisu(Posted 2007) [#4]
Is there a full package download of MinGW somewhere?
So one don't need to have an internet connection.

With the updated compiler, is it possible to optimise apps for SSE instructions?


popcade(Posted 2007) [#5]
http://www.blitzbasic.com/Community/posts.php?topic=72923

Don't know if this helps but you can midify it as you want.


Glenn Dodd(Posted 2007) [#6]
Downloaded the mingw version as above (current and g++).
Installed.
Added path variable as above (WinXP).
Done reboot.

Build and Rebuild are still greyed out?
Any ideas?

Cheers
Glenn


H&K(Posted 2007) [#7]
Any ideas?

Download and use BLide


Glenn Dodd(Posted 2007) [#8]
That is my next step, but i am a new Blide user so i didn't know if this module building issue would be a problem...


Glenn Dodd(Posted 2007) [#9]
Seems i needed the Environment Variable just like Amon said for Vista.


sebas76(Posted 2007) [#10]
Hello,

I've just udpated to 1.26 and MinGW 5.1.3 but it doesn't work !
Before I used bmax 1.24 + MinGW 3.1 on Vista without problem.
But now with new version nothing works !
I've set the env variables but the compiler doesn't find include files like ctype.h.

Errors are :
Compiling:blitz_app.c
In file included from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz.h:5,
from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c:2:
D:/Prog/BlitzMax/mod/pub.mod/stdc.mod/stdc.h:5:19: ctype.h: No such file or directory
and so on...

Any ideas ?


degac(Posted 2007) [#11]
I presume you are using Vista and maybe this could be a solution

Vista users: Once installed, you will need to copy the contents of the MinGW\libexec\gcc\mingw32\3.4.2 directory into MinGW\bin.


PS: I'm afraid - I've not Vista so I cant' test/check


sebas76(Posted 2007) [#12]
No degac, I 've tried all is possible.
I'm using Vista but I have succedeed with MinGw3.1 and Bmax1.24.
Now I'm afraid that it won't work with MinGw 5.1.3 and Bmax 1.26.
It's a big problem for me, I can't wait a long time to bmax works again.
I hope a precise solution will be given soon.

No I get these errors :

Building Modules
Compiling:blitz_app.c
In file included from C:/mingw/include/ctype.h:20,
from D:/Prog/BlitzMax/mod/pub.mod/stdc.mod/stdc.h:5,
from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz.h:5,
from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c:2:
C:/mingw/include/stddef.h:6:24: no include path in which to search for stddef.h
In file included from D:/Prog/BlitzMax/mod/pub.mod/stdc.mod/stdc.h:5,
from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz.h:5,
from D:/Prog/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c:2:


tonyg(Posted 2007) [#13]
It's a big problem for me, I can't wait a long time to bmax works again.

If you are desperate then use 1.24 until you get a hsolution.


Grey Alien(Posted 2007) [#14]
Vista users: Once installed, you will need to copy the contents of the MinGW\libexec\gcc\mingw32\3.4.2 directory into MinGW\bin.


Think there may be a typo there, the only folder in MinGW\libexec\gcc\mingw32\ is 3.4.5 on my PC after installing the version from the link at the top...(I'm using XP so didn't do this step anyway)


degac(Posted 2007) [#15]

the only folder in MinGW\libexec\gcc\mingw32\ is 3.4.5 on my PC


Interesting, I have a separate install for the old MinGW 3 and the new one 5.3.1; I have this folder structure
MinGW531
 bin
 doc
 ...
 libexec
  gcc
   mingw32
    3.4.2


Is there a new version of MingW, and you are using it? Maybe this can raise problems...

For info only I post the installed.ini file placed in the MinGW531 folder
[settings]
mirror=
installtype=current

[components]
runtime=mingw-runtime-3.13.tar.gz
w32api=w32api-3.10.tar.gz
binutils=binutils-2.16.91-20060119-1.tar.gz
core=gcc-core-3.4.2-20040916-1.tar.gz
gpp=gcc-g++-3.4.2-20040916-1.tar.gz
g77=
ada=
java=
objc=
make=



sebas76(Posted 2007) [#16]
I'm very disappointed that I can't get bmax 1.26 to work on vista becauce with previous version I found the tips to make bmax 1.24 + mingw works fine !

I've tried to install v3.4.2 or v3.4.5, the problem is the same...


Dreamora(Posted 2007) [#17]
Both are wrong
The correct MingW is 5.1.X and you need to manually copy ar.exe and ld.exe from that mingw into BlitzMax\bin folder


Filax(Posted 2007) [#18]
I get problem with vista and mingw 3.4.5

1) Old version removed
2) New version installed under C:\

3) 2 System var created :
GCC_EXEC_PREFIX
c:\MinGW

Mingw
c:\MinGw

4) NEw path added :
c:\MinGW\Bin;C:\MinGW\lib\gcc-lib\mingw32\3.4.5

5) Copied the contents of the MinGW\libexec\gcc\mingw32\3.4.5
directory into MinGW\bin.

And Bmax return me :


Any idea ? :/


Brucey(Posted 2007) [#19]
You don't have headers installed, by the looks of it Filax.

This is the important part of the install :

Select 'current' when asked which package to install.

Select 'MinGW base tools' and 'g++ compiler' when asked which components to install.


MinGW 5.1.3 is a modular based isntaller - unlike MinGW 3.1.0 which was an all-in-one install. So you get to choose what parts of it you download and install.
Which may be why you are missing some of it...


Filax(Posted 2007) [#20]
Hi Brucey :) thanks for reply :)

Of course ! i do :
Select 'MinGW base tools' and 'g++ compiler' when asked which components to install.

I just not specify in my previous post, sorry ! :)

under C:\MinGW\include i have many .h file (288 files).
I follow the step by step tutorial correctly.

Mark any idea ? :)


coffeedotbean(Posted 2007) [#21]
I get the same, followed marks tut to the letter and got somthing about ctype file, tried the many ideas in this thread and the same.

Mark helps us out here.


coffeedotbean(Posted 2007) [#22]
Can any 1 who has MingGW installed and working in Vista Home please post up any User and/or System ENV VARS you have set and the version of Max and MinGW you have.

I tearing my hair out here.. Its now asking for an included path for stdef.h ARRRG!!!!!


SebHoll(Posted 2007) [#23]
These are mine for Vista Ultimate (which should be the same as Home):

GCC_EXEC_PREFIX=C:\MinGW
MinGW=C:\MinGW
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\BlitzMax\bin;C:\MinGW\bin
Hope this helps!


coffeedotbean(Posted 2007) [#24]
Nope the only new additoin u had was path to blitzmax bin.

But didint solve my problem, its aking for a file sttdef.h thats not even with MinGW 5.1.3?

heres the beinging of the blizoutpt when building mods


Building Modules
Compiling:blitz_app.c
In file included from D:/BlitzMax 126/mod/pub.mod/stdc.mod/stdc.h:5,
from D:/BlitzMax 126/mod/brl.mod/blitz.mod/blitz.h:5,
from D:/BlitzMax 126/mod/brl.mod/blitz.mod/blitz_app.c:2:
c:/MinGW/include/ctype.h:20:20: stddef.h: No such file or directory
In file included from D:/BlitzMax 126/mod/pub.mod/stdc.mod/stdc.h:5,
from D:/BlitzMax 126/mod/brl.mod/blitz.mod/blitz.h:5,
from D:/BlitzMax 126/mod/brl.mod/blitz.mod/blitz_app.c:2:
c:/MinGW/include/ctype.h:188: error: syntax error before "wctype_t"
c:/MinGW/include/ctype.h:215: error: syntax error before "towlower"
c:/MinGW/include/ctype.h:216: error: syntax error before "towupper"
c:/MinGW/include/ctype.h:224: error: syntax error before "wc"
c:/MinGW/include/ctype.h: In function `iswalnum':




then followed by many lines of


c:/MinGW/include/ctype.h: At top level:
c:/MinGW/include/ctype.h:228: error: syntax error before "wc"
c:/MinGW/include/ctype.h: In function `iswdigit':




SebHoll(Posted 2007) [#25]
That's stange. I don't know if you have already checked, but does the following file exist on your computer: C:/MinGW/include/stddef.h? If not, I suggest that you completely uninstall MinGW, delete C:\MinGW and try reinstalling v5.1.3 again as you will be missing some important header files.


coffeedotbean(Posted 2007) [#26]
GOT IT WORKING!!

I had a big problem getting MinGW & Max talking on Vista, but heres how you do it.

The biggest tip to to keep the default install locations of Max and MinGW.

1. Download BMAx 1.18 and install in C:\program files\blitzmax (defualt location)
2. Download the 1.26 update and istall.
3.Run Max, sync mod & build docs, close MAX
4.Download MinGW Here
5. Run It and install 'MinGW base tools' and 'g++ compiler', install in C:\MinGW (default)
6.you will need to copy the contents of the MinGW\libexec\gcc\mingw32\3.4.2 directory into MinGW\bin
7. Add some new ENV VARS, right-clicking 'my computer' and selecting properties/advanced/environment variables.
8. Under USER add 'GCC_EXEC_PREFIX > C:\MinGW' and 'MinGW > C:\MinGW' to the end of your PATH VAR in SYSTEM add ';C:\MinGW\bin'
9. Run BlizMax

You should now be able to build your mods.

What I have found out is that if you install blitz in any other partition than C MinGW wont like it. does not have to be in program files but must be on C drive.

Big thankyou to Amon who helped too.


Glenn Dodd(Posted 2007) [#27]
.


Glenn Dodd(Posted 2007) [#28]
.


Glenn Dodd(Posted 2007) [#29]
.


Koriolis(Posted 2007) [#30]
Thanks for the info coffeedotbean. My project import a c code snippet and with v1.26 I couldn't compile it anymore.
However I didn't feel like putting BlitzMax or MinGW on c: (all my data and non-system programs are on d:) so I've found for another way and found it.

SO HERE IS AN EVEN SIMPLER FIX FOR THE C COMPILING PROBLEM:
Add an environment variable named C_INCLUDE_PATH, and put in here the (semi-colon separated) list of required include path.
In my case; I had to put:

D:\Programs\MinGW\include;D:\Programs\MinGW\lib\gcc\mingw32\3.4.5\include

And now it compiles OK.

If you need to compile C++ files, there is a similar environment variable named CPLUS_INCLUDE_PATH.

Hope this helps.


Dreamora(Posted 2007) [#31]
If you used the mingw installer this would have been done automatically actually ...


Koriolis(Posted 2007) [#32]
You know there is a reason why people are are struggling here.
I *did* use the installer linked by Mark Sibly himself. As pointed by coffeedotbean, it *seems* to be a problem with Vista (I won't waste more time trying to figure it out).


Muttley(Posted 2007) [#33]
The key thing seems to be you have to have MinGW installed in C:\MinGW. I had the same problems getting this working until I uninstalled MinGW and reinstalled in C:\MinGW.


CoderLaureate(Posted 2007) [#34]
I'm not having *any* luck.

I'm running BMax on Windows XP Pro. I did *all* of the steps listed above and when I try to build mods I get this:


Building Modules
Compiling:blitz_app.c
Build Error: failed to compile C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c
Process complete




Brucey(Posted 2007) [#35]
The error implies that MinGW is either not installed, or not on the PATH.

If you have it all installed properly, double-check that it is on your PATH.

If you open a CMD console and type: gcc
...and your PATH is correct, it should try to run it, and report that you haven't provided any files.


CoderLaureate(Posted 2007) [#36]
Got it. I can't believe it was something as simple as "I forgot to add the trailing '\' in the path variable.


tonyg(Posted 2008) [#37]
Not sure why but I started getting the
Building Modules
Compiling:blitz_app.c
Build Error: failed to compile C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c
Process complete


message on Build Modules after never having a trouble.
CTRL+D was available suggesting my paths were fine (and they had previously worked).
However, I did notice that my C:\MinGW\bin was no longer at the end of my path. I cut/pasted it but the problem still occurred so I uninstalled/reinstalled MinGW and things began to work again.
On my laptop I got the same issue. I noticed C:\MinGW\bin was not at the end of the $PATH statement either *BUT* this time I left it and simply uninstalled/reinstalled MinGW. This time it did *NOT* resolve the problem. I then moved the C:\MinGW\bin statement to the end of my path variable and, hey presto, all worked again.
So, to summarise, my issue needed a reinstall of MinGW *and* C:\MinGW\bin to be at the end of my PATH variable.


INVENT(Posted 2008) [#38]
so ihave installed mingw, added new variable MinGW

with path C:\MinGW\bin\

which is where it is installed still comes up in BLide with the error

Compiling:blitz_app.c

Build Error: failed to compile C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c

i can use the command prompt in xp to go into the mingw directory and run it, it says no input files etc


but blide will not run build modules, although max ide recognises it even before i installed mingw.....what am i doing wrong....does blide have to point somewhere to recognise mingw

???


INVENT(Posted 2008) [#39]
no its all good, forgot to add the path as well....doh...


Cruis.In(Posted 2008) [#40]
I am getting this same error

Building Modules
Compiling:blitz_app.c
Build Error: failed to compile C:/Program Files/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c
Process complete

i have the path in environment variables, c:\mingw\bin

i am running winxp and latest version of mingw and g++

k what people dont make clear is you need to create a new path, but put

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\QuickTime\QTSystem\;C:\MinGW\bin

, I was adding C:\mingw\bin onto the existing PATH entry in system variables.


d-bug(Posted 2008) [#41]
You have to add a variable MinGW and set it to C:\MinGW.

If this doesn't help, copy all libs from MinGW to BlitzMax\lib.


dawlane(Posted 2008) [#42]
You also have to add GCC_EXEC_PREFIX to the environment variables and point it to C:\MINGW\lib\gcc.
You can install MINGW to any folder on any drive that doesn't contain spaces in the name.


JoshK(Posted 2008) [#43]
It would be nice if some of this could be simplified with a custom MinGW installer.


Robb(Posted 2008) [#44]
EDIT: Doesn't matter, I reinstalled MingW and it works now...


*(Posted 2009) [#45]
To get it going under vista simply follow these steps:
1) install mingw (5.1.4 here)
2) copy ld.exe and ar.exe from c:\mingw\bin to your blitzmax\bin directory
3) open 'my computer'
4) click system properties at the top of the window
5) click on advanced system settings on the left bar
6) click on the enviroment variables button
7) in 'User variables for ...' click new
8) name it MingW and add C:\mingw as the value

that should be it :)


Jason W.(Posted 2009) [#46]
Edzup,

You have to add a C:\MinGW\bin to the path.

I used these settings for Windows 7, and it worked fine.

You need to run as Administrator for both Vista and Windows 7.

Jason


ImaginaryHuman(Posted 2009) [#47]
I'm having some trouble complining a release version of an app under Vista. I did all the steps described above. Rebuilt all modules fine no errors. Can complile in debug mode, works fine. Cannot compile in release mode, it says `Building <appname>' then `Compiling <appname>` and just sits there processing *something*, cpu is at 100% usage and never stops, it never gets to linking.

I'm using the version of MinGW + gcc as referenced in mark's first post.

?????


Chroma(Posted 2009) [#48]
You're all wrong. I've added the paths. It doesn't work. I'm using Vista installed MinGW 5.1.4.

Fixed...see below.


Chroma(Posted 2009) [#49]
Coffeedotbean is right. Follow his steps and it will work just fine. Everyone else needs to be smacked...


plash(Posted 2009) [#50]
@Chroma: Vista requires extra steps..


Blitzplotter(Posted 2010) [#51]
On wy tried Dreamora's suggestiong but still got this:-

Building AOTMG
Compiling:fullaccess.cpp
Build Error: failed to compile C:/Users/Owner/Downloads/BlitzIDEs/Greysframework/include/fullaccess.cpp
Process complete

Anyone got compiles going on a W7 machine involving .cpp ? I've done all the good add stuff to system and user paths to no joy.


xlsior(Posted 2010) [#52]
What drive/paths do you have your MinGW and Blitzmax installed to?

I had a lot of problems with MinGW under Vista when it was installed in a sub-subfolder, but everything startetd working fine after I moved it to c:\MinGW instead.

I also remember some people running into problems if MinGW was installed on a different *drive* from Blitzmax itself.


SebHoll(Posted 2010) [#53]
On wy tried Dreamora's suggestiong but still got this:-

Building AOTMG
Compiling:fullaccess.cpp
Build Error: failed to compile C:/Users/Owner/Downloads/BlitzIDEs/Greysframework/include/fullaccess.cpp
Process complete

Anyone got compiles going on a W7 machine involving .cpp ? I've done all the good add stuff to system and user paths to no joy.

Can you post a screenshot of your "About MaxIDE" window?


Blitzplotter(Posted 2010) [#54]
[EDIT] my bad, didn't populate the environment/system variables properly. So, this works on W7 (;-)

I've just checked my About MaxIDE & it states:

GCC unavailable[EDIT]not any more fixed
G++ unavailable[EDIT]not any more fixed

Snapshot:-

[EDIT]

Its okay, I've fixed it now by following the instructions in the first post! I just needed to populate the system variables (read environment) with:-




ImaginaryHuman(Posted 2010) [#55]
I just reinstalled Windows Vista and am having problems getting blitz to compile modules. I get:

Building Modules
Compiling:blitz_app.c
Build Error: failed to compile C:/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c
Process complete

I have set up MINGW enviro variables for c:\mingw; c:\mingw\bin and c:\mingw\bin\gcc ... no idea what those GCC ones are supposed to be in your shot above?

Also the link to the 5.1.3 version of MinGW at the top of this thread is browen and even though I downloaded what I thought was 5.1.3 from elsewhere it still isn't working, any ideas?

Also for me in the IDE about box it says the gcc stuff is `unavailable`, and yet I did copy the contents of that subdirectory into the bin directory, and copied the two files into the blitz bin folder.

I'm on blitzmax 1.40


ImaginaryHuman(Posted 2010) [#56]
The solution which just worked for me was to set up these environmental variables:

GCC_EXEC_PREFIX=C:\MinGW
MinGW=C:\MinGW
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\BlitzMax\bin;C:\MinGW\bin

as mentioned in an above post, and DO NOT add any other `extra` environmental variables in hopes that it'll help. I also copied the two files from MinGW to blitzmax's bin folder, and copied the libexec sub-sub-sub-folder into the MinGW/bin folder.


taumel(Posted 2010) [#57]
Just had the opportunity to use BlitzMax 1.4.1 on a PC with Windows 7 and this is how it worked here:

a) Downloaded 5.1.6 from http://sourceforge.net/projects/mingw/files/
b) Selected 'MinGW base tools' and 'g++ compiler' when asked which components to install and used the default location C:\MinGW.
c) Added the user variables GCC_EXEC_PREFIX and MinGW and set them to C:\MinGW, then added the entry ;C:\MinGW\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5 to the system variable Path at the end.

That's it.

Not sure if the GCC_EXEC_PREFIX is really needed but it didn't hurt as well...


Hummelpups(Posted 2010) [#58]
can someone fix the MinGW Downloadsource, please?


Jesse(Posted 2010) [#59]
take a look here:
http://www.blitzmax.com/Community/posts.php?topic=90964
or here:
http://www.blitzbasic.com/Community/posts.php?topic=90964


Winni(Posted 2012) [#60]
can someone fix the MinGW Downloadsource, please?

<- german :)


It's a bit late, but creating an environment variable "Lang" that is set to "en" would be your friend... :)


skidracer(Posted 2016) [#61]
Unpinned as out of date.