Installing MinGW.
BlitzMax Forums/BlitzMax Module Tweaks/Installing MinGW.
| ||
Here is 3 different ways to install MinGW and get it working with BlitzMax. Each has its own advantages and likelyhood of success. If you try one method and it fails, be sure to reinstall BlitzMax and fully uninstall MinGW, removing the link in the path and removing the MINGW variable, so that previous attempts will not interfere with future attempts. Method 1: Brucey's Method. This method was explained by Brucey here: http://www.blitzbasic.com/Community/posts.php?topic=95220 Advantage is that you get a later version of GCC which has fewer bugs and can compile more efficient code. Disadvantages are that you ned to copy the needed lib files and bin files over to the BlitzMax folder. If you miss any files, you can get link errors or even crashes during runtime. Step 1: Download and install BlitzMax. Step 2: Download and install TDM-GCC-32 ver 4.7.1 from here http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/ Step 3: Open System dialogue (Press Windows-Key + Pause), click on Advanced System Properties, Click on Environment Variables. Under System Variables, Double-Click on PATH. Make sure that the path leads to the MinGW bin directory. If you install using the default settings, that should be C:\MinGW32\bin. If it is not there, add ;C:\MinGW32\bin to the end of the string, remember the semi-colon. Replace C:\MinGW32\bin with wherever you installed MinGW. Click OK, then click New. Next to Variable Name, type MINGW. Next to Variable Value, type C:\MinGW, or wherever the path is to your install (should be the same as in the PATH, but without the \bin added to the end). Click OK, then OK, then Ok again, then close the System Dialogue Step 4: Open notepad, copy and paste the code below. Change the dirMinGW value to point to the root of your MinGW install (The same as you typed in the MINGW variable value). Change the dirBlitzmax string to point to your BlitzMax root. Save it as CopyLibs.bat (be sure that Save as Type is All Files so notepad will not append .txt to the end). Double-click on the CopyLibs.bat file to execute the script. @echo off @set dirMinGW=c:\mingw @set minGWVersionString=4.7.1 @set dirBlitzmax=c:\coding\BlitzMax copy %dirMinGW%\bin\ar.exe %dirBlitzmax%\bin /Y copy %dirMinGW%\bin\ld.exe %dirBlitzmax%\bin /Y for /f "delims=" %%i in ('dir %dirBlitzmax%\lib /b') do ( copy "%dirMinGW%\lib\%%i" "%dirBlitzmax%\lib\%%i" /z /y copy "%dirMinGW%\lib\gcc\mingw32\%minGWVersionString%\%%i" "%dirBlitzmax%\lib\%%i" /z /y Step 5: run MaxIDE and select Project\Rebuild all modules from the menu. Method 2: Old way. Advantages, Works without the need to run any scripts or copy any files. Disadvantages, Old version of GCC. Later versions of BlitzMax may fail to work with it. Step 1:Download and Install Blitzmax Step 2:Download MinGW from here http://www.tomtoad.com/BlitzMax/MinGW.7z Extract the archive to your C:\ drive. A folder called MinGW will be created. Open the Environment Variables dialogue as explained above. Under Path, add ;C:\MinGW to the end, and under MINGW add C:\MinGW as explained above. Step 3:Run MaxIDE and select Project/Rebuild all files Method 3: Open Source version Advantages, Works without the need to run any scripts or copy any files. Runs the latest version of BlitzMax, Works with most versions of MinGW, Ability to make changes to the core bcc as well as modules. Upgrades to MinGW are easier. Disadvantages, Takes a while to install first time. Several steps are needed. After first install, though, compiling and installing new versions are much easier. Step 1: Grab the latest version of BlitzMax from here: https://github.com/blitz-research/blitzmax go to the web page and click on Download ZIP to the right and just above the list of files. Extract the contents of the zip file to the folder of your choice. Step 2: Download TDM-GCC 32bit version 5.1.0 from http://tdm-gcc.tdragon.net/download and install. Alternatively, you can just extract the contents of blitzmax-master/_src/win32_x86/mingw_v5b.7z to C:\ Step 3: Alter your environment variables as described in Method 1 Step 4: Open a command shell (Press Windows-Key + R to open the run dialogue, type cmd, press enter). Navigate to the blitzmax-master source (cd %full-path-to-blitzmax-master%\_src\win32_x86). Type install and press Enter. Wait a long while, grab some coffee, eat some lunch. When compiling is done, take a look at the last few files compiled (scroll up if you need to) and make sure no errors are reported. Step 5: If no errors are reported, create a directory called BlitzMax, and copy over everything in the blitzmax-master directory except the _src directory. Double-Click MaxIDE. No need to Rebuild all Modules, but you can if you want to make sure everything went ok. I use to use method #2 as it uses the same MinGW version that vanilla BMax 1.50 was compiled with and gave me the least amount of problems. Most people prefer method #1 as it solves many of the bugs that #2 create. I now use #3. Installing new versions of MinGW is painless. Just uninstall the old MinGW, install the new MinGW, make sure Path and MINGW point to the new version, and you are done. |
| ||
10. If you get errors. Try copying the modified bmk.exe from the C:\MinGW folder to the BlitzMAX\bin folder and rebuild all modules again. There is an bmk.exe in MinGW? All in all I would suggest to use Bruceys modded bmk.exe - as it allows parallel build of some files, which speeds up the recompilation process a bit. @Copying over Shouldn't Brucey's guide do everything needed? - download and install that MinGW (should add to PATH already - if not, do as you suggested) - copy-paste-adjust the batch file content into a "copy.bat", execute "copy.bat" (copies files from MinGW to BlitzMax) - rebuild modules/documentation bye Ron |
| ||
There is an bmk.exe in MinGW? No, I included a bmk.exe with the .7z file. For some reason, bmk would delete the old .a file to prepare for creating the new one, but ar.exe would still see the file even after being deleted. This was causing bmk to abort the build. Theorized that due to my slower drive on my laptop, ar.exe was trying to create the archive before the drive cache was written. So I modified bmk a bit. I guess I was right as the modules now compile without problems. @Copying over Shouldn't Brucey's guide do everything needed? Even when following the guide, I still had problems. The MinGW I uploaded to the above link is the same one BlitzMAX was compiled with since v 1.44, From http://www.blitzbasic.com/Community/post.php?topic=95892&post=1107221 * Changed Win32 MinGW distro to nuwen.net - main mingw page is here: http:///nuwen.net/mingw.html Direct download is currently here: http://nuwen.net/files/mingw/mingw-7.2.exe This version includes gcc4.6, and is much easier to install. The 'pre built' BRL and Pub modules shipped with this update have already been built with this new version of MinGW, but you will probably need to rebuild any 3rd party modules you may have installed. Otherwise, you are likely to get weird linker errors. so no need to copy ar.exe and ld.exe and lib folder, so no need to make and execute the .bat file. Only need to copy my modified bmk if you get the can't create archive, file exists error I kept getting Now that I do have everything working, I might go ahead and try Brucey's method again. Right now I am updating my re-installed Win 8.1. When that is through, I'll give it a try. If successful, I'll update the OP. |
| ||
Ok, got the TDM-GCC from brucey's guide to work. Had to use my modified bmk to do it. |
| ||
Did you try the service-modification i quoted for you in the other thread...maybe that helps for win8 too. Bye Ron |
| ||
Just tried it. Am getting Access denied error. When I searched for AelookupSvc in the service app, there was nothing like it there. Seems your solutiin is Win7 only. |
| ||
I have to say I really dislike TomToad's 10 Step Guide to Misery. In this day and age Joe User shouldn't need to jump through so many hoops to start programming in their (potentially) favourite programming language. Can someone try this please? : http://brucey.net/programming/blitz/static/BlitzMax_150_mingw_510.7z (49MB) It is BlitzMax 1.50, with bundled TDM MinGW 5.1.0, BMK-NG, my updated pub.mod and brl.mod, and a tweaked MaxIDE (to check for BlitzMax/MinGW32 as a valid MinGW location) Steps for using : 1 - Unzip 2 - Double-click on MaxIDE That's it. There is no environment to configure. No paths to add. Everything should *just work*. I did a couple of test installs, and built some of the samples. They seemed to work as expected. I chose 7z because the zip was 92MB - so it's almost half the size. |
| ||
Nope, still gives me an error. Exact error unable to rename 'C:/BMalt/BlitzMax/mod/brl.mod/hook.mod/hook.debug.win32.x86.a'; reason: File exists thing is, I didn't have any problems with compiling mods in Windows 10 on this computer. My desktop has Windows 8.1 and no problems there. I guess it is just the combination of Win 8.1 and this laptop that is giving me issues. I modified the CreateArc() function in bmk_util.bmx and that seemed to work. Here is the modified CreateArc() function: As you can see, I just modified it to call ar.exe again if it fails, only aborting if it fails after the 5th try. |
| ||
Worked for me, but the behavior was a little strange. The editor came up and rebuilt docs, then I typed in a simple program ... Notify "Hello World." But the compile stopped because of a problem with maxlua.c. So I hit F5 again and it got to 55% before stopping. So I hit F5 again and then it finished and ran. Kinda weird, but at least it worked. |
| ||
Hmm, I decided to try something a little more ambitious. I pulled over my own module to see if it would compile. The error looks like this... Can't find link for : C:/BlitzNG/mod/meld.mod/manaobject.mod/manaobject.bmx The file is there - I swear!! :) EDIT: Yes, I changed the install directory so as not to interfere with my working copy of BlitzMax... |
| ||
Does it happen too, if you rename your existing BlitzMax dir? Maybe some path-clashes. Also brl.mod/blitz.mod (or whatever contained AppDir etc.) has some trouble with symlinks (which is then "built-in" when compiling bmk/bcc) so some situations work up a sweat for Mr. Compiler. But this is a bit unlikely here (Windows...) Instead of "waiting" an (temporary) option is to - rename file - delete renamed file Maybe the "rename" is instant. If renaming also fails, then there is some kind of "race" to the file (multiple things trying to get their hands on it). Another thing: do you happen to have some AV-Tools running (which might block things) - or shadowing services trying to backup all files for some kind of "time machine"-history? bye Ron |
| ||
Instead of "waiting" an (temporary) option is to - rename file - delete renamed file Nope, renaming the file first did not work. I'll try disabling my AV next. |
| ||
Well, it looks like the crappy antivirus software that was packaged with my computer was creating all my problems. Uninstalled it and reinstalled another one and all is fine. |
| ||
Maybe some path-clashes. Well, I changed the name to BlitzMax and stuck it in a temp folder (C:\Temp\BlitzMax) and it made no difference. Still can't find links...whatever that means. |
| ||
I did not talk about "C:\BlitzNG -> C:\Temp\BlitzMax" but about c:\YourOriginalBlitzMax -> c:\YourOriginalBlitzMax.bak c:\BlitzNG -> c:\YourOriginalBlitzMax If that works, your paths are overridden somehow (had issues with NG and some Android paths too - configured in .bashrc - which gets evaluated when opening up a terminal [a "command prompt"]]. When opening up bmk_make.bmx you find your error there: If processor.Platform() = "ios" Then link = TSourceFile(sources.ValueForKey(source.merge_path)) Else link = TSourceFile(sources.ValueForKey(source.arc_path)) End If If Not link Then Throw "Can't find link for : " + source.path End If So it outputs "source.path" which contains something different than "source.arc_path". Here is a portion of the compilation output when running a "bmk makemods" here: arc_path : /BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.release.linux.x86.a path: /BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.bmx -> "Can't find link..." means, it was not able to find the corresponding .a-file. In your case it looks for a file: C:/BlitzNG/mod/meld.mod/manaobject.mod/manaobject.release.win32.x86.a (or so, depending on what you build) Would you mind sharing your module ? Maybe NG stumbles over something and this leads (incorrect) to this error. bye Ron |
| ||
There is no environment to configure. No paths to add. Everything should *just work*. Going by this quote, I see no reason why there should be any issues with paths.So I just tried it in C:\BlitzMax, same as my original, working path...same result. And why would it be looking for .a? I'm building the mod. It's supposed to create the .a file... |
| ||
Maybe NG stumbles over something and this leads (incorrect) to this error Hmm, this does seem to be the case, since my other modules are building. However, the module in question is kind of the root of my six-year project, so I can't share it. I'll keep investigating, though.EDIT: I just copied over latest and it compiled. No idea what the difference was or why I was getting the wrong feedback. Sorry, I know that doesn't help. :( |
| ||
Okay, the mods are building now. I can only guess that the module had some other error in it that I didn't realize and that NG didn't recognize - so it just skipped onto the next step and failed - resulting in the wrong error message. I'm doing all of this from the console, by the way. The last step is to build my app, but I'm getting one (hopefully) last error: c:/BlitzMax/MinGW32/bin/ld.exe: cannot find -lunicows The lib folder is completely empty, so I tried copying libunicows.a there and a couple of other places with no luck. :/ EDIT: Might've helped if I'd known about the -v (verbose) argument. Perhaps that would've given me useful info. I will say that I'm happy to see that no arguments (using Bmk) results in a help readout. That's a VERY welcome addition. :) |
| ||
@ lunicows Maybe this Post helps (DL the files, copy it to your MinGW32-lib-dir). With BlitzMaxNG you do not use the BlitzMax/lib-folder anymore, you are now already providing them via "BlitzMax/MinGW32/...". LT: I see no reason why there should be any issues with paths. If you installed vanilla Blitzmax before, and installed a MinGW before, then MinGW might have modified your paths already. Now you unzipped BlitzMaxNG and chances were, that it tried to execute something from MinGW but the OS executed the wrong MinGW then... ... was just an assumption. bye Ron |
| ||
'Just saying that the build supposedly doesn't use the environment paths anymore (I think...?), so there shouldn't be a conflict. Anyway, it seems I was just getting the wrong error. I looked at several old posts regarding lunicows and tried copying the .a files to MinGW32/lib/ with no luck. Somehow, I don't think Brucey intended for people who try out his "painless" version to go searching for files. I appreciate the suggestions, though. I hope this can be resolved without too much trouble. EDIT: Tried compiling samples. Breakout works. Digesteroids seemingly breaks down when trying to load "menu.ogg." |
| ||
BlitzMaxNG/MinGW32/lib/gcc/x86_64-w64-mingw32/5.1.0/32/ Did you put it there? (Just suggesting, not able to test it now and only opened up Brucey's archive to have a look at the MinGW-structure) bye Ron |
| ||
Heh, I thought I had tried that, but I guess not!! It works now (though the audio issue still stands). Thanks, Derron! :) Funny thing is, I'm running on 32-bit, so that directory path had me wondering if 64-bit was a requirement. NOTES FOR BRUCEY: Build needs the two lunicows .a files. :) Still having trouble with audio (Digesteroids fails). |
| ||
audio with Digesteroids should be an Windows-issue, can remember to have it working here (Linux). @2 lunicows.a-files Only if you intend to build for 64bit :-) bye Ron |
| ||
Only if you intend to build for 64bit :-) Do you mean 32? That's what I'm running. |
| ||
You only need to copy it to that /32 dir to build 32bit variants... so 1 file copy needed. The second .a file (not to the /32 dir) is only needed if you want to build 64bit apps (on your 64bit Windows). Instead of writing "fun posts" now..glad it works for you. Let's wait what brucey says about the sound issue. Bye Ron |
| ||
Um, okay. When I looked, I found libunicows.a and liblibunicows.a - since I didn't know the difference, I copied them both. I understand that they're probably not both needed, though. Anyway, thanks again. I seem to remember something about sound in a different post, but I can't find it. |
| ||
@TomToad Thankyou. you solution worked for me on a new windows 10 install |
| ||
I really, REALLY want to try it, but this link is 404 :( |
| ||
I will keep that DL some days online: http://www.digidea.de/files/BlitzMax_150_mingw_510.7z Maybe Brucey removed it as it contains something buggy, so do not blame him if it does not work as expected. bye Ron |
| ||
Updated the OP. Now describe 3 different ways to install BlitzMax and MinGW, So hopefully one will work. |
| ||
TomToad: Disadvantages are that you ned to copy the needed lib files and bin files over to the BlitzMax folder. If you miss any files, you can get link errors or even crashes during runtime. -> compile Bruceys BMK from the sources available here (compile threaded for a speedup of the later compilations done with this BMK) -> copy "bmk[.exe]", "core.bmk" and "make.bmk" to your BlitzMax/bin Now you just need to drop your MinGW of choice in BlitzMax/MinGW32 and BMK will happily use this MinGW for compilation tasks. bye Ron |
| ||
Wooohooo, the MinGW posted in the first message solved my problems compilin FreeImage / Magick libs!! Thank you so much, TomToad! :) |
| ||
Well, I'm afraid I'm another victim of the Blitzmax build modules issues :) I'm currently trying to get TimelineFX up to date with all the latest versions of wxMax and other modules but running into similar issues as everyone else. Mac is all done and sorted, xcode simplifies things somewhat, but Windows is another story with its multitude of different mingw versions. The general scenario I'm faced with is either: wx compiles fine, but freeimage doesn't (tdm 5.1) or all modules compile ok but then timelinefx doesn't compile (tdm 4.7.1) - neither do the wx samples for that matter. With TDM 5.1 I get: C:/blitzMax-NG/MinGW32/x86_64-w64-mingw32/include/oleidl.h:737:1: error: expected initializer before '<' token __CRT_UUID_DECL(IOleCacheControl, 0x00000129, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) when building freeimage. If I manage to compile everything with 4.7.1 then the errors I get compiling tfx are a very long list, here's a snippet: I have a feeling if I can get Freeimage to compile with tdm5.1 then I might be ok. I actually tried the bmx-ng link above and also the one that you can download on bmx-ng.org but freeimage seems to fail with the same message there too. |