Project

General

Profile

Actions

Bug #6987

closed

have_framework can only be called once in extconf.rb

Added by drbrain (Eric Hodel) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:47447]

Description

=begin
Since r36437 ((|$LDFLAGS|)) will contain a NULL byte if (({have_framework})) is returned successfully.

If extconf.rb attempts to call (({have_framework})) twice to discover multiple frameworks it will now fail:

$ cat test.rb
require 'mkmf'

have_framework 'OpenGL'
have_framework 'GLUT'

$ make runruby
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems ./test.rb
checking for OpenGL... yes
checking for GLUT... /Users/drbrain/Work/svn/ruby/trunk/lib/mkmf.rb:339:in `system': string contains null byte (ArgumentError)
[…]

Since (({have_framework})) makes use of ((|$LDFLAGS|)) the NULL byte causes this exception.

Due to the TODO, I'm unsure what kind of patch should be applied. The easiest would be:

Index: lib/mkmf.rb

--- lib/mkmf.rb (revision 36915)
+++ lib/mkmf.rb (working copy)
@@ -413,6 +413,7 @@ MSG

 def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
   librubyarg = $extmk ? $LIBRUBYARG_STATIC : "$(LIBRUBYARG)"
  • discovered_ldflags = $LDFLAGS.gsub("\0", " ")
    conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
    'src' => "#{CONFTEST_C}",
    'arch_hdrdir' => $arch_hdrdir.quote,
    @@ -421,7 +422,7 @@ MSG
    'CPPFLAGS' => "#$CPPFLAGS",
    'CFLAGS' => "#$CFLAGS",
    'ARCH_FLAG' => "#$ARCH_FLAG",
  •                              'LDFLAGS' => "#$LDFLAGS #{ldflags}",
    
  •                              'LDFLAGS' => "#{discovered_ldflags} #{ldflags}",
                                 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
                                 'LIBS' => "#{librubyarg} #{opt} #$LIBS")
    
    conf['LIBPATH'] = libpathflag(libpath.map {|s| RbConfig::expand(s.dup, conf)})

=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36918.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


mkmf.rb: fix splitting options with an argument

  • ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting
    options with an argument, not using NUL as special character.
    [ruby-core:47447] [Bug #6987]
Actions

Also available in: Atom PDF

Like0
Like0