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

opa on 32 bit (x86) installs 64bit mongodb (x86_64) #117

Open
vagn opened this issue Mar 31, 2013 · 2 comments
Open

opa on 32 bit (x86) installs 64bit mongodb (x86_64) #117

vagn opened this issue Mar 31, 2013 · 2 comments

Comments

@vagn
Copy link

vagn commented Mar 31, 2013

opa on 32bit installs downloads and tries to use 64 bit mongodb, which of course won't run. Opa needs to do achiteceture test and download correct mongodb archive.

from git clone, 31 march 2013

$ file ~/.opa/mongo/mongodb-linux-x86_64-2.0.2/bin/mongod
/home/xxx/.opa/mongo/mongodb-linux-x86_64-2.0.2/bin/mongod: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, BuildID[sha1]=0x7e7334603bc2d846a3bd188770a0b0ae11e7bb42, stripped

$ file /usr/local/lib/opa/bin/opa-bin
/usr/local/lib/opa/bin/opa-bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x1da301dcb41caada4ceeff80e2429bcddb08f028, not stripped
vagn@kara04:~$

@vagn
Copy link
Author

vagn commented Mar 31, 2013

Built on ubuntu 12.04 LTS using this script (which works fine on 64 bit):

set -eux

mkdir -p logs

if true ; then

    aptitude update

    # interactive stuff first
    aptitude -y install bsd-mailx

    aptitude -y upgrade

    aptitude -y install build-essential g++ \
        libgrafx11-1-dev libx11-dev tk-dev libbfd-dev \
        git m4 default-jdk subversion \
        libcurl4-gnutls-dev python-pycurl python-pycurl-dbg \
        python-software-properties unattended-upgrades \
        rlwrap

fi

if [ ! -f /usr/local/bin/ocaml ] ; then

    name=ocaml-4.00.1
    archive=$name.tar.gz
    f=http://caml.inria.fr/pub/distrib/ocaml-4.00/$archive

    [ ! -f $archive ] && wget -np -nd $f
    [ ! -d $name ] && tar xzf $archive

    ( cd $name && ./configure ) | tee logs/$name.config
    ( cd $name && make world.opt ) | tee logs/$name.make
    ( cd $name && umask 022 && make install ) | tee logs/$name.install

fi

if [ ! -f /usr/local/bin/npm ] ; then

    node_name=node-v0.8.9
    node_archive=$node_name.tar.gz

    [ ! -f $node_archive ] && wget -np -nd http://nodejs.org/dist/v0.8.9/$node_archive
    [ ! -d $node_name ] && tar xzf $node_archive

    ( cd $node_name && ./configure ) | tee logs/node_name.config
    ( cd $node_name && make ) | tee logs/node_name.make
    ( cd $node_name && make install ) | tee logs/node_name.install

fi

if [ ! -f /usr/local/etc/findlib.conf ] ; then

    findlib_name=findlib-1.3.3
    findlib_archive=$findlib_name.tar.gz

    [ ! -f $findlib_archive ] && wget -np -nd http://download.camlcity.org/download/$findlib_archive
    [ ! -d $findlib_name ] && tar xzf $findlib_archive

    ( cd $findlib_name && ./configure -with-toolbox -sitelib /usr/local/lib/ocaml/site-lib ) | tee logs/$findlib_name.config

    ( cd $findlib_name && make all ) | tee logs/$findlib_name.make-all
    ( cd $findlib_name && make opt ) | tee logs/$findlib_name.make-opt
    ( cd $findlib_name && make install ) | tee logs/$findlib_name.make-install

fi

if [ ! -f /usr/local/lib/ocaml/site-lib/ulex/META ] ; then

    ulex_name=ulex-1.1
    ulex_archive=$ulex_name.tar.gz

    [ ! -f $ulex_archive ] && wget -nd -np http://www.cduce.org/download/$ulex_archive
    [ ! -d $ulex_name ] && tar xzf $ulex_archive

    ( cd $ulex_name && make all ) | tee logs/$ulex_name.make-all
    ( cd $ulex_name && make doc ) | tee logs/$ulex_name.make-doc
    ( cd $ulex_name && make all.opt ) | tee logs/$ulex_name.make-opt
    ( cd $ulex_name && make install ) | tee logs/$ulex_name.make-install

fi

if [ ! -f /usr/local/lib/ocaml/site-lib/zip/META ] ; then

    camlzip_name=camlzip-1.05
    camlzip_archive=$camlzip_name.tar.gz

    [ ! -f $camlzip_archive ] && wget -np -nd http://forge.ocamlcore.org/frs/download.php/1037/$camlzip_archive
    [ ! -d $camlzip_name ] && tar xzf $camlzip_archive

    ( cd $camlzip_name && make all ) | tee logs/$camlzip_name.make-all
    ( cd $camlzip_name && make allopt ) | tee logs/$camlzip_name.make-allopt
    ( cd $camlzip_name && make install ) | tee logs/$camlzip_name.make-install
    ( cd $camlzip_name && make installopt ) | tee logs/$camlzip_name.make-installopt        # if you did "make allopt" earlier
    ( cd $camlzip_name && make install-findlib ) | tee logs/$camlzip_name.make-instasll-findlib   # to install using ocamlfind

fi

if [ ! -f /usr/local/lib/ocaml/site-lib/ocamlgraph/META ] ; then

    ocamlgraph_name=ocamlgraph-1.8.2
    ocamlgraph_archive=$ocamlgraph_name.tar.gz

    [ ! -f $ocamlgraph_archive ] && wget -nd -np http://ocamlgraph.lri.fr/download/$ocamlgraph_archive
    [ ! -d $ocamlgraph_name ] && tar xzf $ocamlgraph_archive

    ( cd $ocamlgraph_name && ./configure ) | tee logs/$ocamlgraph_name.make-configure
    ( cd $ocamlgraph_name && make ) | tee logs/$ocamlgraph_name.make
    ( cd $ocamlgraph_name && make doc ) | tee logs/$ocamlgraph_name.make-doc
    ( cd $ocamlgraph_name && make install ) | tee logs/$ocamlgraph_name.make-install
    ( cd $ocamlgraph_name && make install-findlib ) | tee logs/$ocamlgraph_name.make-install-findlib

fi

if [ ! -f /usr/local/bin/opa ] ; then

    [ ! -d opalang ] && git clone https://github.com/MLstate/opalang.git
    ( cd opalang && git pull )

    ( cd opalang && ./configure ) | tee logs/opalang.configure
    ( cd opalang && make ) | tee logs/opalang.make
    ( cd opalang && make install ) | tee logs/opalang.make-install

    ( cd /usr/local/bin && rm -f nodejs && ln -s node nodejs )

fi

@vagn
Copy link
Author

vagn commented Mar 31, 2013

I'm using the workaround below, basically sticking my own mongodb download in place and fooling opa into accepting it. Ugly, but it works. Updates to these scripts will be posted at

http://agawamtech.com/blog/2013/03/opa-from-source-on-ubuntu-12-04-lts/.

if anyone is interested.

#! /bin/bash

set -xeu

if [ =f /tmp/opaMongo.pid ] ; then
    # clean up in case you want to run script a 2nd time
    sudo fuser -k -TERM ~/.opa/mongo/*/bin/mongod || true
    rm -f /tmp/opaMongo.pid
fi

[ ! -f mongodb-linux-x86_64-2.0.2.tgz ] &&
    wget -nd -np http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.2.tgz

[ ! -f mongodb-linux-i686-static-2.0.2.tgz ] &&
    wget -nd -np http://downloads.mongodb.org/linux/mongodb-linux-i686-static-2.0.2.tgz

d=~/.opa/mongo
rm -rf $d
mkdir -p $d

# get both versions in place, the one we want, and the one opa thinks it wants
cp mongodb-linux-x86_64-2.0.2.tgz mongodb-linux-i686-static-2.0.2.tgz $d

cd $d

# unpack the one we want
tar xzf mongodb-linux-i686-static-2.0.2.tgz

# persuade opa  to see it our way
ln -s mongodb-linux-i686-static-2.0.2 mongodb-linux-x86_64-2.0.2

find $d

exit 0

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

No branches or pull requests

1 participant