Compile requirements of Ruby and Extensions

Discussion in 'Ruby' started by Markus Kolb, Apr 1, 2006.

  1. Markus Kolb

    Markus Kolb Guest

    Hi,

    is there anywhere a list what libs ruby and a extension needs to be
    configured and compiled?

    Thanks.
    Markus
    Markus Kolb, Apr 1, 2006
    #1
    1. Advertising

  2. --Apple-Mail-1-245096190
    Content-Transfer-Encoding: 7bit
    Content-Type: text/plain;
    charset=US-ASCII;
    delsp=yes;
    format=flowed


    On Apr 1, 2006, at 7:48 AM, Markus Kolb wrote:

    > is there anywhere a list what libs ruby and a extension needs to be
    > configured and compiled?


    Unfortunately, no. I dug around until I figured it out. See
    attached script for help.

    --Steve


    --Apple-Mail-1-245096190
    Content-Transfer-Encoding: 7bit
    Content-Type: application/octet-stream;
    x-unix-mode=0755;
    name="go.sh"
    Content-Disposition: attachment;
    filename=go.sh

    #!/bin/sh


    FETCH="fetch -ar"
    #FETCH="wget"
    #FETCH="curl -O"

    WORKDIR=`pwd`/work
    BOOTSTRAPDIR=`pwd`/bootstrap
    BUNDIR=`pwd`/bundle

    rm -rf build $BUNDIR $WORKDIR $BOOTSTRAPDIR

    mkdir -p build
    mkdir -p pkg
    mkdir -p $BUNDIR
    mkdir -p $WORKDIR
    mkdir -p $BOOTSTRAPDIR

    export LDFLAGS="-L$WORKDIR/lib"
    export CPPFLAGS="-I$WORKDIR/include"

    ORIGINAL_PATH="$PATH"
    export PATH="$WORKDIR/bin:$PATH"
    hash -r


    #################
    ## Downloads ##
    #################
    # can we auto download *latest* packages???
    cd pkg
    $FETCH ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
    $FETCH http://www.zlib.net/zlib-1.2.3.tar.gz
    $FETCH http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.1.tar.gz
    $FETCH http://www.openssl.org/source/openssl-0.9.8a.tar.gz
    $FETCH ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
    $FETCH ftp://ftp.gnu.org/gnu/gdbm/gdbm-1.8.3.tar.gz
    $FETCH http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz
    $FETCH http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
    cd ..


    cd build


    ###############
    ## ncurses ##
    ###############
    tar zxvf ../pkg/ncurses-5.5.tar.gz
    cd ncurses-5.5
    # build once so we can get the database and infocmp
    /configure \
    --prefix=$BOOTSTRAPDIR \
    --with-static \
    --with-shared \
    --without-debug \
    --without-profile \
    --without-ada && \
    make && \
    make install || exit 1
    OLD_PATH="$PATH"
    export PATH="$BOOTSTRAPDIR/bin:$PATH"
    hash -r
    # build a second time, except embed a few termcaps (needed db & infocmp 1st)
    FALLBACKS="ansi,linux,screen,screen-w,vt52,vt100,vt102,vt220,xterm,xterm-color,xterm-mono"
    /configure \
    --prefix=$WORKDIR \
    --with-static \
    --without-shared \
    --without-rpath \
    --without-debug \
    --without-profile \
    --without-ada \
    --without-progs \
    --disable-database \
    --with-fallbacks=$FALLBACKS && \
    make && \
    make install || exit 1
    export PATH="$OLD_PATH"
    hash -r
    cd ..


    ################
    ## readline ##
    ################
    tar zxvf ../pkg/readline-5.1.tar.gz
    cd readline-5.1
    /configure \
    --prefix=$WORKDIR \
    --enable-static \
    --disable-shared && \
    make && \
    make install || exit 1
    cd ..


    ############
    ## zlib ##
    ############
    tar zxvf ../pkg/zlib-1.2.3.tar.gz
    cd zlib-1.2.3/
    /configure \
    --prefix=$WORKDIR && \
    make && \
    make install || exit 1
    cd ..


    #############
    ## iconv ##
    #############
    tar zxvf ../pkg/libiconv-1.9.1.tar.gz
    cd libiconv-1.9.1/
    /configure \
    --prefix=$WORKDIR \
    --enable-static \
    --disable-shared \
    --disable-rpath && \
    make && \
    make install || exit 1
    cd ..


    ###############
    ## OpenSSL ##
    ###############
    # cannot link statically with openssl
    # conflicts with digest extension!!!

    #tar zxvf ../pkg/openssl-0.9.8a.tar.gz
    #cd openssl-0.9.8a/
    ## cannot build with zlib b/c ruby's ext mkmf fails to add -lz
    #./config \
    # --prefix=$WORKDIR \
    # --openssldir=$WORKDIR \
    # -L$WORKDIR/lib \
    # -I$WORKDIR/include \
    # no-shared \
    # no-asm && \
    #make && \
    #make install || exit 1
    #cd ..


    ############
    ## gdbm ##
    ############
    tar zxvf ../pkg/gdbm-1.8.3.tar.gz
    cd gdbm-1.8.3/
    /configure \
    --prefix=$WORKDIR \
    --enable-static \
    --disable-shared && \
    make && \
    make install BINOWN=$USER BINGRP=$GROUP && \
    make install-compat BINOWN=$USER BINGRP=$GROUP || exit 1
    cd ..


    ############
    ## Ruby ##
    ############
    tar zxvf ../pkg/ruby-1.8.4.tar.gz
    cd ruby-1.8.4
    /configure \
    --prefix=$BUNDIR \
    --enable-static \
    --disable-shared \
    --disable-rpath \
    --with-static-linked-ext \
    --enable-install-doc \
    --with-curses-dir=$WORKDIR \
    --with-dbm-dir=$WORKDIR \
    --with-gdbm-dir=$WORKDIR \
    --with-iconv-dir=$WORKDIR \
    --with-openssl-dir=$WORKDIR \
    --with-readline-dir=$WORKDIR \
    --with-zlib-dir=$WORKDIR && \
    make && \
    make install || exit 1
    cd ..


    ##############################
    ## Setup Ruby Environment ##
    ##############################
    export PATH="$BUNDIR/bin:$ORIGINAL_PATH"
    hash -r


    ########################
    ## Install RubyGems ##
    ########################
    tar xzvf ../pkg/rubygems-0.8.11.tgz
    cd rubygems-0.8.11
    ruby setup.rb
    cd ..


    ############
    ## Gems ##
    ############
    tar xzvf ../pkg/rubygems-0.8.11.tgz
    gem update --system -y
    gem install rails -y
    gem install capistrano -y


    cd ..

    echo "Bundle complete!"


    --Apple-Mail-1-245096190--
    Stephen Waits, Apr 1, 2006
    #2
    1. Advertising

  3. Ruby seems to have very few dependencies. On my ruby 1.8.4 / linux
    system it seems to require openssl for ruby itself and readline, zlib,
    ncurses and gdbm for the standard libraries and other tools. Obviously
    different platforms may have alternatives to these libraries instead.
    Timothy Goddard, Apr 2, 2006
    #3
  4. Markus Kolb

    Markus Kolb Guest

    Timothy Goddard wrote:
    > Ruby seems to have very few dependencies. On my ruby 1.8.4 / linux
    > system it seems to require openssl for ruby itself and readline, zlib,
    > ncurses and gdbm for the standard libraries and other tools. Obviously
    > different platforms may have alternatives to these libraries instead.
    >


    But that is not the end. Tk needs libtk,libtcl...
    It tries to find and link with e.g. libtermcap and I don't know if it is
    bad or ok if this fails.
    Then I think there are replacements in Ruby script if some libs are
    missing. These script replacements are of course slower in execution as
    the binary code.
    Shouldn't the make test check if the compilation was successful?
    I've done a small C-file patch and lib/ruby/1.8/(arch)/socket.so got not
    build.
    The make all, make install and make test doesn't abort.
    So I don't know if everything is in place after make install.
    Or if it could happen that anytime in the future I use some feature and
    Ruby misses a file to do its work. Or if my build is fine or it could be
    done better.

    It would be a very simple work for developers during development to note
    the libs they try to link with.

    Then I am missing --enable/disable-features in configure.
    Markus Kolb, Apr 2, 2006
    #4
    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. Replies:
    2
    Views:
    407
    John Carter
    Jan 10, 2005
  2. Guest
    Replies:
    1
    Views:
    239
    Peter Notebaert
    Nov 5, 2005
  3. Nagaraj
    Replies:
    1
    Views:
    840
    Lionel B
    Mar 1, 2007
  4. Michael George

    using distutils to cross-compile extensions?

    Michael George, Dec 4, 2008, in forum: Python
    Replies:
    1
    Views:
    528
    Michael 'Mickey' Lauer
    Dec 11, 2008
  5. Joana
    Replies:
    4
    Views:
    913
    Joshua Kugler
    May 26, 2009
Loading...

Share This Page