Permalink
Browse files

Handle debugging flags with debug-level in extconf.

This will handle the case where Ruby is built with extra debugging information (e.g., `-g3` or `-ggdb3`). If you don't include this, installation fails like so:

    $ gem install amalgalite
    Building native extensions.  This could take a while...
    ERROR:  Error installing amalgalite:
    ERROR: Failed to build gem native extension.
    
    creating Makefile
    make
    compiling amalgalite3.c
    clang: error: no such file or directory: '3'
    make: *** [amalgalite3.o] Error 1

Thanks!
  • Loading branch information...
1 parent bb1497a commit 8bd85c7bfc9465d2e6a93a397cdfd79527e293ea @ged ged committed May 3, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 ext/amalgalite/extconf.rb
@@ -20,7 +20,7 @@
end
# remove the -g flags if it exists
-%w[ -ggdb -g ].each do |debug|
+%w[ -ggdb\\d* -g\\d* ].each do |debug|
$CFLAGS = $CFLAGS.gsub(/#{debug}/,'')
RbConfig::MAKEFILE_CONFIG['debugflags'] = Config::MAKEFILE_CONFIG['debugflags'].gsub(/#{debug}/,'') if Config::MAKEFILE_CONFIG['debugflags']
end

0 comments on commit 8bd85c7

Please sign in to comment.