ruby compile with fPIC - ruby

I'm using ruby 1.9.3p392 through rbenv under Debian 7 and I'm trying to install the qtbindings gem so I can run an old ruby app which uses qt libs.
Here is the error I get when typing 'gem install qtbindings'
make[3]: Entering directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
[ 82%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/Qt.o
[ 82%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/handlers.o
[ 83%] Building CXX object ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/marshall_types.o
Linking CXX shared library libqtruby4shared.so
/usr/bin/ld: /usr/local/rbenv/versions/1.9.3-p392/lib/libruby-static.a(array.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/rbenv/versions/1.9.3-p392/lib/libruby-static.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [ruby/qtruby/src/libqtruby4shared.so.2.0.0] Error 1
make[3]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make[2]: *** [ruby/qtruby/src/CMakeFiles/qtruby4shared.dir/all] Error 2
make[2]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/ext/build'
make: *** [build] Error 2
Gem files will remain installed in /usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0 for inspection.
Results logged to /usr/local/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/qtbindings-4.8.3.0/./gem_make.out
I've installed the following requirements
sudo aptitude install cmake build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf xorg-dev libgl1-mesa-dev libglu1-mesa-dev qtcreator
How do I compile ruby with fPIC?
I've also tried 'gem install qtbindings -- -fPIC' but got the same error.

Try
#gem install qtbindings -- --with-cflags=\"-fPIC\"
Source:
Is there any way to change gcc compilation options for a gem?
Edited:
Yeah, gave another look to your code, my fault. The problem is with the installed ruby, not with the gem.
Look at this (Last post)
Try reinstalling ruby with shared libraries:
CONFIGURE_OPTS="--enable-shared" rbenv install 1.9.3-p392

Related

rbenv install 2.2.1 BUILD FAILED Ubuntu 16.04

Here is the error log
Downloading ruby-2.2.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.1.tar.bz2
Installing ruby-2.2.1...
WARNING: ruby-2.2.1 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (Ubuntu 16.04 using ruby-build 20181019-2-gd49b8a1)
Inspect or clean up the working tree at /tmp/ruby-build.20181025114001.11061
Results logged to /tmp/ruby-build.20181025114001.11061.log
Last 10 log lines:
make[2]: Leaving directory '/tmp/ruby-build.20181025114001.11061/ruby-2.2.1/ext/objspace'
installing default date_core libraries
installing default nkf libraries
linking shared-object nkf.so
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20181025114001.11061/ruby-2.2.1/ext/nkf'
make[2]: Leaving directory '/tmp/ruby-build.20181025114001.11061/ruby-2.2.1/ext/date'
make[1]: Leaving directory '/tmp/ruby-build.20181025114001.11061/ruby-2.2.1'
uncommon.mk:189: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
I'm not sure what to do here. I am new to rbenv. I try to fix this issues searching on google but nothing work also I've try to install apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
here is the complete log ruby-build.20181025125952.32167.log

How to install hadoop user environment (HUE) in Raspberry Pi-3?

When hue install on Raspberry pi ,get error .
/usr/local/hue-4.1.0/Makefile.sdk:120: recipe for target '/usr/local/hue-
4.1.0/desktop/core/build/cryptography-1.3.1/egg.stamp' failed
make[2]: *** [/usr/local/hue-4.1.0/desktop/core/build/cryptography-
1.3.1/egg.stamp] Error 1
make[2]: Leaving directory '/usr/local/hue-4.1.0/desktop/core'
Makefile:70: recipe for target '.recursive-env-install/core' failed
make[1]: *** [.recursive-env-install/core] Error 2
make[1]: Leaving directory '/usr/local/hue-4.1.0/desktop'
Makefile:73: recipe for target 'desktop' failed
make: *** [desktop] Error 2
I use Jessie as the new openssl libs in Stretch cause compile problems with Hadoop, so specifically this release:
http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-07-05/
You'll need to install the build dependencies, I use these (but they do include all the ones need for hadoop compilation too, so you could slim it down quite a bit)
apt-get install oracle-java8-jdk maven build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libfuse-dev libsnappy-dev libsnappy-java libbz2-dev python-dev libsasl2-dev libxml2-dev libxslt-dev libkrb5-dev libffi-dev libldap2-dev libmysqlclient-dev libsqlite3-dev libgmp3-dev libssl-dev
Then download, unpack and build hue 3.11.0
wget http://gethue.com/downloads/releases/3.11.0/hue-3.11.0.tgz
tar -zxvf hue-3.11.0.tgz
cd hue-3.11.0
make apps
I've tested this with 3.11, 3.12, 4.1 and 4.2 using the same build environment on the Pi-3.
If you are looking to build a full hadoop environment on the pi you might want to look at hadoopi:
https://github.com/andyburgin/hadoopi
The README has all the instructions on building and configuring a bunch of hadoop components in addition to Hue.
Andy

rbenv : BUILD FAILED when Install Ruby 2.2.3 on UBUNTU 14.04 (x86_64)

I am trying to install ruby 2.2.3, previously I have installed ruby 2.2.2,
rbenv versions
system
* 2.2.2 (set by /home/emen/.ruby-version)
jruby-1.7.20
jruby-9.0.0.0.pre2Build
I got a problem when tried to install Ruby 2.2.3, got build failed below :
rbenv install 2.2.3
Downloading ruby-2.2.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.bz2 Installing ruby-2.2.3...
BUILD FAILED (Ubuntu 14.04 using ruby-build 20160111-27-g06f1254)
Inspect or clean up the working tree at /tmp/ruby-build.20160127112741.26444 Results logged to /tmp/ruby-build.20160127112741.26444.log
I have inspected log, just copy a part of suspect since another checking and compiling process were fine :
linking shared-object objspace.so
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/objspace'
compiling ossl_ssl.c
make[2]: Entering directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/pathname'
compiling pathname.c
ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3),
^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:142:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/openssl'
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default pathname libraries
linking shared-object date_core.so
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/date'
linking shared-object pathname.so
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/pathname'
linking shared-object nkf.so
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/nkf'
make[1]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3'
make: *** [build-ext] Error 2
I have tried to follow this
rbenv install ruby BUILD FAILED
I have run this :
sudo apt-get install libffi-dev
or
sudo apt-get install git-core curl
zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev
python-software-properties libffi-dev
and
curl -fsSL https://gist.github.com/ekr1/7313abef4348daa038dd.txt |
rbenv install --patch 2.2.3
but still no luck, I might miss something, appreciating your help. Thanks!
I have fixed this build failed by patching from https://gist.github.com/mislav/055441129184a1512bb5/
executed this :
curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt |
rbenv install --patch 2.2.3
this looks like an openssl problem. The SSL_v3 not defined means that you don't have it or you have an older library.
Try:
rvm pkg install openssl
rvm install 2.2.3 --with-openssl-dir=$HOME/.rvm/usr

Unable to install Jekyll on Mac OSX 10.9.1 with xcode and rvm installed

Not having any luck installing Jekyll on Mac OSX 10.9.1
I have rvm installed and also Xcode 5.0.2.
When I run gem install jekyll it tells me...
Permission denied -
/Users/Vivid/.rvm/gems/ruby-1.9.2-p320/extensions/x86_64-darwin-12
I then ran sudo gem install jekyll and I then get:
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile
make clean
make
gcc-4.2 -I. -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin12.2.0 -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -I/Users/Vivid/.rvm/usr/include -fno-common -pipe -o porter.o -c porter.c
make: gcc-4.2: No such file or directory
make: *** [porter.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-12/1.9.1/fast-stemmer-1.0.2/gem_make.out
This is the contents of /Users/Vivid/.rvm/gems/ruby-1.9.3-p327/gems/fast-stemmer-1.0.2/ext/gem_make.out:
/Users/Vivid/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
creating Makefile
make
compiling porter.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [porter.o] Error 1
Something is clearly not right. Any advice would be magic, cheers.
You need to install gcc-4.2. Make sure you have Homebrew installed and run
brew install apple-gcc42
Make sure you see happy output when you run:
which gcc-4.2
Then try re-running:
sudo gem install jekyll
Boom! Installed.

Segmentation fault while compiling ruby 1.9.3p392 with OpenSSL 1.0.1e installed

I'm trying to have my Rails website running on my fresh installation of Mountain Lion Server. Not using RVM, because I don't need many rails or ruby installations. Configuring ruby and rails to run smoothly is a pain in the ass.
Compiled the newest version of OpenSSL with these commands:
sudo ./configure --prefix=/usr/local/ darwin64-x86_64-cc
sudo make
sudo make install
Now when I type I get this:
grid:ruby-1.9.3-p392 Clu$ openssl version
OpenSSL 1.0.1e 11 Feb 2013
When I try to configure Ruby from source, I get to Segmentation Fault:
compiling md5init.c
compiling md5ossl.c
linking shared-object digest/md5.bundle
installing default md5 libraries
compiling rmd160init.c
compiling rmd160ossl.c
linking shared-object digest/rmd160.bundle
installing default rmd160 libraries
compiling sha1init.c
compiling sha1ossl.c
linking shared-object digest/sha1.bundle
collect2: ld terminated with signal 11 [Segmentation fault: 11]
make[2]: *** [../../../.ext/x86_64-darwin12.2.1/digest/sha1.bundle] Error 1
make[1]: *** [ext/digest/sha1/all] Error 2
make: *** [build-ext] Error 2

Resources