wxMax for wxWidgets 3.0.0

BlitzMax Forums/Brucey's Modules/wxMax for wxWidgets 3.0.0

Brucey(Posted 2013) [#1]
Hallo,

I'll be working on migrating wxMax to the new major release of wxWidgets 3.0.0 this weekend. So I would advise you to stay clear of updating from the repository until I've worked through all three platforms.

Currently none of the sample apps are displaying anything (like an application window, for example), so it looks like something groovy has changed way down in the nether regions…


Hope everyone else is having a nice weekend ;-)


Kryzon(Posted 2013) [#2]
Have a very productive weekend.


Pete Rigz(Posted 2013) [#3]
Excellent news Brucey, shall give it a good whirl when it's ready :)


Brucey(Posted 2013) [#4]
I will probably drop wxGLMax2D module too, which may require some code-tweaks for people.

Well, I figured out how to do it "properly", so that you can simply use GLMax2D with a wxGLCanvas, without having a second implementation of a Max2D - much in the same way that the MaxGUI canvas's work (i.e. not requiring themselves to have any other references to Max2D stuff).

I've been using it for my own stuff, and it works as it should.


On a brighter note, I've got around my no-window problem on OS X - although I've had to comment out a line from one of the wxWidgets files. Which is a bit of a concern, as said line worked previously in all the other builds. But hey, if that's what it takes, I guess I need to do it.
Not overly keen on hacking wxWidgets, but I also modded its zlib and jpeg libs to change the prefixes - which just makes it easier to integrate with all of our other mods (like brl.zlib, bah.freeimage, etc)


Derron(Posted 2013) [#5]
Keep informing us about "handling approaching problems". Always nice to read how the miraculous Brucey does his magic.


bye
Ron


Brucey(Posted 2013) [#6]
Nothing "miraculous" about spending 4 hours debugging someone else's library :-p


Brucey(Posted 2013) [#7]
OS X and Win32 builds are now up in SVN.

Win32 is built against "gcc (tdm-1) 4.7.1"

OS X is built against "i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1"

I've only tested some of the samples, but they are working as expected. Obviously "real" programs may prove otherwise.


Pete Rigz(Posted 2013) [#8]
Tried Windows version and getting a lot of "duplicate section" errors (just trying Hello World sample):



My mingw is the same version as you. All the modules built ok, I did a full bmk makemods -a.


LT(Posted 2013) [#9]
Decided to check this out..holy shiznit! That's a lot of modules! Hardly know where to begin!

Brucey, do you think it's possible to use the html widget in the manner I was talking about in the other thread? I mean to turn the html render into a texture?


Pete Rigz(Posted 2013) [#10]
I Remembered I modified some of the glue files so they wouldn't have been updated. Did a completely fresh checkout and it's fine now, is complaining about freeimage though, but I was running an older version of that to overcome the duplicate definitions, which it's throwing now.

Updating now so will see :)


Pete Rigz(Posted 2013) [#11]
so now I'm getting

C:/BlitzMax148/mod/wx.mod/wx.mod/../lib/win32/libwxjpeg.a(wxjpeg_jdmarker.o):jdmarker.c:(.text+0x1d98): multiple definition of `jinit_marker_reader'
C:/BlitzMax148/mod/wx.mod/wx.mod/../lib/win32/libwxjpeg.a(wxjpeg_jerror.o):jerror.c:(.rdata+0x1260): multiple definition of `jpeg_std_message_table'
C:/BlitzMax148/mod/bah.mod/freeimage.mod/freeimage.release.win32.x86.a(jerror.c.release.win32.x86.o):jerror.c:(.rdata+0x12e0): first defined here
C:/BlitzMax148/mod/wx.mod/wx.mod/../lib/win32/libwxzlib.a(wxzlib_zutil.o):zutil.c:(.rdata+0x80): multiple definition of `z_errmsg'
C:/BlitzMax148/mod/pub.mod/zlib.mod/zlib.release.win32.x86.a(zutil.c.release.win32.x86.o):zutil.c:(.rdata+0x7c): first defined here
Build Error: Failed to link E:/timelinefx-editor/TPEditor.exe


Which I'm guessing is clashes with other mods as you mentioned earlier. I'm using freeimage and gman.zipengine which im guessing is the reason behind these errors.


LT(Posted 2013) [#12]
I grabbed the whole thing and clicked "Build Modules" in Blide. I'm getting a "Can't find interface for.." error on every module except wx. I'm clearly missing some step.. :/


Pete Rigz(Posted 2013) [#13]
What version of MinGW do you have?

And what is wx.mod location? It should be mods/wx.mod

Can try building from a command line too - bmk makemods -a wx

A threaded build might throw an error like that too...


Brucey(Posted 2013) [#14]
Linux build is now in SVN.

Linux binaries were built against "gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)"


LT(Posted 2013) [#15]
Ah, forgot to check. It's 4.6.1 - guess that must be it.


Brucey(Posted 2013) [#16]

multiple definition of `jinit_marker_reader'
multiple definition of `jpeg_std_message_table'


Ah, you mentioned those in another post if I recall.
Well, it's early days yet, I can see about fixing that in the wx build.


Told you there'd be a few teething problems.
I've used different prefixes for libpng, zlib and libpeg, on the assumption that we can then have multiple copies of those loaded. It's almost there.
z_errmsg is probably another one.

Are the samples working for you, generally? (which at least means I've got most of the stuff right)


Brucey(Posted 2013) [#17]
I'm getting a "Can't find interface for.." error on every module except wx.

Do you have the latest Blide? I know there was an issue with earlier versions where it didn't always build things in the correct/required order.

do you think it's possible to use the html widget in the manner I was talking about in the other thread?

I'm not sure. There is a wxWebView which uses WebKit on Linux/OS X and IE on Windows. Not sure if you can grab the rendered page from it.


LT(Posted 2013) [#18]
Do you have the latest Blide? I know there was an issue with earlier versions where it didn't always build things in the correct/required order.


I have an older version, so that must be it. Seems to be working from the command line.

There is a wxWebView which uses WebKit on Linux/OS X and IE on Windows.


Ah, okay. Since it is IE, I'll probably want to look into Chromium anyway - if only I could get the examples to compile in anything other than my expiring copy of Visual Studio. Don't really want to shell out $500 just so I can compile the thing. :(


Pete Rigz(Posted 2013) [#19]
Told you there'd be a few teething problems.


It's all good, I'm happy to be a ginnie pig :)

I just ran every sample and all run with just a few (what appear to be minor) issues:

bitmapcombo - looks a bit odd to me, but I think it's been like that a while.
Mainloop - throws a wxwidgets debug error when you close the window
mdi - the child windows don't seem to resize properly
menu - debug alert when exiting
propgrid - debug alert when you run the sample, but does run none-the-less
shutdown - throws error on exiting (after waiting for the timer to run down, is fine when you just exit)
webview - throws a build error: 'wxEVT_COMMAND_WEB_VIEW_NAVIGATING' not found
googletranslate - hello world = null
html/widget/widget - throws a debug alert when you exit
pdfdocument - all throwing the duplicate identifier errors but you obviously know about that one

Pretty good going really :-)


LT(Posted 2013) [#20]
Hmm, the modules compiled with no errors, but when I try to compile any of the samples (Windows), I just get a long list of...

C:/Program Files/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxmsw30u_xrc.a(xrclib_xh_frame.o):xh_frame.cpp:(.text+0x20): undefined reference to `__gxx_personality_sj0'

Guess I'm still doing something wrong. :(


Brucey(Posted 2013) [#21]
It's your version of MinGW.

I've built the libs against TDM (http://tdm-gcc.tdragon.net) which happens to use something called SJLJ exception handling.
The MinGW from the MinGW website uses a different kind of exception handling.
I intend (at some point in the future) to do a build of the libs with the other MinGW too - allowing those who want to use a different MinGW the opportunity to do so.


xlsior(Posted 2013) [#22]
I intend (at some point in the future) to do a build of the libs with the other MinGW too - allowing those who want to use a different MinGW the opportunity to do so.


Hi Brucey,

What release of MinGW are you using now?

I have the TDM-1 (GCC 4.7.1), but your SVN of the Raknet modules still won't compile with that version -- appears to have a bunch of missing declarations?


LT(Posted 2013) [#23]
I upgraded to MinGW 4.8.1 and am still getting those messages..

EDIT: I realized that you meant to get TDM, so I followed the instructions in your post about that. Rebuilding modules resulted in an error in FreeType. Compiling my own program resulted in a different error...

g++: error: unrecognized command line option '--stack=4194304'

I'm at a complete loss. :(

These are the steps I thought I was supposed to follow:

1. Get TDM and install the same way I would MinGW - to C:\MinGW
2. Set the environment variable and add to PATH. This was already done.
3. Get Brucey's .rar and drop the files to BlitzMax's lib and bin folders. I had not thought this necessary because changes were rolled into the official BMK, but I tried it with and without. Or perhaps I have the wrong version? I got the .rar here...

http://www.blitzbasic.com/Community/posts.php?topic=95220

4. Rebuild all mods - did this from the command line with...
bmk makemods -a << This resulted in build errors.

NOTE: I didn't install BlitzMax from scratch, but I can't imagine why that would be necessary. I don't change stuff outside of the .mod folder, and the -a command line option rebuilds EVERYTHING, no?


xlsior(Posted 2013) [#24]
3. Get Brucey's .rar and drop the files to BlitzMax's lib and bin folders. I had not thought this necessary because changes were rolled into the official BMK, but I tried it with and without. Or perhaps I have the wrong version? I got the .rar here...


Looks like that .rar contains 4.5.2, which woudln't work together with the 4.8.1. MinGW download.

Basically what you need to do is copy ar.exe and ld.exe from mingw/bin to blitzmax/bin,

you also need to overwrite any existing file in blitzmax\lib with the equivalent file from c:\mingw\lib , as well as copy any file from c:\MinGW\lib\gcc\mingw32\<x.x.x> to blitzmax\lib

here's a .bat file that can do it for you -- make sure to update the paths referenced to match the ones on your system:

(you may need to adjust the version number in the mingw\4.7.1 folder line as well)

@echo off
copy c:\mingw\bin\ar.exe c:\code\blitzmax\bin /Y
copy c:\mingw\bin\ld.exe c:\code\blitzmax\bin /Y
dir c:\code\blitzmax\lib /b | awk "{print \"copy \\\"c:\\mingw\\lib\\\\\"$0 \"\\\" c:\\code\\blitzmax\\lib\"}" > copylibs.bat
dir c:\code\blitzmax\lib /b | awk "{print \"copy \\\"c:\\mingw\\lib\\gcc\\mingw32\\4.7.1\\\\\"$0 \"\\\" c:\\code\\blitzmax\\lib\"}" >> copylibs.bat
call copylibs.bat



Derron(Posted 2013) [#25]
Like mentioned in the old thread:
http://www.blitzmax.com/Community/posts.php?topic=100077

alternative to xlsior's script:
@echo off
@set dirMinGW=c:\mingw
@set minGWVersionString=4.4.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
)


Removes the usage of "awk" (3rd party tool). Just adjust the VersionString according to your version.


bye
Ron


LT(Posted 2013) [#26]
I was just about to say I'm not familiar with awk, but I do appreciate the help! :)

I copied all of the files over, but unfortunately have been unable to get some of the modules (e.g. theoraplayer) to link using 4.8.1. They seem to compile, but then throw up errors when I try to use them.

When I go back to 4.6.1, they work - but clearly, that is not a good long term solution and I would like to play with the wxMax stuff. :/


xlsior(Posted 2013) [#27]
Note that you'll need to recompile -all- modules any time you switch out a MinGW version, including the brl.* and pub.* modules -- mixing and matching versions doesn't work right.


LT(Posted 2013) [#28]
Yeah, I did that. Theoraplayer (and maybe Zeke's Luajit2) don't link properly for me using 4.8.1, but maybe there's some other thing I've missed.


Brucey(Posted 2013) [#29]
Theoraplayer … don't link properly for me using 4.8.1

I'll look into that.


LT(Posted 2013) [#30]
Wait!! There may be no need. I discovered that I had forgotten to replace regular MinGW 4.8.1 with TDM 4.8.1..


LT(Posted 2013) [#31]
Changing over to TDM 4.8.1 caused new link errors to occur with my Bullet module. No problem - I thought - I'll just recompile the Bullet libs using TDM 4.8.1 - only I can't because it now spits out segmentation errors... :(

Ugh, now I remember why I use BlitzMax and avoid C++ and the compiler issues that come along...

At this moment, I don't know whether there is an issue with Theora and 4.8.1 or not...


Brucey(Posted 2013) [#32]
Well, you shouldn't get segmentation errors when building, usually.
You are building bullet from source? (rather than including some pre-built library)


LT(Posted 2013) [#33]
Yeah, have to. Bullet is C++ and hooking it up to Blitz, afaik, can only be done with the C-API. Bullet's C-API is extremely sparse, so I had to add a bunch of stuff to it, hence having to recompile from source.


Brucey(Posted 2013) [#34]
Bullet's C-API is extremely sparse

Yeah, I was just having a look at it and was thinking the same.


Brucey(Posted 2013) [#35]
I've been tweaking the wxMax libs, so they now have the jinit_marker_reader/jpeg_std_message_table prefix applied to them (all platforms).
The pdfdocument example is now running properly on all three platforms (ignoring the debug that barfs out of the Linux and OS X versions).

Talking of debug, the Linux/OS X builds of the libraries are currently compiled with debug enabled. It's reasonably useful for testing, as the libraries can produce logging from time to time, but I'm considering disabling it before release because the amount of debug can be overwhelming at times, and perhaps isn't useful for end-users - unless anyone prefers it as it is.


UNZ(Posted 2013) [#36]
Good job so far Brucey!

Only problem I have is the error Pete mentioned above with 'z_errmsg':
F:/Spiele/Proggen/BlitzMax/mod/wx.mod/wx.mod/../lib/win32/libwxzlib.a(wxzlib_zutil.o):zutil.c:(.rdata+0x80): multiple definition of `z_errmsg'
F:/Spiele/Proggen/BlitzMax/mod/pub.mod/zlib.mod/zlib.debug.win32.x86.a(zutil.c.debug.win32.x86.o):zutil.c:(.rdata+0x80): first defined here

This error occurs on windows and linux.
The samples work though.


BTW:
I would like a wxWizard sample because... I don't get it otherwise x)

Does this new release of wxMax need any new libs? (eg. for gtk3 ?)
Any difference in the libwebkitgtk thing?


LT(Posted 2013) [#37]
Eh, even without Bullet, I'm getting errors that look like this..

C:/BlitzMax/lib/libstdc++.a(eh_alloc.o):eh_alloc.cc:(.text+0x97): undefined reference to `pthread_mutex_lock'

I think I've run out of ideas to try.


LT(Posted 2013) [#38]
Ah, just read your reply on the other thread. Guess I'll backtrack and wait for the official MinGW version then. Do I still have to copy ar.exe and ld.exe and others to Blitz or is that just for TDM?

I was going to try installing TDM 4.7.1, but the installer won't let me now that there is a later version! Why on earth would they even put it in the archive!?

EDIT: I *think* I've confirmed that Zeke's LuaJit2 module and TheoraPlayer don't work under regular MinGW 4.8.1. Also, my Bullet lib won't compile. Going back to 4.6.1, which is bad news. :(


Brucey(Posted 2013) [#39]
Only problem I have is the error Pete mentioned above with 'z_errmsg'

That should be gone with the latest build.

Some useful information is available in the file wx.mod/wxWidgets_BuildNotes.txt, which documents build settings and any changes I've made to the official wxWidgets source. (like to get it to work on OS X, and mods to function prefixes)


Brucey(Posted 2013) [#40]
TheoraPlayer don't work under regular MinGW 4.8.1


I had to make modifications to bmk to get theoraplayer to build/link in with TDM 4.8.1.

The latest MinGW introduces "native" pthread support via an extra static library, which must be linked in the correct order. So it looks like this will be a requirement for newer versions of MinGW from now on.


Brucey(Posted 2013) [#41]
You can find TDM 4.7.1 here : http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/

Which you may have more luck with.

It seems there are a few issues with MinGW 4.8.1, which will need to be ironed out first (through mod and bmk tweaks) before we can commit to using that for everything. Yay...


LT(Posted 2013) [#42]
I saw something about pthreads - no idea what those are. Good to know I'm not just crazy, though. ;)

Thanks, that was the installer I tried and it works fine now - think maybe I should get more sleep..good for the brain. Will 4.7.1 work with WxMax or does that require TDM?


Brucey(Posted 2013) [#43]
You need an sjlj-built MinGW to work with the current build of wxMax - unless you want to build the libs with a non-sjlj build ;-)

TDM defaults to sjlj, which is on that page I posted above.


UNZ(Posted 2013) [#44]
The 'z_errmsg' is gone.

But I get warnings on windows because of some (not all) PNG-files I load via myArtProvider:
iCCP: known incorrect sRGB profile

Can I surpress this warning? My PNGs are quite correct I think. How should I save an image to avoid such a warning?


LT(Posted 2013) [#45]
...which is on that page I posted above


/rubs eyes - So it is! Okay, everything seems to be working using TDM 4.7.1 - except for my Bullet lib, but that's my problem.


Pete Rigz(Posted 2013) [#46]
TimelineFX is compiling and running fine on Windows, good job Brucey :-) will give Mac a whirl in due course.

I was getting the profile errors too as highlighted here: http://trac.wxwidgets.org/ticket/15331

At the moment I'm just suppressing them with wxLog.SetLogLevel(0) but I might test re-saving in photoshop with the sRGB profile checked (or not) see if that works.


Brucey(Posted 2013) [#47]
 iCCP: known incorrect sRGB profile


From what I've been reading on the internet, the recent libpng (1.6.x) has more strict enforcement of profiles, and it seems that the old HP sRGB profile has a bad whitepoint, which appears in many png images. By using sRGB built-in instead, will remove the warning message.
Probably better to update your images to have a correct profile than to hide the warnings ;-)


Pete Rigz(Posted 2013) [#48]
Running ok on Mac but there is an issue with toolbars, in that that don't display horizontally. It was doing this before in 2.9.5 but I waited to see if 3.0 would rectify it but unfortunately not. I adapted the webview sample to replicate. It makes the room for it, but the icons don't appear:



I can make it work by applying it with CreateToolBar but the icon size is too big, setting it smaller doesn't seem to make any difference. Windows works fine.

[edit]oo, incidentally I had to rem out the connectors because it wasn't recognising any of those EVT constants


LT(Posted 2013) [#49]
Went through some of the samples, but webview did not work for me. It reports...

Compile Error: Identifier 'wxEVT_COMMAND_WEB_VIEW_NAVIGATING' not found.

I could not find any other reference to it.

Also, when I ran html/widget, it worked. But when I closed its window, it popped up a "wxWidgets Debug Alert" - something about a failure in DoCleanUpModules().


Brucey(Posted 2013) [#50]
The wxWebView events changed from wxEVT_COMMAND_WEB_VIEW_ to wxEVT_WEBVIEW in the latest wxWidgets.

Actually, lots of other control events have changed, dropping the COMMAND part, but I've left those alone.


Brucey(Posted 2013) [#51]
on Mac but there is an issue with toolbars, in that that don't display horizontally

If you add this after you create the toolbar, it shows up :
	Self.SetToolbar(m_toolbar)


Based on this post ( http://forums.wxwidgets.org/viewtopic.php?f=23&t=37794 ), there are issues using the native toolbar and small(er) icon sizes, despite what you see used in MaxIDE.

You could always supply some nice 32x32 icons for your OS X version ;-)


Pete Rigz(Posted 2013) [#52]
Ok, so you mean set the toolbar immediately after you create it?

Well, I need to re-save the icons anyway so I might redo them as 32x32.


Brucey(Posted 2013) [#53]
Ok, so you mean set the toolbar immediately after you create it?

Yes, any time afterwards should be fine.


Pete Rigz(Posted 2013) [#54]
Can confirm that worked, as long it's before "realising" the toolbar. Off to find some bigger icons :-)


Pete Rigz(Posted 2013) [#55]
Can also confirm that re-saving all PNG's from Photoshop stopped the icc errors from appearing. That's with a standard save for web PNG24 profile.