Going crazy with Brucey's module :(

BlitzMax Forums/Brucey's Modules/Going crazy with Brucey's module :(

SLotman(Posted 2016) [#1]
Guys... long time since I've used Blitzmax, and now that I'm trying to do something with it, I lost an entire day trying to make either bah.FreeImage or bah.Magick work.

I have downloaded tons of MinGW versions, even the one linked here as 4.7.2. But all sorts of errors cropped up. I also tried BMK(NG) to see if that would work... but no improvement either :(

I'm now on my last attempt, after wasting my whole day on this. with a working mingw version 4.8.1.

I did a fresh install of blitzmax (1.50). Copied to mod/bah.mod/ both freeimage and magick. copied libs from mingw folder into bmax's. same with ld.exe to bmax/bin. MinGW vars are set.

I can rebuild all modules, without any errors. I just get a "Bzip compiling as library" message - which I assume is normal.

The thing is, when I import either freeimage or magick into any project, I get tons of errors. Stuff like these:


The code that gave all those errors? This:
Framework BRL.GLMax2D
Import BRL.EventQueue
Import brl.retro
Import pub.freeprocess
Import bah.magick
Import maxgui.drivers


Graphics 800,600,0
While Not (KeyHit(KEY_ESCAPE))
	Cls
	DrawText "Hi!",10,10
	Flip
Wend


Does anyone have a shred of hope for me? Something I could try to make this work? I'm really tired, and I can't even think straight anymore :(


TomToad(Posted 2016) [#2]
Maybe missing some dependencies?


SLotman(Posted 2016) [#3]
If I remove bah.magick from the test code, it compiles and run... I don't think its a dependency problem :(

Unless you meant another type of dependency? Somewhere else?


TomToad(Posted 2016) [#4]
I mean, maybe bah.magick depends on another module to exist. Something you are leaving out of your framework.


TomToad(Posted 2016) [#5]
I see the functions exists in .dlls included with irrklang.mod and gme.mod. Maybe you need one of those.


grable(Posted 2016) [#6]
It might have something to do with the version of MINGW you installed.
Specifically what type of exception handling it does, there are 2 versions:
DW2 and SJLJ.
And code compiled with one is not compatible with code compiled with the other.

The version supported by bmx is SJLJ as far as i know?
In any case, the most common one to use is SJLJ, so most dlls and archives are usually compiled with that.


SLotman(Posted 2016) [#7]
Just tried this version: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.1/threads-posix/sjlj/

Since It was complaining about SJLJ stuff... but it is the same - actually even a little bit worse, since it didn't compile maxgui correctly :(

Just tried now going back to blitzmax 1.48... still no luck :(


grable(Posted 2016) [#8]
Thats too bad. Ive been running every version of GCC since 4.7 successfully so it can be done ;)
But i must admit i have never bothered to try the official mingw binaries.

The distribution i use is TDM-GCC which has served me well over the years, though its recent incarnations requires modifying BMK to work.

And that version you linked seem to be mingw-64? Which is probably set for 64-bit builds by default, requiring various switches to gcc,ld and others to compile 32-bit.
But i may be wrong on this, as im not familiar with the official mingw releases...


SLotman(Posted 2016) [#9]
I've tried TDM-GCC too... that link I posted was just one of hundreds I've tried already :(


grable(Posted 2016) [#10]
So you you have a working MINGW for the most part, but Bruceys modules wont compile? Or are you using precompiled versions of his mods?

I can see how that would make you crazy ;)

Maybe its time to try out Bruceys complete package. You can get it here http://www.blitzmax.com/Community/post.php?topic=105745&post=1293199


SLotman(Posted 2016) [#11]
YEEEESSSS!!!

Found a MingW inside a DevCPP installation that works!

Here is the link:
http://sourceforge.net/projects/orwelldevcpp/files/Setup%20Releases/Dev-Cpp%205.5.3%20MinGW%204.7.2%20Setup.exe/download

I downloaded the setup, opened the installer on 7zip and extracted MingW folder from inside it. Now I could build everything and "import bah.magick" doesn't throw a ton of link errors! :)

Phew, I was losing faith on myself for a moment there :P

Edit: False alarm :(
It does compile, but MaxGUI seems broken :/


SLotman(Posted 2016) [#12]
Hmmm, didn't know about this complete package... will try it out :)
Thanks grable :)


Noooo... posted 2 days ago and link is broken :(


grable(Posted 2016) [#13]
Glad it finally worked for ya :D

Yeah, too bad about the complete package. It would help a lot of people having trouble with mingw.


SLotman(Posted 2016) [#14]
I'm still having issues... apparently maxgui isn't working properly :(


grable(Posted 2016) [#15]
And you did a FULL recompile? To make sure run bmk from a terminal.
bmk makemods -a
Or for maxgui only:
bmk makemods -a maxgui.drivers



SLotman(Posted 2016) [#16]
Yeah. But there is something wrong with it now - I have a bunch of buttons created as BUTTON_PUSH|BUTTON_RADIO and when I click *any* of them, the program freezes.
(And it wasn't happening before... so pretty much something broke)

Edit: creating them just as BUTTON_PUSH works. When I add BUTTON_RADIO it freezes, doesn't even get to GadgetAction()


grable(Posted 2016) [#17]
Im assuming you also copied over the required lib and bin files as well...
Othet than that it would seem that MaxGUI has ended up in an invalid state somehow.
I would re-check the mingw files.
Perhaps even delete the .bmx dir + .a and .i files in maxgui.* and recompile the mod just to be sure.

If that still doesnt work, you could try redownloading the maxgui release. If i remember correctly, it should include precompiled binaries.


SLotman(Posted 2016) [#18]
Yes! :)

Downloaded MAxGUI from Sourceforge - didn't even recompile it, and it seems to be working :)

Yay, now I can go to sleep a little ^_^

Thanks for the help, grable :)


grable(Posted 2016) [#19]
Happy to help :)


Henri(Posted 2016) [#20]
Hi,

just for the sake of posting, here are the steps that I went through when getting everything going and using Brucey's enhanced BMK (not BlitzMax NG, just BMK) to speed up the build / compile process:


Instructions to use Bruceys modules and enhanced version of Blitzmax maketool bmk.

1. Install Blitzmax 1.50 to C:\Blitzmax

2. Install TDM MinGW 64bit 5.1.0 found in http://tdm-gcc.tdragon.net/download to C:\Blitzmax\MinGW32

* NOTE: You may need to delete all the .dll.a files in MinGW32 folder so that BMK is using static libraries for building instead of dynamic link libraries. Otherwise errors like 'libstdc++ not found' can occur when moving your app .exe to different computer.

3. Download enhanced bmk from https://github.com/bmx-ng/bmk . Follow the instructions provided there on how to deploy.

4. Download patched pub & brl mods from https://github.com/maxmods and replace the originals in C:\Blitzmax\mod

5. From MaxIDE select menu "Program/Rebuild All Modules". To test that everything is running fine, select a sample from MaxIDE's right panel "Projects/Samples" and run it.

* NOTE: Bmk NG is using the libraries and bin utils(ar.exe & ld.exe) in C:\Blitzmax\MinGW32-folder so the ones in Blitzmax folder are not needed (those can be deleted/relocated to test this)

*NOTE 2: If you get compile error concerning MaxGUI see this post

6. Download Brucey's modules from https://github.com/maxmods and copy them in C:\Blitzmax\mod folder (remember to remove the -master suffix as every module should end in .mod). Probably best to copy only those that are needed for simplicitys sake.

* NOTE: Modules can be copied one at the time and then do step 7. Save wxMax for (if needed) last because it's huge and takes longest time to compile.

* NOTE 2: If you get compile error concerning wx.rarinputstream then add this line..
#include <stdint.h>
..in wxrarinputstream.mod\src\unrar\crc.hpp file.

7. From MaxIDE select menu "Program/Build Modules". No need to do a complite rebuilding at this point.

8. Finally select menu "Program/Rebuild Documentation"


OK. Now everything should be good to go :-)



-Henri


xlsior(Posted 2016) [#21]
Downloaded MAxGUI from Sourceforge - didn't even recompile it, and it seems to be working :)


The problem is "seems to be" -- you -may- have gotten lucky, but mixing certain MinGW versions in a single program can still lead to mystery crashes from time to time or in certain situations. :-?


SLotman(Posted 2016) [#22]
Damn. Still no go here. Everything builds and compiles, but if I try to run *any* Magick example, I get an access violation :(


xlsior(Posted 2016) [#23]
Damn. Still no go here. Everything builds and compiles, but if I try to run *any* Magick example, I get an access violation :(


I've run into the same issue -- IIRC it worked OK when it (and the rest of Blitzmax) were compiled with TDM MinGW 4.7.1, but hasn't compiled for me in any newer MinGW


SLotman(Posted 2016) [#24]
@Henri: thanks - I tried that... still after rebuilding all modules, I go back to the errors in the first post when using bah.Magick.


Henri(Posted 2016) [#25]
OK, I will try it out when I get home and I'll report.

Just to make sure could you do a clean install of Blitzmax to a tmp folder like C:\tmpBlitzmax and then proceed with instructions (just replace C:\Blitzmax with C:\tmpBlitzmax ).

-Henri


SLotman(Posted 2016) [#26]
I am working on a clean install... :/


Henri(Posted 2016) [#27]
One other question: When you are building modules, do you see percentage of completion in MaxIDE debug window ?

-Henri


TomToad(Posted 2016) [#28]
I do remember that a couple of Brucey's modules require that you use his modified bmk.exe. I don't remember if magick was one of them, but you might try downloading and installing it.

Also, you might want to try building BlitzMax from the source on Github. The latest version is 1.52. One of the advantages 1.52 has over 1.50 is that it links to the MinGW lib folder instead of the BlitzMax folder, so you are less likely to have problems with different versions conflicting.


markcw(Posted 2016) [#29]
Not sure if I should chime in here but I never got bah.magick to compile, so I think it's broken. Bah.freeimage works though.


SLotman(Posted 2016) [#30]
One other question: When you are building modules, do you see percentage of completion in MaxIDE debug window

When I try with Brucey BMK, yes. I've been trying with it and without it, no success with either :(


SLotman(Posted 2016) [#31]
Now trying with original BMK, plus this environment variable: BMK_LD_OPTS = -lmsvcrt -lgcc (didn't had it before) and MinGW 4.7.0 from here: http://sourceforge.net/projects/orwelldevcpp/files/Setup%20Releases/Dev-Cpp%205.3.0.4%20MinGW%204.7.0%20Setup.exe/download

Praying to God/Allah/Devil/Buda and anyone else this finally works. I'm so desperate I started to consider doing everything in JAVA :P

Edit: Not yet. Same errors as first post :(

Now trying with MinGW from TomToad post here: http://www.blitzmax.com/Community/posts.php?topic=105745


SLotman(Posted 2016) [#32]
I think it is working now!!!! I was able to run Magick example! :)

Definitively working now :)
Thanks everyone for your suggestions and insights, I couldn't make it without your help :)


Kryzon(Posted 2016) [#33]
The link to TomToad's guide on MinGW is actually in the 'blitzbasic' domain:
http://www.blitzbasic.com/Community/posts.php?topic=105745

It seems there's no "BlitzMax Module Tweaks" forum in the 'blitzmax' domain, or perhaps you need to be logged in to see it.


TomToad(Posted 2016) [#34]
@kryzon
Yes, you can see it if you are logged on. They are both the same site, but generate 2 different cookies which is why you can log onto one, but not access the other.