From 793b84c835e5886a7f7c13f430a0c33491911a63 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Mon, 24 Feb 2014 12:35:56 -0800 Subject: [PATCH] Update extconf to produce viable makefile on mingw --- ext/dep_gecode/extconf.rb | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/ext/dep_gecode/extconf.rb b/ext/dep_gecode/extconf.rb index ebe4c23..ad5d6af 100644 --- a/ext/dep_gecode/extconf.rb +++ b/ext/dep_gecode/extconf.rb @@ -23,16 +23,38 @@ # to work properly here. require 'mkmf' -$LIBS << " -lstdc++" +# XXX: Why is this here? On mingw this causes (and lots of similar) +# multiple definition of `std::ctype::_M_widen_init() const' +# $LIBS << " -lstdc++" # $CFLAGS << "-g" gecode_installed = - have_library('gecodesearch') && - have_library('gecodeint') && - have_library('gecodekernel') && + # Gecode documentation notes: + # "Some linkers require the list of libraries to be sorted such that + # libraries appear before all libraries they depend on." + # http://www.gecode.org/doc-latest/MPG.pdf + # + # This appears to be true of the version of mingw that ships with Ruby 1.9.3. + # The correct order of `-l` flags according to the docs is: + # + # 1. -lgecodeflatzinc + # 2. -lgecodedriver + # 3. -lgecodegist + # 4. -lgecodesearch, + # 5. -lgecodeminimodel + # 6. -lgecodeset + # 7. -lgecodefloat + # 8. -lgecodeint + # 9. -lgecodekernel + # 10. -lgecodesupport + # + # Ruby `mkmf` will add `-l` flags in the _REVERSE_ order that they appear here. have_library('gecodesupport') && - have_library('gecodeminimodel') + have_library('gecodekernel') && + have_library('gecodeint') && + have_library('gecodeminimodel') && + have_library('gecodesearch') unless gecode_installed STDERR.puts <