[CoinBinary] Building JNI-based under MinGW

acw at ascent.com acw at ascent.com
Fri Jul 27 11:19:41 EDT 2012


Perhaps I spoke too soon; I've done a little more research since I sent 
yesterday's message.  If I have not misunderstood the case, Microsoft is 
still clinging to SjLj; their compiler suite produces binaries that use 
SjLj, and so their system libraries are all SjLj-based.  Furthermore, Dw2 
code cannot inter-operate with SjLj, so for the moment, anything that runs 
in a Windows environment must be SjLj from cover to cover.  (This isn't 
quite accurate: the restriction is that a Dw2-style exception can't unwind 
through an SjLj stack frame, like a Windows callback.) So, at least for 
the Windows target, it is probably premature to try compiling to Dw2.  In 
Unix and Linux, however, Dw2 is probably worth trying for the potential 
performance gain.

In other news, I found a compiler suite called TDM-GCC, under active 
development at least as late as last September, which claims to produce 
SjLj binaries for both the 32-bit and 64-bit Windows environment.  When 
things settle down here a bit I intend to try their wares: see 
http://tdm-gcc.tdragon.net/ for more details.



From:
Ted Ralphs <ted at Lehigh.EDU>
To:
acw at ascent.com
Cc:
CoinBinary at list.coin-or.org
Date:
07/26/2012 08:25 PM
Subject:
Re: Building JNI-based under MinGW



The reason for the use of the sjlj version of gcc was simply because it 
was the first version that I finally got the full CoinAll suite to build 
and pass unit tests with and it has continued to work year after year. 
Every other version of the MinGW compilers I've tried (and there have been 
many) has failed, usually in a strange way that's hard to interpret. 
Plainly, most versions of the MinGW compiler suite just seem buggy/flaky. 
Version 4.2.1 was the one version that seemed robust and just worked 
(though I did have to fix a buggy .la file, even in that version: see 
issue described at 
https://projects.coin-or.org/BuildTools/wiki/current-issues#Compilation). 
Coincidentally (or perhaps not), this is the exact same version that still 
ships with XCode on the Mac. I will give another try to building with some 
later versions and see how it goes.

Cheers,

Ted

On Thu, Jul 26, 2012 at 7:00 PM, <acw at ascent.com> wrote:
I appreciate the response, and figured from the delay that it wasn't an 
easy task to port to Win64.  For the moment, at least, we are just going 
to run in 32-bit mode on 64-bit platforms; eventually, the MinGW 
community's compiler technology will catch up.  I did, in fact, try to 
build from source using one 64-bit MinGW GCC, but wasn't even able to 
diagnose the failures I was getting -- it was way outside my area of 
expertise, whatever that is. 

Another thing we should be keeping our eyes on is exception-handling 
architecture.  At the moment, CoinBinary is doing its building with the 
deprecated SjLj architecture, rather than the modern Dwarf 2 architecture, 
which has two disadvantages: 1. it ties you to a compiler branch which is 
not being actively maintained by the MinGW developers; and 2. SjLj incurs 
a processing cost whenever you enter the scope of an exception handler, 
regardless of whether the exception occurs.  (Dwarf 2 has no processing 
cost for merely entering the scope of a handler; all costs are incurred 
when the exception is actually thrown.  I don't know how they managed 
that.)  I didn't understand the explanation of why CoinBinary projects 
can't be built with a Dwarf 2 compiler, though I am certainly willing to 
believe there are difficulties.  These difficulties must be surmounted 
eventually, though, because it doesn't look as if anyone wants to spend 
any energy maintaining the SjLj compiler. 

Anyway, we're certainly up and running for the moment, so this is really 
only a theoretical issue.  Thanks for all the help you've given.



-- 
Dr. Ted Ralphs
Associate Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coinbinary/attachments/20120727/98d5a793/attachment.html>


More information about the CoinBinary mailing list