Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update extconf to produce viable makefile on mingw #5

Closed
wants to merge 2 commits into from

2 participants

@danielsdeleo

I have no idea what the consequences of removing $LIBS << " -lstdc++" will be on other platforms. This needs to be sanity checked.

@danielsdeleo

upload
Results.

@danielsdeleo

To clear the funky fork history of dep-selector, I deleted and recreated opscode/dep-selector, which is now the official repo. See chef/dep-selector#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 .gitignore
@@ -11,3 +11,7 @@ ext/dep_gecode/Makefile
*.gz
*.changes
*.build
+pkg/*
+Gemfile.lock
+*.so
+*.def
View
2  Gemfile
@@ -0,0 +1,2 @@
+source "https://rubygems.org"
+gemspec
View
3  dep_selector.gemspec
@@ -17,4 +17,7 @@ Gem::Specification.new do |s|
s.requirements << 'g++'
s.files = Dir.glob("lib/**/*.{rb}") + Dir.glob("ext/**/*.{i,c,cxx,h,cpp,rb}")
s.extensions = Dir["ext/**/extconf.rb"]
+
+ s.add_development_dependency "uuidtools"
+ s.add_development_dependency "rspec"
end
View
32 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<char>::_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 <<EOS
View
1  spec/spec_helper.rb
@@ -18,6 +18,7 @@
#
require 'rubygems'
+$:.unshift(File.expand_path("../../ext/dep_gecode", __FILE__))
require 'dep_selector'
require 'pp'
Something went wrong with that request. Please try again.