How to install gbarcode gem to Ubuntu? - ruby

I've problem with gbarcode gem which has dependency gnu-barcode c application.
When trying to say gem install gbarcode it says:
Building native extensions. This could take a while...
ERROR: Error installing gbarcode-linux:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb
checking for main() in -lbarcode... yes
creating Makefile
make
gcc -I. -I. -I/home/user/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/1.8/x86_64-linux -I. -fPIC -g -O2 -fPIC -c barcode_wrap.c
gcc -shared -o gbarcode.so barcode_wrap.o -L. -L/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -Wl,-R/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -L/home/user/.rvm/rubies/ruby-1.8.7-p357/lib -lruby -lbarcode -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libbarcode.a(library.o): relocation R_X86_64_32 against `encodings' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libbarcode.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [gbarcode.so] Error 1
I've tried to install gnu-barcode application from ubuntu software center, apt-get and directly from source http://www.gnu.org/software/barcode/ and the response is always the same.
How should I install gnu barcode so that it's working with the gem.
And yes this project is quite heavy dependent on that gem so replacing it would be really painful to all parties.

Related

Gem build "recipe for target 'stemmer.so' failed"

When installing Jekyll from gem using gem install jekyll, I am getting the following build error. I am using Cygwin on Windows 7 and have built the posix-spawn gem from source prior to installing.
Building native extensions. This could take a while...
ERROR: Error installing jekyll-1.1.2.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -ggdb -O2 -pipe -fno-strict-aliasing -o porter.o -c porter.c
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -ggdb -O2 -pipe -fno-strict-aliasing -o porter_wrap.o -c porter_wrap.c
rm -f stemmer.so
gcc -shared -o stemmer.so porter.o porter_wrap.o -L. -L/usr/lib -L. -Wl,--export-all-symbols -Wl,--enable-auto-image-base,--enable-auto-import -lruby191 -lpthread -lrt -ldl -lcrypt
/usr/lib/gcc/x86_64-pc-cygwin/4.8.1/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcrypt
collect2: error: ld returned 1 exit status
Makefile:214: recipe for target `stemmer.so' failed
make: *** [stemmer.so] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2/ext/gem_make.out
I am using gem v2.0.7, ruby v1.9.3p448, gcc v4.8.1 and g++ v4.8.1
Any ideas? I have no idea when it comes to Ruby gems. I cannot find any information on this "stemmer".
Dan
Turns out the crux of this error was in the cannot find -lcrypt. I installed libcrypt-devel and the gem compiled fine after that.
I think on most native Linux distros, this lib will already be included!
Yeah, Thanks, I installed :-).
Please installing 'libcrypt-devel' in cygwin

Bundler halts on json install, even though there's no json in Gemfile

Project bundle is stopping with error on json installation. But I'm not asking for json in Gemfile. Current Ruby in RVM is 1.9.2-p290, strict.
Have no idea to workaround this. Any helps, maybe?
Installing json (1.7.7)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make
xcrun cc -I. - I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c generator.c
xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory)
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle generator.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl -lobjc
i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/ft/gswz6cs52wb9jh_v5h2yt5_h0000gn/T//ccvGNawc.out
make: *** [generator.bundle] Error 1
Gem files will remain installed in /Users/noAlvaro/.rvm/gems/ruby-1.9.2-p290#heroku_project/gems/json-1.7.7 for inspection.
Results logged to /Users/noAlvaro/.rvm/gems/ruby-1.9.2-p290#heroku_project/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Any help, anything, will be much appreciated. :)
Even if you don't explicitly list json as dependency, other gems you are using may do this. As a result, Bundler will include it in the bundled list.
To check which library is using json you can inspect the Gemfile.lock file or use bundle viz to draw your dependency tree.

install curb gem on Ruby

I'm getting this error when trying to install curb on my Mac:
/usr/bin/gcc-4.2 -dynamic -bundle -o curb_core.bundle curb.o curb_easy.o curb_errors.o curb_multi.o curb_postfield.o curb_upload.o -L. -L/Users/user/.rvm/rubies/ruby-1.9.2-p318/lib -L/Users/user/.rvm/usr/lib -L. -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpthread -ldl -lobjc -lcurl
ld: in /usr/local/lib/libssl.0.9.8.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make: *** [curb_core.bundle] Error 1
Any suggestions?
seems you need to have 64 bit openssl
check this
Trouble installing pg gem

ld cannot find -l<library>

I am having trouble installing pyipopt on ubuntu 12.04. During linking, I receive the error:
/usr/bin/ld: cannot find -lcoinhsl
Even though I know that this library is installed and the .so and .la files are available in /home/mostafa/MyBuilds/CoinIpopt/build/lib/
does anyone have a solution for this?
below is the complete return of running setup.py build:
root#ubuntu:~/MyBuilds/pyipopt# sudo python setup.py build
running build
running build_ext
building 'pyipopt' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/callback.c -o build/temp.linux-x86_64-2.7/src/callback.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/home/mostafa/MyBuilds/CoinIpopt/build/include/coin/ -I/usr/include/python2.7 -c src/pyipopt.c -o build/temp.linux-x86_64-2.7/src/pyipopt.o
src/pyipopt.c: In function ‘set_intermediate_callback’:
src/pyipopt.c:452:15: warning: variable ‘myowndata’ set but not used [-Wunused-but-set-variable]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relrobuild/temp.linux-x86_64-2.7/src/callback.o build/temp.linux-x86_64-2.7/src/pyipopt.o -L/home/mostafa/MyBuilds/CoinIpopt/build/lib/ -lipopt -lblas -lcoinhsl -lcoinmetis -llapack -ldl -lm -o build/lib.linux-x86_64-2.7/pyipopt.so -Wl,--rpath -Wl,/home/mostafa/MyBuilds/CoinIpopt/build/lib/
/usr/bin/ld: cannot find -lcoinhsl
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
-Ldir
Add directory dir to the list of directories to be searched for -l.
You may install your coinhsl library in one of your standard libraries directories and run 'ldconfig` before doing your ppyipopt install
I had a similar problem with another library and the reason why it didn't found it, was that I didn't run the make install (after running ./configure and make) for that library. The make install may require root privileges (in this case use: sudo make install). After running the make install you should have the so files in the correct folder, i.e. here /usr/local/lib and not in the folder mentioned by you.
you can add the Path to coinhsl lib to LD_LIBRARY_PATH variable. May be that will help.
export LD_LIBRARY_PATH=/xx/yy/zz:$LD_LIBRARY_PATH
where /xx/yy/zz represent the path to coinhsl lib.

ERROR while installing rb-appscript

Got a big problem installing rb-appscript.
I already installed the latest Version of xCode & I'm running Lion.
Hope you can help me, thanks a lot!
This is the Error Message:
sudo gem install rb-appscript
Building native extensions. This could take a while...
ERROR: Error installing rb-appscript:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
create /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/src/osx_ruby.h ...
create /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/src/osx_intern.h ...
creating Makefile
make
Makefile:188: warning: overriding commands for target `/usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/lib'
Makefile:182: warning: ignoring old commands for target `/usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/lib'
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -Isrc -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -Wall -c src/rbae.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -Isrc -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -Wall -c src/SendThreadSafe.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o ae.bundle rbae.o SendThreadSafe.o -L. -L/usr/local/lib -L. -framework Carbon -framework ApplicationServices -lruby -lpthread -ldl -lobjc
ld: warning: ignoring file /usr/local/lib/libruby.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: in /usr/local/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64
collect2: ld returned 1 exit status
make: *** [ae.bundle] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/./gem_make.out
Seems like something is wrong with your Ruby install. It complains about a wrong architecture here
ld: warning: ignoring file /usr/local/lib/libruby.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: in /usr/local/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64
Be sure your ruby is installed right. For a super-easy Ruby installation, I would recommend the Ruby Version Manager -> https://rvm.io

Resources