Friday, March 8, 2013

gem install bson_ext issue

root@FSAllInOne:/opt/scanjobs# gem install bson_ext
Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
        ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for asprintf()... yes
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile

make
compiling encoding_helpers.c
compiling bson_buffer.c
compiling cbson.c
cbson.c: In function âpack_extraâ:
cbson.c:184:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cbson.c: In function âwrite_elementâ:
cbson.c:194:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cbson.c: In function âobjectid_generateâ:
cbson.c:999:9: warning: implicit declaration of function âhtonlâ [-Wimplicit-function-declaration]
cbson.c:1007:5: warning: implicit declaration of function âhtonsâ [-Wimplicit-function-declaration]
cbson.c: In function âwrite_elementâ:
cbson.c:300:17: warning: ignoring return value of âasprintfâ, declared with attribute warn_unused_result [-Wunused-result]
linking shared-object bson_ext/cbson.so

make install
/usr/bin/install -c -m 0755 cbson.so /usr/local/rvm/gems/ruby-2.0.0-p0/gems/bson_ext-1.8.3/ext/bson_ext/bson_ext
/usr/bin/install: cannot create regular file `/usr/local/rvm/gems/ruby-2.0.0-p0/gems/bson_ext-1.8.3/ext/bson_ext/bson_ext': No such file or directory
make: *** [install-so] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p0/gems/bson_ext-1.8.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p0/gems/bson_ext-1.8.3/ext/cbson/gem_make.out

======================================================================

solution:
I reinstall ruby 1.9.3 and it worked
http://www.ruby-lang.org/en/news/2013/02/22/ruby-1-9-3-p392-is-released/
1234  cd ruby-1.9.3-p392/
 1236  ./configure
 1237  make
 1238  make install
 1249  gem install bson_ext

gem install qpid failure - ubuntu

need:

apt-get install libxml2 libxml2-dev
gem install libxml-ruby

Monday, March 4, 2013

mongodb ensureIndex not working

> db.FileScan_files.ensureIndex({md5:1},{unique:true})
> db.FileScan_files.insert({md5:""})
> db.FileScan_files.insert({md5:""})


md5 is a bad name for mongodb
MongoDB speaks JavaScript, so utilize JS naming conventions.

> db.FileScan_files.ensureIndex({md:1},{unique:true})
> db.FileScan_files.insert({md:""})
> db.FileScan_files.insert({md:""})
E11000 duplicate key error index: filescan.FileScan_files.$md_1  dup key: { : "" }