Backport #3824: rbconfig.rb generated by cross-compilation do provide cor=
rect path for link process
http://redmine.ruby-lang.org/issues/show/3824

Author: Luis Lavena
Status: Open, Priority: Normal

Hello,

I'm trying to cross-compile Ruby 1_8_7 branch using i686-w64-mingw32 (min=
gw-w64 project). I've managed successfully to cross-compile and install u=
sing patches provided in #2531, #3666 and #3822.

However, I've now encountered a problem. mkmf is confused about the locat=
ion of msvcrt-ruby18 shared library to link to:

<pre><code>
$ ruby -I/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ru=
by/1.8:/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ruby=
/1.8/i386-mingw32 -rfake ../../../../ext/my_ext/extconf.rb
</code></pre>

fake.rb is a simplified version of the one generated by Makefile.

Find attached both the generated Makefile and the fake.rb used by me.

The extension is a simple one, which just puts something to stdout.


----------------------------------------
http://redmine.ruby-lang.org
ClNIRUxMID0gL2Jpbi9zaAoKIyMjIyBTdGFydCBvZiBzeXN0ZW0gY29uZmln
dXJhdGlvbiBzZWN0aW9uLiAjIyMjCgpzcmNkaXIgPSAuLi8uLi8uLi8uLi9l
eHQvbXlfZXh0CnRvcGRpciA9IC9Vc2Vycy9sdWlzL1BvcnRpbGUvaTY4Ni13
NjQtbWluZ3czMi9hcHBzL3J1YnkvMS44LjctaGVhZC9saWIvcnVieS8xLjgv
aTM4Ni1taW5ndzMyCmhkcmRpciA9ICQodG9wZGlyKQpWUEFUSCA9ICQoc3Jj
ZGlyKTokKHRvcGRpcik6JChoZHJkaXIpCmV4ZWNfcHJlZml4ID0gJChwcmVm
aXgpCnByZWZpeCA9ICQoREVTVERJUikvVXNlcnMvbHVpcy9Qb3J0aWxlL2k2
ODYtdzY0LW1pbmd3MzIvYXBwcy9ydWJ5LzEuOC43LWhlYWQKc2hhcmVkc3Rh
dGVkaXIgPSAkKHByZWZpeCkvY29tCm1hbmRpciA9ICQoZGF0YXJvb3RkaXIp
L21hbgpwc2RpciA9ICQoZG9jZ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