Unable to install the Crypt-SSLeay module - perl

I'm creating a web application that requires the use of the perl module Crypt-SSLeay. This module has a dependency of needing OpenSSL headers. Since my Linux server has neither I went through these steps to install, but I'm receiving an error that's hard to understand (see below) because of my limited experience.
Server Information:
Running Oracle Enterprise Linux
Linux version 2.6.18-194.11.4.0.1.el5 (mockbuild#ca-build9.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48))
Steps to replicate the issue:
Downloaded and extracted openssl 0.9.8r from here and ran the following commands (after going to the directory)
./config --openssldir=/usr/local/openssl
make
make test
sudo make install
Downloaded and extracted the Crypt-SSLeay module from here and then ran the following commands (after going to the directory)
perl Makefile.PL
make
I receive the following error after I run "make":
BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8r in /usr/local/openssl
ssl header: openssl/ssl.h
libraries: -L/usr/local/openssl/lib -lssl -lcrypto -lgcc
include dir: -I/usr/local/openssl/include
================================================
Note (probably harmless): No library found for -lgcc
Writing Makefile for Crypt::SSLeay
The test suite can attempt to connect to public servers
to ensure that the code is working properly. If you are
behind a strict firewall or have no network connectivity,
these tests may fail (through no fault of the code).
Do you want to run the live tests (y/N)? [N]
-bash-3.2$ make
gcc -c -I/usr/local/openssl/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.58\" -DXS_VERSION=\"0.58\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" SSLeay.c
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_new’:
SSLeay.c:118: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__Conn_new’:
SSLeay.c:395: warning: unused variable ‘packname’
SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_use_pkcs12_file’:
SSLeay.c:287: warning: ‘RETVAL’ may be used uninitialized in this function
Running Mkbootstrap for Crypt::SSLeay ()
chmod 644 SSLeay.bs
rm -f blib/arch/auto/Crypt/SSLeay/SSLeay.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic SSLeay.o -o blib/arch/auto/Crypt/SSLeay/SSLeay.so \
-L/usr/local/openssl/lib -lssl -lcrypto \
/usr/bin/ld: /usr/local/openssl/lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Crypt/SSLeay/SSLeay.so] Error 1
I'm not sure what I need to do when I recompile OpenSSL to get this module to work. Any help appreciated.

That looks like an error in the OpenSSL build itself. Are you sure your distribution doesn't provide the OpenSSL headers? (And i'm sure you already had the libraries, right?)
The headers are in a package called "openssl-devel" on RedHat IIRC, should be the same for Oracle Enterprise Linux (I guess, never used that).
If you do find the headers in your distro's packages, don't forget to un-install your custom build (remove the files manually if the OpenSSL Makefile doesn't have an uninstall target).

Related

Error When Installing DBI Perl Module

Here is my output, any suggestions? I've tried installing by perl -MCPAN -e shell and then force install DBI.
cpan[10]> force install DBI
Running install for module 'DBI'
Running make for T/TI/TIMB/DBI-1.636.tar.gz
Has already been unwrapped into directory /root/.cpan/build/DBI-1.636-sGWX9V
CPAN.pm: Building T/TI/TIMB/DBI-1.636.tar.gz
gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DVERSION=\"1.636\" -DXS_VERSION=\"1.636\" -fPIC "-I/usr/lib64/perl5/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c
/bin/sh: gcc: command not found
make: *** [Perl.o] Error 127
TIMB/DBI-1.636.tar.gz
/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
TIMB/DBI-1.636.tar.gz : make NO
The error message:
/bin/sh: gcc: command not found
so you need to install gcc
As you have already seen, installing gcc will fix the problem.
But I wonder why you don't use the pre-packaged version.
$ sudo yum install perl-DBI
Also, do you realise that Fedora 20 is now unsupported? I strongly suggest that you upgrade to a supported version (Fedora 24 or 25).

requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

I'm building a gst-plugin through yocto 1.6. I've linaro 4.9 cross toolchain of 32 and 64-bit.
When I'm building the plugin using 64-bit toolchain, it was success ( I got the plugin .so file) whereas if I build the same source using 32-bit toolchain I got the below error
/home/build-directory/tmp/sysroots/x86_64-linux/usr/libexec/cortexa8hf-vfp-neon-rdk-linux-gnueabi/gccgcc/arm-rdk-linux-gnueabi/4.9.4/ld: error: .libs/libgstpluginxxx_la-gstpluginxxx.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
here the whole error
./arm-rdk-linux-gnueabi-libtool --tag=CC --tag=disable-static --mode=link arm-rdk-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -fno-omit-frame-pointer -fno-optimize-sibling-calls --sysroot=/home/sysroots/path -pthread -I/home/sysroots/path/usr/include/gstreamer-1.0 -I/home/sysroots/path/usr/include/glib-2.0 -I/home/sysroots/path/usr/lib/glib-2.0/include -O2 -pipe -g -feliminate-unused-debug-types -fPIC -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o libgstpluginxxx.la -rpath /usr/lib/gstreamer-1.0 libgstpluginxxx_la-gstpluginxxx.lo -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0
arm-rdk-linux-gnueabi-libtool: link: arm-rdk-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -enable-shared -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -fno-omit-frame-pointer -fno-optimize-sibling-calls --sysroot=/home/sysroots/path -shared -fPIC -DPIC .libs/libgstpluginxxx_la-gstpluginxxx.o /home/sysroots/path/usr/lib/libgstreamer-1.0.so -L/home/sysroots/path/usr/lib /home/sysroots/path/usr/lib/libgmodule-2.0.so -lm -ldl /home/sysroots/path/usr/lib/libgobject-2.0.so /home/sysroots/path/usr/lib/libffi.so /home/sysroots/path/usr/lib/libglib-2.0.so -lpthread -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/home/sysroots/path -pthread -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -pthread -Wl,-soname -Wl,libgstpluginxxx.so.0 -o .libs/libgstpluginxxx.so.0.0.0
/home/build-directory/tmp/sysroots/x86_64-linux/usr/libexec/cortexa8hf-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.9.4/ld: error: .libs/libgstpluginxxx_la-gstpluginxxx.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
I was confused, why the build was failed to recompile with -fPIC though it was mentioned in the linking command? I tried -fPIC option manually everywhere in the Makefile and libtool script, but no use :(
and
without modifying the source and recipe file, it was success in 32-bit toolchain whereas failed in 64-bit toolchain and telling to recompile with -fPIC option
Below are the build machine info.
BB_VERSION = "1.28.0"
BUILD_SYS = "i686-linux"
NATIVELSBSTRING = "Ubuntu-14.04"
This is likely a bug in gold linker. similar to
https://sourceware.org/ml/binutils/2010-12/msg00473.html
It seems you are using gold linker as default ld. So please pass
LDFLAGS += "-fuse-ld=bfd"
in recipe for this package. and see if that helps. This will force GNU BFD linker to be used for this package.
I was confused, why the build was failed to recompile with -fPIC though it was mentioned in the linking command? I tried -fPIC option manually everywhere in the Makefile and libtool script, but no use :(
Regarding these statements...
make distclean should clean all artifacts so everything gets rebuilt. You will also need to reconfigure.
Before you reconfigure, open your configure.ac and be sure you have a LT_INIT that includes pic-only:
AC_INIT([Crypto++], [8.3], ...)
LT_INIT([pic-only,enable-shared,enable-static])
AM_INIT_AUTOMAKE
...

Scons in Mongodb

When i run scons --ssl all, it throws an error:
g++ -o build/linux2/release/ssl/mongo/util/net/ssl_manager.o -c
-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wno-unknown-pragmas -Winvalid-pch -pipe -fno-builtin-memcmp -O3 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DMONGO_SSL -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DNETSNMP_NO_INLINE -Ibuild/linux2/release/ssl/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/linux2/release/ssl/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/release/ssl/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/release/ssl/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/release/ssl -Isrc -Ibuild/linux2/release/ssl/mongo -Isrc/mongo -Ibuild/linux2/release/ssl/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/release/ssl/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/release/ssl/third_party/v8/include -Isrc/third_party/v8/include src/mongo/util/net/ssl_manager.cpp
src/mongo/util/net/ssl_manager.cpp: In member function 'void
mongo::SSLManager::_setupFIPS()':
src/mongo/util/net/ssl_manager.cpp:187: error: 'FIPS_mode_set' was not
declared in this scope scons: *
[build/linux2/release/ssl/mongo/util/net/ssl_manager.o] Error 1 scons:
building terminated because of errors.
How to fix this issue. Using Ubuntu 12.04
To address this error make sure that you have a version of OpenSSL installed that defines FIPS_mode_set. Some versions of 0.9.8 for example don't. Upgrading to 1.0.1 should address.
If you are already on 1.0.1 make sure that correct OpenSSL headers and libraries are being used by scons. You can set explicitly by adding the include and lib paths as a command line arguments, as follows:
scons --ssl --cpppath /usr/local/openssl/1.0.1e/include --libpath /usr/local/openssl/1.0.1e/lib all
Where the paths provided are the actual paths of your OpenSSL include and libraries.
For those who have the same issue with OSX on Mac. Here is what you need to include:
scons --ssl --cpppath=/usr/local/opt/openssl/include --libpath=/usr/local/opt/openssl/lib all
assuming you've downloaded openssl with brew
brew install openssl

Installing Term::TermKey returns error

I have a problem while installing Term::TermKey with CPAN and I can't find information about how to solve it. Here is an output:
cpan[9]> install Term::TermKey
Running install for module 'Term::TermKey'
Running Build for P/PE/PEVANS/Term-TermKey-0.10.tar.gz
Checksum was ok
'/usr/bin/perl Build.PL installdirs=site' returned status 256, won't make
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
May someone help me?
//edit
I installed libtermkey but I still have a problem:
Building Term-TermKey
cc -I/usr/lib/perl5/core_perl/CORE -DXS_VERSION="0.10" -DVERSION="0.10" -fPIC -I/usr/local/include -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -o lib/Term/TermKey.o lib/Term/TermKey.c
ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/Term/TermKey/TermKey.bs')
cc -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -L/usr/local/lib -fstack-protector -o blib/arch/auto/Term/TermKey/TermKey.so lib/Term/TermKey.o -L/usr/local/lib -ltermkey
PEVANS/Term-TermKey-0.10.tar.gz
./Build -- OK
'YAML' not installed, will not store persistent state
Running Build test
t/00use.t ........... 1/1
# Failed test 'use Term::TermKey;'
# at t/00use.t line 8.
# Tried to use 'Term::TermKey'.
# Error: Can't load '/root/.cpan/build/Term-TermKey-0.10-Y5j3Oz/blib/arch/auto/Term/TermKey/TermKey.so' for module Term::TermKey: libtermkey.so.1: nie można otworzyć pliku obiektu dzielonego: Nie ma takiego pliku ani katalogu at /usr/lib/perl5/core_perl/DynaLoader.pm line 190.
It fails on every test. I don't know why. There is -L/usr/local/lib -ltermkey, so I've checked this directory:
ciembor#peace lib]$ ls | grep libtermkey
libtermkey.a
libtermkey.la
libtermkey.so
libtermkey.so.1
libtermkey.so.1.4.0
And all files are on their place...
Make sure that /usr/local/lib is also present in either $LD_LIBRARY_PATH or /etc/ld.so.conf. Without that, even if pkg-config can find the termkey.pc file which tells the compiler where the <termkey.h> files are, the (runtime) linker will not be able to link against the actual libtermkey.so file at runtime.
Alternatively, you could install libtermkey as a real package if your OS supports such - I keep a package on http://packages.leonerd.org.uk/ for Debian testing/unstable; it may also be suitable for other Debian-derived distributions such as Ubuntu.
When you install modules through CPAN, you don't see many of the error messages if the install fails. I would suggest to download Term-TermKey-0.10.tar.gz manually through http://search.cpan.org, extract it and then
perl Makefile.PL
make
make test
sudo make install
On my machine I'm told at the first step that I don't have libtermkey installed and it points me to a download.

How do I fix Perl's Font::FreeType compilation errors?

I am trying to install the Perl module Font::FreeType on a CentOS linux box using cpan. I run sudo cpan and inside the cpan shell I run install Font::FreeType. However make fails as follows:
Writing Makefile for Font::FreeType
cp lib/Font/FreeType.pm blib/lib/Font/FreeType.pm
cp lib/Font/FreeType/Face.pm blib/lib/Font/FreeType/Face.pm
cp lib/Font/FreeType/Glyph.pm blib/lib/Font/FreeType/Glyph.pm
/usr/bin/perl /usr/lib/perl5/site_perl/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap FreeType.xs > FreeType.xsc && mv FreeType.xsc FreeType.c
gcc -c -I/usr/include/freetype2 -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERSION=\"0.03\" -DXS_VERSION=\"0.03\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE" FreeType.c
FreeType.c: In function ‘XS_Font__FreeType_new’:
FreeType.c:425: warning: unused variable ‘class’
FreeType.xs: In function ‘XS_Font__FreeType__Face_has_reliable_glyph_names’:
FreeType.xs:528: warning: implicit declaration of function ‘FT_Has_PS_Glyph_Names’
FreeType.xs: In function ‘XS_Font__FreeType__Glyph_char_code’:
FreeType.xs:808: error: invalid lvalue in assignment
I have googled but can't seem to find any advice on how to solve this issue. I have a feeling something may be corupted with cpane, because when I went to check my version, I was surprised:
# sudo cpan --version
/usr/bin/cpan version [unknown] calling Getopt::Std::getopts (version 1.05 [paranoid]),
running under Perl version 5.8.8.
See http://rt.cpan.org/Public/Dist/Display.html?Name=Font-FreeType, the RT queue has patches you can apply to make the module build correctly.
Ether and Cfreak were guessing wrong, it's simply a bug due to bitrot in Font::FreeType.
It looks like you don't have the freetype development package installed. On the command line try:
yum install freetype-devel
Let that install and then rerun the install for your perl module. (you man need to do clean Font::Freetype first)
You can always reinstall cpan either by using itself (sudo cpan CPAN), or by manually downloading the CPAN distribution and following the build instructions.
However, generally when you get C-ish compile errors from a CPAN installation, that suggests you might be missing an underlying library. Font::FreeType uses the FreeType2 library; did you install that first? (Is it in /usr/lib/?)