Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > mkmf-bug under mingw without msys

Reply
Thread Tools

mkmf-bug under mingw without msys

 
 
Marcel O.
Guest
Posts: n/a
 
      02-01-2011
Hi,

I have a problem building an extension with mkmf under windows which
seems to me as a bug: I want to build the extension in an mingw
environment WITHOUT msys, but mkmf contains code that if it runs in an
mingw environment makes the incorrect assumption it runs under msys and
needs an appropriate path conversion:

mkmf.rb (in all Ruby versions I checked)
case CONFIG['build_os']
when 'mingw32'
def mkintpath(path)
# mingw uses make from msys and it needs special care
# converts from C:\some\path to /C/some/path
path = path.dup
path.tr!('\\', '/')
path.sub!(/\A([A-Za-z])?=\/)/, '/\1')
path
end
end


This results in my mingw-only environment in a generated makefile which
can't find ruby.h.

I don't know if it is a common solution to check instead of
CONFIG['build_os'], if the environment variable OS_TYPE is set to msys.

Regards
Marcel

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Luis Lavena
Guest
Posts: n/a
 
      02-01-2011
On Feb 1, 7:47*am, "Marcel O." <(E-Mail Removed)> wrote:
> Hi,
>
> I have a problem building an extension with mkmf under windows which
> seems to me as a bug: I want to build the extension in an mingw
> environment WITHOUT msys, but mkmf contains code that if it runs in an
> mingw environment makes the incorrect assumption it runs under msys and
> needs an appropriate path conversion:
>


You can build ruby without msys, but then you will have problems about
dependencies like bison, sed, sh and others that Ruby is expecting.

Can I know the reason of your need? RubyInstaller has been built with
MinGW+MSYS and both have been packaged conveniently as 'DevKit' for
it's transparent usage under Ruby for Windows:

http://github.com/oneclick/rubyinsta...evelopment-Kit

--
Luis Lavena
 
Reply With Quote
 
 
 
 
Marcel O.
Guest
Posts: n/a
 
      02-01-2011
Luis Lavena wrote in post #978878:
> On Feb 1, 7:47am, "Marcel O." <(E-Mail Removed)> wrote:
>> Hi,
>>
>> I have a problem building an extension with mkmf under windows which
>> seems to me as a bug: I want to build the extension in an mingw
>> environment WITHOUT msys, but mkmf contains code that if it runs in an
>> mingw environment makes the incorrect assumption it runs under msys and
>> needs an appropriate path conversion:
>>

>
> You can build ruby without msys, but then you will have problems about
> dependencies like bison, sed, sh and others that Ruby is expecting.
>


I don't have such dependencies. If I manually change the path in the
generated Makefile, I can compile and link and everything works
perfectly.

> Can I know the reason of your need? RubyInstaller has been built with
> MinGW+MSYS and both have been packaged conveniently as 'DevKit' for
> it's transparent usage under Ruby for Windows:
>
> http://github.com/oneclick/rubyinsta...evelopment-Kit


I know of the DevKit (and use it, too). The reasons are more for
convenience purposes: For the deployment of the extension as a gem, the
DevKit will be our way to go, but for the integration in our build
process (using CMake), during which we use the extension, it would be
easier to use the extension directly (without a gem). So I tried to
implement it that way, and the only obstacle I had, does IMO base on an
obvious misconception in the mkmf code: MinGW implies MSYS; although
this is the normal case under windows due to the DevKit.

I made a proposal to use the OS_TYPE environment variable, but I don't
know if this will work on all systems. If no one can tell if this would
work and no one else is interested in fixing this and supporting the
MinGW-only use case, I must try to integrate the DevKit in our build
environment. In this case: Would it be possible to integrate DevKit's
MinGW+MSYS environment without the involvement of RubyGems.

Kind regards
Marcel

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Gordon Thiesfeld
Guest
Posts: n/a
 
      02-01-2011
On Tue, Feb 1, 2011 at 10:31 AM, Marcel O.
<(E-Mail Removed)> wrote:
> Luis Lavena wrote in post #978878:
>> On Feb 1, 7:47am, "Marcel O." <(E-Mail Removed)> wrote:
>>> Hi,
>>>
>>> I have a problem building an extension with mkmf under windows which
>>> seems to me as a bug: I want to build the extension in an mingw
>>> environment WITHOUT msys, but mkmf contains code that if it runs in an
>>> mingw environment makes the incorrect assumption it runs under msys and
>>> needs an appropriate path conversion:
>>>

>>
>> You can build ruby without msys, but then you will have problems about
>> dependencies like bison, sed, sh and others that Ruby is expecting.
>>

>
> I don't have such dependencies. If I manually change the path in the
> generated Makefile, I can compile and link and everything works
> perfectly.
>
>> Can I know the reason of your need? RubyInstaller has been built with
>> MinGW+MSYS and both have been packaged conveniently as 'DevKit' for
>> it's transparent usage under Ruby for Windows:
>>
>> http://github.com/oneclick/rubyinsta...evelopment-Kit

>
> I know of the DevKit (and use it, too). The reasons are more for
> convenience purposes: For the deployment of the extension as a gem, the
> DevKit will be our way to go, but for the integration in our build
> process (using CMake), during which we use the extension, it would be
> easier to use the extension directly (without a gem). So I tried to
> implement it that way, and the only obstacle I had, does IMO base on an
> obvious misconception in the mkmf code: MinGW implies MSYS; although
> this is the normal case under windows due to the DevKit.
>
> I made a proposal to use the OS_TYPE environment variable, but I don't
> know if this will work on all systems. If no one can tell if this would
> work and no one else is interested in fixing this and supporting the
> MinGW-only use case, I must try to integrate the DevKit in our build
> environment. In this case: Would it be possible to integrate DevKit's
> MinGW+MSYS environment without the involvement of RubyGems.
>


You can require the devkit without rubygems.

ruby -rdevkit extconf.rb

> Kind regards
> Marcel
>
> --
> Posted via http://www.ruby-forum.com/.
>
>




--
Gordon Thiesfeld
http://vert.igino.us

 
Reply With Quote
 
Marcel O.
Guest
Posts: n/a
 
      02-07-2011
Gordon Thiesfeld wrote in post #978911:
> On Tue, Feb 1, 2011 at 10:31 AM, Marcel O.
> <(E-Mail Removed)> wrote:
>>>
>>> it's transparent usage under Ruby for Windows:

>> this is the normal case under windows due to the DevKit.
>>
>> I made a proposal to use the OS_TYPE environment variable, but I don't
>> know if this will work on all systems. If no one can tell if this would
>> work and no one else is interested in fixing this and supporting the
>> MinGW-only use case, I must try to integrate the DevKit in our build
>> environment. In this case: Would it be possible to integrate DevKit's
>> MinGW+MSYS environment without the involvement of RubyGems.
>>

>
> You can require the devkit without rubygems.
>
> ruby -rdevkit extconf.rb


Adding the following to extconf.rb did the job for me. It implements a
workaround hack, by undoing the work of the stupid mkintpath function.

if CONFIG['build_os'] == 'mingw32' &&
ENV['MSYSTEM'] != 'MINGW32' # we are using MinGW without MSYS
mf_content = IO.read( "Makefile" )
mf_content.gsub!( /^topdir = \/([a-zA-Z])/ ) {
"topdir = #{$1}:" } # Ruby 1.8
mf_content.gsub!( /^hdrdir = \/([a-zA-Z])/ ) {
"hdrdir = #{$1}:" } # Ruby 1.9
File.open( "Makefile", "w" ) { |mf| mf.puts mf_content }
end

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
progress: compiling python2.5 under msys (specifically but notexclusively under wine) with msvcr80 Luke Kenneth Casson Leighton Python 1 01-25-2009 04:45 PM
report on building of python 2.5.2 under msys under wine on linux. Luke Kenneth Casson Leighton Python 0 01-15-2009 09:48 PM
Problems to Compile Ruby19 using MSYS and MinGW on Windows for Ruby19Snapshots starting 2007 Wolfgang Nádasi-Donner Ruby 3 05-04-2007 08:54 PM
Install GSL\Ruby 1.8.3 with Mingw/MSYS at Windows failed? Jianhong.Wang@gmail.com Ruby 1 10-19-2006 04:58 AM
Ruby 1.9 on XP using mingw/msys Kaspar Schiess Ruby 0 08-18-2004 07:41 AM



Advertisments