Linking errors

BlitzMax Forums/Brucey's Modules/Linking errors

kmac(Posted 2013) [#1]
I have encountered what's becoming an all too common error with exception handling using MinGW (SJLJ vs DW2). Before continuing, I've had Blitzmax for ages but other than a weekend or two have never used the language/environment, so my problems could be of my own making.

First, I have several installations of MinGW on my computer, but none in the path. To run MaxIDE the following in a batch,

set MINGW=c:\tdm-471
call c:\tdm-471\mingwvars.bat
maxide



Launch this way I can build pretty much all of Brucey's modules, including wx.mod (3.0). In this case tdm-471 is the SJLJ installation. However, attempting to build any of the samples will fail with something like the following,

C:/BlitzMax/mod/bah.mod/freeimage.mod/freeimage.debug.win32.x86.a(tgt.c.debug.win32.x86.o):tgt.c:(.text+0x7e3): undefined reference to `__gcc_personality_sj0'
C:/BlitzMax/mod/bah.mod/freeimage.mod/freeimage.debug.win32.x86.a(tgt.c.debug.win32.x86.o):tgt.c:(.text+0x811): undefined reference to `_Unwind_SjLj_Register'



The installation of Blitzmax was fresh. I have even compiled using the DW2 version of TDM.

Any ideas? Thanks.


xlsior(Posted 2013) [#2]
Did you also update to the latest version of the freeimage module?


kmac(Posted 2013) [#3]
It appears so. I ran an SVN update this morning. I get the same errors with wx.mod.

Again, as noted, none of the GCC based compilers are accessible unless I manually set the environment variables. However, this seems to be user error.


Brucey(Posted 2013) [#4]
You also need to have a set of libs, ar.exe and ld.exe in the BlitzMax bin & lib folders, of the MinGW you are using.
Without that, when you link your exe it is using the wrong set of MinGW static libraries that the wxWidgets static libraries were compiled against.
The default static libraries I build with sjlj TDM-4.7.1. In the future I hope to also make a set built against a different MinGW (perhaps nuwen or the official ones).

Some people are using scripts such as these to ensure everything is copied into the places BlitzMax expects them.

Of course, if you intend to use a different MinGW for other stuff, you'd want to copy those back again.

And you can of course use two different BlitzMax installations, one for one MinGW, one for another - you can have as many BlitzMax folders as you need.


kmac(Posted 2013) [#5]
Thank you. That fixed the problem.


Brucey(Posted 2013) [#6]
Again, as noted, none of the GCC based compilers are accessible unless I manually set the environment variables

For my XP, I have an environment variable MinGW which points to the base dir of MinGW, and the bin dir of MinGW on my PATH.

From a command line you can run :
C:\BlitzMax148\bin>gcc --version
gcc (tdm-1) 4.7.1

and you'll know if it's set up.


kmac(Posted 2013) [#7]
All is good, now.

It's amazing how much utility is available through these modules. Thank you. Now, I should invest some time in the language.