wxMax Woes

BlitzMax Forums/Brucey's Modules/wxMax Woes

Chalky(Posted 2016) [#1]
Several years ago I had great trouble trying to get wxMax to install/build/work on my old WinXP system. Unfortunately, that PC (on which I eventually got it working) has now died, and the backup drive is no longer available.

Thinking I could avoid all the building issues I encountered last time, I decided to take the easy route by downloading/installing the pre-compiled "bin" version - after the SetupAndInstallation.wiki claimed that all I had to do was:
Download the appropriate bin release .rar and extract it somewhere. You should see a wx.mod folder which contains the entirety of wxMax. This needs to be
moved into your BlitzMax/mod folder.

That's it. You can now start using wxMax !
Unfortunately, every sample I later tried to compile failed with sjlj errors. Ok - so the pre-compiled version was made using a different MinGW installation - but which one? With no way of telling, I then spent the next (last) 3 days trying to get the source version of wxMax to install/compile/work on my Win7 Pro box. After several failed attempts, I have now removed MinGW and BlitzMax and done a clean install of both (wxWidgets, MinGW 4.7.1 - how do I know if I have the sjlj version? - and BlitzMax 1.50). I then copied the libs from MinGW to Blitmax/libs, copied ar.exe and ld.exe into BlitzMax/bin, set up the appropriate env variables, installed wxMax from GitHub and attempted to build all modules.

Unfortunately 2 of the wx.mod modules fail every time as follows:

wxflatnotebook.mod because of "Expected expression but encountered '{'" errors due to "{" appearing on the following function definitions:
Function _create:wxFlatNotebook(wxObjectPtr:Byte Ptr) { nomangle }
Function _xrcNew:wxFlatNotebook(wxObjectPtr:Byte Ptr) { nomangle }
Function _getbitmap:Byte Ptr(list:wxBitmap[], index:Int) { nomangle }
Function _newbitmaparray:wxBitmap[](size:Int) { nomangle } { nomangle }
Function _setbitmap(list:wxBitmap[], index:Int, bitmap:Byte Ptr) { nomangle }
and wxrarinputstream.mod because of:
C:/Applications/BlitzMax/mod/wx.mod/wxrarinputstream.mod/src/unrar/crc.cpp: In function 'uint CRC(uint, const void*, uint)'
C:/Applications/BlitzMax/mod/wx.mod/wxrarinputstream.mod/src/unrar/crc.cpp:23:22: error: 'uintptr_t' was not declared in this scope
C:/Applications/BlitzMax/mod/wx.mod/wxrarinputstream.mod/src/unrar/crc.cpp:23:32: error: expected ')' before 'Data'
C:/Applications/BlitzMax/mod/wx.mod/wxrarinputstream.mod/src/unrar/crc.cpp:29:3: error: expected ')' before 'while'
Build Error: failed to compile C:/Applications/BlitzMax/mod/wx.mod/wxrarinputstream.mod/src/unrar/crc.cpp
Why do these fail with basic errors - has anyone else successfully rebuilt the current GitHub version of wxMax?

Not knowing how to fix them, I removed both modules from wx.mod and everything else built without errors. However, whenever I try and compile a wxMax example, it STILL fails with multiple sjlj errors - just like it did initially on my old XP system. Unfortunately I cannot remember how I got it working then - and I am growing increasingly frustrated at how difficult what should be a simple process is turning into.

Despite searching these forums, I have been unable to find a definitive process for installing and compiling wxMax. For example, what is the required MinGW version/type - and, more importantly (as I clearly have the wrong one) where do I get it from? How can I tell whether I need to copy the ar.exe and ld.exe files (I tried using MinGW 5.1.3 at one point - but after copying them got a "ld.exe has stopped working" error whenever I tried to compile anything)?

I realise this has been requested many times before, but if anyone can give me clear instructions (and download locations if applicable) on what I need to do to get the most recent version of wxMax working with BlitzMax 1.50 I would be very grateful.


Henri(Posted 2016) [#2]
Hi Chalky,

I believe I have done this. I'll report once I've tested it.

-Henri


Derron(Posted 2016) [#3]
There is DW2 and SJLJ debug - when downloading, you should check which one is used.

Brucey used TDM MinGW:
http://tdm-gcc.tdragon.net/index.php/


TDM32 exception unwinder formats (SJLJ vs DW2)

The TDM32 edition of TDM-GCC comes in two different flavors with respect to how it propagates exceptions in compiled programs.

The default flavor uses a method called "SJLJ", which stands for "setjmp/longjmp".




Once you installed a custom MinGW you need to recompile all modules (also brl.mod and pub.mod) as you might else run into trouble.

Instead of copying all the mingwlibs to BlitzMax\libs you better install Bruceys BMK (the NG-one is compatible to vanilla):
https://github.com/bmx-ng/bmk

download, compile and copy all the files as stated in the instruction (bmk[.exe] and some .bmk files).

this BMK variant will automatically use the MinGW-libs, so the BlitzMax\lib-folder is no longer used ("could" be deleted then). You could even store your MinGW installation within BlitzMax (BlitzMax\MinGW32) and BMK uses this - regardless of a potentially co-existing other installation of MinGW.

If you then have a "compatible MinGW", the modules should compile and the examples should then run.


bye
Ron


Henri(Posted 2016) [#4]
Okey, the results are in (tested in vanilla Blitzmax).

I had some trouble running wxFlatnotebook example, perhaps Brucey has made some changes to it. There is a double definition {no mangle} {no mangle} in one line. I simply deleted the other in order to build modules.

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.x found in http://tdm-gcc.tdragon.net/download to C:\Blitzmax\MinGW32 (on installing select option with both 32 & 64 bit toolchains)

* 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


Chalky(Posted 2016) [#5]
@Henri: Wow - very comprehensive instructions - thank you. I will have a go at a trial install on my Win8.1 laptop and see how I get on.