'ruby-1.8.5'에 해당되는 글 1건

  1. 2006/11/22 Ruby 1.8.5 버그 및 패치 (3)
Ruby 1.8.5 (185-21)에서 fxruby를 require 했더니 워닝이 주루륵 뜬다.

c:/program files/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.3-mswin32/ext/fox16/fox16.so: warning: already initialized constant TRUE
...

증상을 찾아보니 '조금' 알려진 버그이고 트래킹도 되어 있는데 아직 배포판의 최신판의 빌드번호는 21에 머물고 있어서 간단한 패치를 만들었다.

#
# Ruby 1.8.5 UNOFFICIAL patch
# for fxruby require warning
#
# created by gihwan.ryu (at) gmail.com @ 2006-11-22
#

patch = <<-EOH
if $VERBOSE
  $VERBOSE = nil
  require "fox16.so"
  $VERBOSE = true
else
  $VERBOSE = nil
  require "fox16.so"
  $VERBOSE = false
end
EOH

version = '1.8.5'
date    = '2006-08-25'

if RUBY_VERSION == version and RUBY_RELEASE_DATE == date
  File.open($:[0] + '/fox16.rb', 'w') { |f|
   f.write patch
  }
else
  File.unlink($:[0] + '/fox16.rb')
end

루비버전과 배포일을 확인하여 문제가 있는 버전이면 첫번째 load path에 fox16.rb 파일을 생성하여 verbose를 끄고 fox16.so를 require한 다음 verbose를 원래도로 복구한다.