[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1754
  • Last Modified:

How to recompileRuby with -fPIC on SuSE 10 SLES?

Hi,
I'm trying to recompile Ruby 1.8.6:
tar zxvf ruby-1.8.6.tar.gz
./configure --prefix=/usr
make
sudo make install

Recompilcation fails with the following message:
.... (lines deleted)
gcc -shared -rdynamic -Wl,-export-dynamic   -L'../../..' -o ../../../.ext/x86_64-linux/digest/md5.so md5init.o md5ossl.o  -lcrypto  -ldl -lcrypt -lm   -lc
/usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib/libcrypto.a(md5_dgst.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcrypto.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [../../../.ext/x86_64-linux/digest/md5.so] Error 1
make[1]: Leaving directory `/home/user/migration/soft/ruby-1.8.6/ext/digest/md5'
make: *** [all] Error 1
user@epf:~/migration/soft/ruby-1.8.6>

I would like some help with getting this recompiled. The reason I want to recompile is because I just installed openssl. This was not working in Ruby, I got message no such file to load -- openssl

I installed openssl with
   1.  wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
   2. Gunzip and tar file: gunzip openssl-0.9.8e.tar.gz; tar xvf openssl-0.9.8e.tar
   3. Configure: ./config --prefix=/usr/local --openssldir=/usr/local/openssl
   4. Make, Make test, Make install: make; make test; sudo make install
This btw installed fine.

So I need to install with -fPIC. How do I do that?
Thanks and Regards,
Onno
0
ostraaten
Asked:
ostraaten
  • 9
  • 4
2 Solutions
 
fridomCommented:
Often you can do  something like this
CFLAGS=-fPic and this is picked up then. Or maybe better:
run ./configure --help and see what you have to to to  add this flag.

If all goes wrong just  run configure as you did and after that check the Makfile
there should be some line containing CFLAGS if  the -fPIC flag is not there you can add it simply to this line

Regards
Friedrich
0
 
ostraatenAuthor Commented:
This outputs the following

user@epf:~/migration/soft/ruby-1.8.6> ./configure --prefix=/usr CFLAGS=-fPic
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
user@epf:~/migration/soft/ruby-1.8.6>
0
 
ostraatenAuthor Commented:
Config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure --prefix=/usr CFLAGS=-fPic

## --------- ##
## Platform. ##
## --------- ##

hostname = epf
uname -m = x86_64
uname -r = 2.6.16.21-0.8-xen
uname -s = Linux
uname -v = #1 SMP Mon Jul 3 18:25:39 UTC 2006

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /home/user/packages/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/X11R6/bin
PATH: /bin
PATH: /usr/games
PATH: /opt/gnome/bin
PATH: /usr/lib/mit/bin
PATH: /usr/lib/mit/sbin
PATH: .


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1892: checking build system type
configure:1910: result: x86_64-unknown-linux-gnu
configure:1932: checking host system type
configure:1947: result: x86_64-unknown-linux-gnu
configure:1969: checking target system type
configure:1984: result: x86_64-unknown-linux-gnu
configure:2245: checking for gcc
configure:2261: found /usr/bin/gcc
configure:2272: result: gcc
configure:2510: checking for C compiler version
configure:2517: gcc --version >&5
gcc (GCC) 4.1.0 (SUSE Linux)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2520: $? = 0
configure:2527: gcc -v >&5
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp --enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.0 (SUSE Linux)
configure:2530: $? = 0
configure:2537: gcc -V >&5
gcc: '-V' option must have argument
configure:2540: $? = 1
configure:2563: checking for C compiler default output file name
configure:2590: gcc -fPic   conftest.c  >&5
cc1: error: unrecognized command line option "-fPic"
configure:2593: $? = 1
configure:2631: result:
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2638: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=-fPic
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_YACC_set=
ac_cv_env_YACC_value=
ac_cv_env_YFLAGS_set=
ac_cv_env_YFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-unknown-linux-gnu
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=x86_64-unknown-linux-gnu

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALLOCA=''
AR=''
ARCHFILE=''
ARCH_FLAG=''
AS=''
ASFLAGS=''
CC='gcc'
CCDLFLAGS=''
CFLAGS='-fPic'
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
CP=''
CPP=''
CPPFLAGS=''
CPPOUTFILE=''
DEFS=''
DLDFLAGS=''
DLDLIBS=''
DLEXT2=''
DLEXT=''
DLLWRAP=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENABLE_SHARED=''
EXEEXT=''
EXPORT_PREFIX=''
EXTOUT=''
EXTSTATIC=''
GNU_LD=''
GREP=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LDFLAGS=''
LDSHARED=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_SO=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='1'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MINIOBJS=''
MINIRUBY=''
MINOR='8'
NM=''
NROFF=''
OBJDUMP=''
OBJEXT=''
OUTFLAG=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PREP=''
RANLIB=''
RDOCTARGET=''
RM=''
RPATHFLAG=''
RUBYW_INSTALL_NAME=''
RUBY_INSTALL_NAME=''
RUBY_SO_NAME=''
RUNRUBY=''
SET_MAKE=''
SHELL='/bin/sh'
SOLIBS=''
STATIC=''
STRIP=''
TEENY='6'
TRY_LINK=''
WINDRES=''
XCFLAGS=''
XLDFLAGS=''
YACC=''
YFLAGS=''
ac_ct_CC='gcc'
arch=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
configure_args=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-unknown-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr'
program_transform_name='s&^&&'
psdir='${docdir}'
rubyw_install_name=''
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitedir=''
sysconfdir='${prefix}/etc'
target='x86_64-unknown-linux-gnu'
target_alias=''
target_cpu='x86_64'
target_os='linux'
target_vendor='unknown'

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""

configure: exit 77
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ostraatenAuthor Commented:
Maybe another flag?

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  YACC        The `Yet Another C Compiler' implementation to use. Defaults to
              the first program found out of: `bison -y', `byacc', `yacc'.
  YFLAGS      The list of arguments that will be passed by default to $YACC.
              This script will default YFLAGS to the empty string to avoid a
              default value of `-d' given by some make applications.
0
 
fridomCommented:
The switch has to be -fPIC

Please try and let us know how it works

Regards
Friedrich
0
 
ostraatenAuthor Commented:
I'm afraid this is just not my cup of tea.

What command line should I enter?

Thanks and Regards,
Onno
0
 
ostraatenAuthor Commented:
I found this on the internet, it looks relevant for my problem

http://archives.free.net.ph/message/20081103.221037.4ff838eb.fr.html

I'll try to change the command line using those instructions and/or change my make file.
0
 
ostraatenAuthor Commented:
Based on information I found on the internet I think I was also missing the library openssl-devel so I installed that:

sudo rpm -ivh openssl-devel-0.9.8a-18.10.i586.rpm

This installed successfully but didn't fix my problem. Now I'm thinking I used the wrong RPM, my machine is x86_64, I later found a more suitable one http://rpm2html.osmirror.nl/white-box-linux/4/en/os/x86_64/WhiteBox/RPMS/openssl-devel-0.9.7a-43.1.x86_64.html.

Should I remove and reinstall this openssl library using the right RPM? Does it matter? Could it maybe fix my problem?
0
 
fridomCommented:
Well you write this:
./configure --prefix=/usr CFLAGS=-fPIC

Of course you have to check how many bits you like to have. You should not  explicitly
choose the platform but  jus the generic one maybe something like
sudo rpm -ivh openssl-devel.....
However I avoid rpms as a plagues so I can't tell  what the proper installation command is

Regards
Friedrich
0
 
ostraatenAuthor Commented:
This comment about avoiding rpms is interesting for a beginner like me.

What do you do if you don't use RPM's. You only use yast?

Thanks and Regards,
Onno
0
 
fridomCommented:
Well to be honest I do not use either RedHat or Suse. I'm using Debian exclusivly since 1998 and am not willing to try anything else any longer. I once thought I've to support some Linux Vendors and spend quite some  money on  distrubutions but in the end they are all beaten by Debian. Especially the package management in Debian is one of the best of all OSes I ever had the  chance to  use.

But this is off-topic here and does not help you  bit. I just wonder if the command line I suggested has worked for you.

Regards
Friedrich
0
 
ostraatenAuthor Commented:
Cool! I totally understand. As it turns out this does help me a little bit. I also prefer Debian. Suse was given to me by the organization (Eclipse Foundation) that is hosting my virtual machine. Maybe it is the OS of their choice. if I can't get this Suse distro to work I'm going to request a replacement and then I will also ask for Debian. Maybe they don't mind giving me that.

But first I'm going to try again to fix this with the suggestions you provided.
Thanks,
Onno
0
 
ostraatenAuthor Commented:
I think the message about the unknow build system is a clue:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu

It means I think that I'm using a RPM not suitable for x86_64. I found another RPM for my arch and now it is working fine.

    * openssl-devel-0.9.7a-43.1 RPM for x86_64
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 9
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now