Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont use rubygems on extconf #191

Merged
merged 2 commits into from May 3, 2016
Merged

Dont use rubygems on extconf #191

merged 2 commits into from May 3, 2016

Conversation

arthurnn
Copy link
Contributor

@arthurnn arthurnn commented May 2, 2016

extconf.rb fail to run when disabling rubygems:
RUBYOPT='--disable-gems' rake

Instead of requiring rubygems here, we could just use rbconfig instead.

See error that happens without this PR:

[arthurnn@snowball test_bundler]$ RUBYOPT='--disable-gems' bundle
Fetching gem metadata from https://rubygems.org/..
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 1.11.2
Installing ruby-prof 0.15.9 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/arthurnn/.gem/ruby/2.3.0/gems/ruby-prof-0.15.9/ext/ruby_prof
/Users/arthurnn/.rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160502-97773-1kxo9fy.rb extconf.rb
checking for rb_gc_stat()... yes
checking for rb_gc_count()... yes
checking for rb_os_allocated_objects()... no
checking for rb_gc_allocated_size()... no
checking for rb_gc_collections()... no
checking for rb_gc_time()... no
checking for rb_gc_total_time()... no
checking for rb_gc_total_mallocs()... no
checking for rb_gc_total_malloced_bytes()... no
checking for rb_heap_total_mem()... no
checking for rb_gc_heap_info()... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/arthurnn/.rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
extconf.rb:41:in `<main>': uninitialized constant Gem (NameError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/arthurnn/.gem/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/ruby-prof-0.15.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/arthurnn/.gem/ruby/2.3.0/gems/ruby-prof-0.15.9 for inspection.
Results logged to /Users/arthurnn/.gem/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/ruby-prof-0.15.9/gem_make.out
An error occurred while installing ruby-prof (0.15.9), and Bundler cannot continue.
Make sure that `gem install ruby-prof -v '0.15.9'` succeeds before bundling.

Arthur Nogueira Neves added 2 commits May 2, 2016 13:48
extconf.rb fail to run when disabling rubygems: 
`RUBYOPT='--disable-gems' rake`

Instead of requiring rubygems here, we could just use rbconfig instead.
@skaes
Copy link
Member

skaes commented May 3, 2016

Looks OK to me but I'm curious: why would you want to disable gems?

@arthurnn
Copy link
Contributor Author

arthurnn commented May 3, 2016

@skaes We(GitHub) have a few ruby scripts that run with less environment loaded as possible for speed. I dont know how faster they are TBH, but I found this while running bundle install, which for us uses disable-gems as ruby option.

@skaes skaes merged commit fd656f5 into ruby-prof:master May 3, 2016
@skaes
Copy link
Member

skaes commented May 3, 2016

@arthurnn got it. thx for the info.

@arthurnn arthurnn deleted the patch-1 branch May 3, 2016 17:39
skaes added a commit to skaes/ruby-prof that referenced this pull request Jun 17, 2016
@glensc
Copy link

glensc commented Aug 22, 2016

@skaes could you please make new release, ruby-prof-0.15.9 is added in gitlab-8.11 and i fail to build it because your extconf.rb uses Gem symbol without prior require "rubygems".

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib64
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby
extconf.rb:41:in `<main>': uninitialized constant Gem (NameError)

extconf failed, exit code 1

Gem files will remain installed in /home/users/glen/rpm/BUILD/x86_64-linux/gitlabhq-8.11.0/vendor/bundle/ruby/gems/ruby-prof-0.
15.9 for inspection.
Results logged to /home/users/glen/rpm/BUILD/x86_64-linux/gitlabhq-8.11.0/vendor/bundle/ruby/extensions/x86_64-linux/ruby-prof-
0.15.9/gem_make.out

glensc added a commit to pld-linux/gitlab-ce that referenced this pull request Aug 22, 2016
@skaes
Copy link
Member

skaes commented Aug 24, 2016

@glensc I'm confused: 0.15.9 does not include the patch discussed here. It's only on master branch.

BTW, requiring rubygems has been obsolete now for a long time. Which ruby version are you using?

@skaes
Copy link
Member

skaes commented Aug 24, 2016

@glensc Gem is defined in my ruby:

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ ruby -e 'puts(defined? Gem)'
constant

@glensc
Copy link

glensc commented Aug 24, 2016

@skaes as outlined in #191 (comment)
i also have ruby which was built with --disable-gems
i think ruby version is irrelevant, what is relevant whether ruby was built with preloading rubygems library

and 0.15.9 is broken for me, as patch from this PR is needed to fix build with my ruby.

any trustworthy link about requiring rubygems has been obsolete now for a long time?

i'd say as long ruby has --disable-gems configure option code that uses Gem symbol should ensure rubygems module is loaded.

anyway, could you just release new version (and i'll ping gitlab dudes to bump their deps) as this is only gem that fails to build on my system.

# ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

# ruby -e 'puts(defined? Gem)'

@skaes
Copy link
Member

skaes commented Aug 24, 2016

I did not know about --disable-gems being a compile time option for ruby and with obsolete I meant that since 1.9.x rubygems is required by default in a "normal" ruby installation.

Anyway, I'm going to release an updated gem to fix your problem.

@skaes
Copy link
Member

skaes commented Aug 24, 2016

Released as 0.16.0

@skaes
Copy link
Member

skaes commented Aug 24, 2016

Please use 0.16.1. 0.16.0 won't work for ruby 2.1.10.

@glensc
Copy link

glensc commented Aug 24, 2016

thanks!

@glensc
Copy link

glensc commented Aug 24, 2016

@skaes could you also push out git tags so the releases be visible?
https://github.com/ruby-prof/ruby-prof/releases

@glensc
Copy link

glensc commented Aug 25, 2016

@skaes
Copy link
Member

skaes commented Aug 25, 2016

@glensc please use 0.16.2.

@glensc
Copy link

glensc commented Aug 25, 2016

right. thanks

glensc added a commit to pld-linux/gitlab-ce that referenced this pull request Aug 25, 2016
rymai pushed a commit to gitlabhq/gitlabhq that referenced this pull request Sep 29, 2016
This solve issues with ruby builds with rubygems preload
see ruby-prof/ruby-prof#191

Signed-off-by: Rémy Coutable <remy@rymai.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants