Can't install gems after a new ubuntu install

Discussion in 'Ruby' started by Max Williams, Jul 12, 2008.

  1. Max Williams

    Max Williams Guest

    Sorry if this is the wrong forum...

    Previously i'd been using ubuntu in a VM in windows. Finally i've taken
    the plunge and wiped windows completely and done a proper ubuntu
    install. (which was the easiest OS install i've EVER done btw - no
    driver hassles or anything).

    Anyway, i'm trying to get everything set up again for my work (rails
    dev). I've installed ruby and ruby-gems with apt. Now i'm trying to
    get some more gems, but i keep getting this problem (for hpricot in this
    case but i also had it with ferret).

    >max@max-laptop:~$ sudo gem install hpricot
    >Select which gem to install for your platform (i486-linux)
    > 1. hpricot 0.6 (jruby)
    > 2. hpricot 0.6 (mswin32)
    > 3. hpricot 0.6 (ruby)
    > 4. hpricot 0.5 (ruby)
    > 5. hpricot 0.5 (mswin32)
    > 6. Skip this gem
    > 7. Cancel installation
    >> 3

    >Building native extensions. This could take a while...
    >ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
    > ERROR: Failed to build gem native extension.
    >
    >ruby extconf.rb install hpricot
    >extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
    > from extconf.rb:1
    >
    >
    >Gem files will remain installed in /var/lib/gems/1.8/gems/hpricot-0.6 for >inspection.
    >Results logged to /var/lib/gems/1.8/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out


    Doing "gem list" gives me these:

    >*** LOCAL GEMS ***
    >
    >rake (0.8.1)
    > Ruby based make-like utility.
    >
    >sources (0.0.1)
    > This package provides download sources for remote gem installation

    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 12, 2008
    #1
    1. Advertising

  2. Max Williams

    Max Williams Guest

    Actually, looking at this error "no such file to load -- mkmf"
    makes me think that maybe i need to install 'make': is that the case?
    If so, is it just a simple "sudo apt-get install make"?
    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 12, 2008
    #2
    1. Advertising

  3. Max Williams

    Max Williams Guest

    Doh, just checked, i have make installed already. I'm going to shut up
    and let someone else answer now :)
    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 12, 2008
    #3
  4. Max Williams

    phlip Guest

    Max Williams wrote:

    > Doh, just checked, i have make installed already. I'm going to shut up
    > and let someone else answer now :)


    aptitude ruby-full will get you ruby1.8-dev. Does this show it?

    aptitude search ruby1.8-dev | grep ^i

    I think that's the next step towards mkmf. You also need a little gcc!
    phlip, Jul 12, 2008
    #4
  5. Max Williams

    Max Williams Guest

    phlip wrote:
    >
    > aptitude ruby-full will get you ruby1.8-dev. Does this show it?
    >
    > aptitude search ruby1.8-dev | grep ^i
    >
    > I think that's the next step towards mkmf. You also need a little gcc!


    Thanks philip - i am getting closer! Following the instructions on this
    page:
    http://daniel.lorch.cc/docs/rails_install_debian/

    i did "apt-get install ruby1.8-dev" and now i get this massive error
    report (follows). In reference to 'a little gcc' do you mean that i
    need gcc to compile the c code used in the gems? Is that just an
    apt-get?

    max@max-laptop:~$ sudo gem install hpricot
    Select which gem to install for your platform (i486-linux)
    1. hpricot 0.6 (jruby)
    2. hpricot 0.6 (mswin32)
    3. hpricot 0.6 (ruby)
    4. hpricot 0.5 (ruby)
    5. hpricot 0.5 (mswin32)
    6. Skip this gem
    7. Cancel installation
    > 3

    Building native extensions. This could take a while...
    ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

    ruby extconf.rb install hpricot
    checking for main() in -lc... no
    creating Makefile

    make
    cc -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I. -fPIC
    -fno-strict-aliasing -g -g -O2 -fPIC -c hpricot_scan.c
    In file included from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/ruby/1.8/i486-linux/ruby.h:40:21: error: stdlib.h: No such file
    or directory
    /usr/lib/ruby/1.8/i486-linux/ruby.h:44:21: error: string.h: No such file
    or directory
    /usr/lib/ruby/1.8/i486-linux/ruby.h:54:19: error: stdio.h: No such file
    or directory
    /usr/lib/ruby/1.8/i486-linux/ruby.h:71:20: error: alloca.h: No such file
    or directory
    In file included from
    /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h:7,
    from
    /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:11,
    from /usr/lib/ruby/1.8/i486-linux/ruby.h:91,
    from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:122:61: error:
    limits.h: No such file or directory
    In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:718,
    from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/ruby/1.8/i486-linux/missing.h:16:24: error: sys/time.h: No such
    file or directory
    /usr/lib/ruby/1.8/i486-linux/missing.h:25:25: error: sys/types.h: No
    such file or directory
    In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:719,
    from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration
    specifiers or ‘...’ before ‘fd_set’
    /usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration
    specifiers or ‘...’ before ‘fd_set’
    /usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration
    specifiers or ‘...’ before ‘fd_set’
    /usr/lib/ruby/1.8/i486-linux/intern.h:219: warning: ‘struct timeval’
    declared inside parameter list
    /usr/lib/ruby/1.8/i486-linux/intern.h:219: warning: its scope is only
    this definition or declaration, which is probably not what you want
    /usr/lib/ruby/1.8/i486-linux/intern.h:220: warning: ‘struct timeval’
    declared inside parameter list
    /usr/lib/ruby/1.8/i486-linux/intern.h:455: warning: parameter names
    (without types) in function declaration
    In file included from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/ruby/1.8/i486-linux/ruby.h:728:21: error: pthread.h: No such
    file or directory
    In file included from ext/hpricot_scan/hpricot_scan.rl:9:
    /usr/lib/ruby/1.8/i486-linux/ruby.h:730: error: expected ‘=’, ‘,’, ‘;’,
    ‘asm’ or ‘__attribute__’ before ‘rb_nativethread_t’
    ext/hpricot_scan/hpricot_scan.rl: In function ‘hpricot_scan’:
    ext/hpricot_scan/hpricot_scan.rl:185: warning: incompatible implicit
    declaration of built-in function ‘memcpy’
    ext/hpricot_scan/hpricot_scan.rl:244: warning: incompatible implicit
    declaration of built-in function ‘memmove’
    make: *** [hpricot_scan.o] Error 1


    Gem files will remain installed in /var/lib/gems/1.8/gems/hpricot-0.6
    for inspection.
    Results logged to
    /var/lib/gems/1.8/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out


    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 12, 2008
    #5
  6. Max Williams

    Max Williams Guest

    phlip wrote:
    >> I would guess you need libglib2.0-dev...

    >
    > Also throw in libc6 !


    Thanks for all your advice phlip - before i get all these would you mind
    telling me what they are? And are they all gettable with apt-get?

    thanks again -max
    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 12, 2008
    #6
  7. Max Williams

    phlip Guest

    Max Williams wrote:

    > Thanks for all your advice phlip - before i get all these would you mind
    > telling me what they are? And are they all gettable with apt-get?


    You have some googling to do!

    sudo aptitude install libc6-dev
    phlip, Jul 12, 2008
    #7
  8. Max Williams

    Max Williams Guest

    Max Williams, Jul 12, 2008
    #8
  9. Max Williams

    Guest

    On Jul 12, 3:07 pm, Max Williams <> wrote:
    > All fixed now, thanks again for all your help.
    >
    > Have a nice weekend :)
    > --
    > Posted viahttp://www.ruby-forum.com/.


    As a note, for those that may come across this thread in the future...

    'sudo apt-get install build-essential'

    ... likely would have helped. It is a meta-package that installs gcc,
    g++, make, and libc6-dev.

    MilesZS
    , Jul 13, 2008
    #9
  10. Max Williams

    Dick Davies Guest

    On Sun, Jul 13, 2008 at 12:20 AM,
    <> wrote:

    > As a note, for those that may come across this thread in the future...
    >
    > 'sudo apt-get install build-essential'



    Bit odd that it's not a dependency of the ruby dev package, isn't it ?

    --
    Rasputnik :: Jack of All Trades - Master of Nuns
    http://number9.hellooperator.net/
    Dick Davies, Jul 13, 2008
    #10
  11. Max Williams

    Max Williams Guest

    Dick Davies wrote:
    > On Sun, Jul 13, 2008 at 12:20 AM,
    > <> wrote:
    >
    >> As a note, for those that may come across this thread in the future...
    >>
    >> 'sudo apt-get install build-essential'

    >
    >
    > Bit odd that it's not a dependency of the ruby dev package, isn't it ?


    Hey guys. I'm not sorted after all, argh. Humbly asking for more
    help...

    My problem is with trying to install the mysql gem.
    I did the build-essential install above, that worked fine, but i get ths
    when i try to install the mysql gem:

    >max@max-laptop:~$ sudo gem install mysql
    >Need to update 1 gems from http://gems.rubyforge.org
    >.
    >complete
    >Select which gem to install for your platform (i486-linux)
    > 1. mysql 2.7.3 (mswin32)
    > 2. mysql 2.7.1 (mswin32)
    > 3. mysql 2.7 (ruby)
    > 4. mysql 2.6 (ruby)
    > 5. Skip this gem
    > 6. Cancel installation
    >> 3

    >Building native extensions. This could take a while...
    >ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
    > ERROR: Failed to build gem native extension.
    >
    >ruby extconf.rb install mysql
    >checking for mysql_query() in -lmysqlclient... no
    >checking for main() in -lm... yes
    >checking for mysql_query() in -lmysqlclient... no
    >checking for main() in -lz... no
    >checking for mysql_query() in -lmysqlclient... no
    >checking for main() in -lsocket... no
    >checking for mysql_query() in -lmysqlclient... no
    >checking for main() in -lnsl... yes
    >checking for mysql_query() in -lmysqlclient... 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.


    I looked in the relevant mkmf.log file and found a load of stuff that's
    way over my head. There's loads of errors in it, i'll just post the
    first up:

    >find_library: checking for mysql_query() in -lmysqlclient... >-------------------- no
    >
    >"cc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I. -I/usr/local/include -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L"." -L"/us$
    >conftest.c: In function ‘t’:
    >conftest.c:3: error: ‘mysql_query’ undeclared (first use in this function)
    >conftest.c:3: error: (Each undeclared identifier is reported only once
    >conftest.c:3: error: for each function it appears in.)
    >checked program was:
    >/* begin */
    >1: /*top*/
    >2: int main() { return 0; }
    >3: int t() { void ((*volatile p)()); p = (void ((*)()))mysql_query; return 0; }
    >/* end */


    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 13, 2008
    #11
  12. [Note: parts of this message were removed to make it a legal post.]

    I installed libmysqlclient15-dev or libmysqlclient15off to fix that
    problem. I can't remember which one. :)



    On Sun, Jul 13, 2008 at 6:12 AM, Max Williams <>
    wrote:

    > Dick Davies wrote:
    > > On Sun, Jul 13, 2008 at 12:20 AM,
    > > <> wrote:
    > >
    > >> As a note, for those that may come across this thread in the future...
    > >>
    > >> 'sudo apt-get install build-essential'

    > >
    > >
    > > Bit odd that it's not a dependency of the ruby dev package, isn't it ?

    >
    > Hey guys. I'm not sorted after all, argh. Humbly asking for more
    > help...
    >
    > My problem is with trying to install the mysql gem.
    > I did the build-essential install above, that worked fine, but i get ths
    > when i try to install the mysql gem:
    >
    > >max@max-laptop:~$ sudo gem install mysql
    > >Need to update 1 gems from http://gems.rubyforge.org
    > >.
    > >complete
    > >Select which gem to install for your platform (i486-linux)
    > > 1. mysql 2.7.3 (mswin32)
    > > 2. mysql 2.7.1 (mswin32)
    > > 3. mysql 2.7 (ruby)
    > > 4. mysql 2.6 (ruby)
    > > 5. Skip this gem
    > > 6. Cancel installation
    > >> 3

    > >Building native extensions. This could take a while...
    > >ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
    > > ERROR: Failed to build gem native extension.
    > >
    > >ruby extconf.rb install mysql
    > >checking for mysql_query() in -lmysqlclient... no
    > >checking for main() in -lm... yes
    > >checking for mysql_query() in -lmysqlclient... no
    > >checking for main() in -lz... no
    > >checking for mysql_query() in -lmysqlclient... no
    > >checking for main() in -lsocket... no
    > >checking for mysql_query() in -lmysqlclient... no
    > >checking for main() in -lnsl... yes
    > >checking for mysql_query() in -lmysqlclient... 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.

    >
    > I looked in the relevant mkmf.log file and found a load of stuff that's
    > way over my head. There's loads of errors in it, i'll just post the
    > first up:
    >
    > >find_library: checking for mysql_query() in -lmysqlclient...
    > >-------------------- no
    > >
    > >"cc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I.

    > -I/usr/local/include -fno-strict-aliasing -g -g -O2 -fPIC conftest.c
    > -L"." -L"/us$
    > >conftest.c: In function 't':
    > >conftest.c:3: error: 'mysql_query' undeclared (first use in this function)
    > >conftest.c:3: error: (Each undeclared identifier is reported only once
    > >conftest.c:3: error: for each function it appears in.)
    > >checked program was:
    > >/* begin */
    > >1: /*top*/
    > >2: int main() { return 0; }
    > >3: int t() { void ((*volatile p)()); p = (void ((*)()))mysql_query; return

    > 0; }
    > >/* end */

    >
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
    Tristin Davis, Jul 13, 2008
    #12
  13. Max Williams

    Max Williams Guest

    Tristin Davis wrote:
    > I installed libmysqlclient15-dev or libmysqlclient15off to fix that
    > problem. I can't remember which one. :)
    >
    >
    >
    > On Sun, Jul 13, 2008 at 6:12 AM, Max Williams
    > <>


    The first one fixed it, thanks a lot! All i have left to get working
    now is a memcache server...
    --
    Posted via http://www.ruby-forum.com/.
    Max Williams, Jul 13, 2008
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    452
    SPE - Stani's Python Editor
    Apr 29, 2008
  2. Foolish Brat

    Fail to Install Gems - My First Gems

    Foolish Brat, Sep 1, 2007, in forum: Ruby
    Replies:
    4
    Views:
    155
    Eric Hodel
    Sep 10, 2007
  3. Dave Cottingham

    on ubuntu, ruby can't find the gems

    Dave Cottingham, Aug 16, 2008, in forum: Ruby
    Replies:
    3
    Views:
    129
    Dave Cottingham
    Aug 17, 2008
  4. Arunkumar Balu
    Replies:
    3
    Views:
    159
    Roger Pack
    Jan 23, 2009
  5. Alex 2k8

    Can't uninstall gems on Ubuntu

    Alex 2k8, May 27, 2009, in forum: Ruby
    Replies:
    6
    Views:
    217
    Eric Hodel
    May 30, 2009
Loading...

Share This Page