unable to run newly compiled openssl - linux

I have a new Linux install (Ubuntu Mini Remix 16.04) and I did the following:
sudo apt-get install build-essential
sudo apt-get install git
git clone https://github.com/openssl/openssl.git
cd openssl
./config --openssldir=/usr/local/ssl
make
make test
sudo make install
I then typed in openssl in the CLI and got this message:
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Maybe /usr/local/lib is not in /etc/ld.so.conf?? If it is just try to run 'ldconfig' as root with no params, if it's not just add it and run 'ldconfig'.

try this:
do "which openssl" to confirm you're looking at the correct copy. do "ldd openssl" to get a list of what dynamic libraries it's expecting. Given the error you got there should be an error in the LDD output showing it can't find libssl.so.
Your "make install" may have simply left out "ldconfig". Do "ldconfig" to get the system to refresh it's information on where shared libraries are (it gets that from /etc/ld.so.conf and /etc/ld.so.conf.d/.
You can use the LD_LIBRARY_PATH environment variable to force it to use a certain directory to search for shared libraries, that often fixes this error.

Related

Curl is not installing with ssl support in Centos (at user defined --perfix)

There is already a curl & openssl version installed in my system (Centos). I am trying to install curl with ssl support.
what I've done:
I have installed openssl from git (master) and installed it as follows
./configure --prefix=/path/to/xyz/dir
make
make install
This creates bin,include,lib etc at the location /path/to/xyz/dir
Then I have added this path in environment variables
export PATH=$PATH:/path/to/xyz/dir/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/xyz/dir/lib
Then I downloaded the curl-7.60.0 from https://curl.haxx.se/download/curl-7.60.0.tar.gz, and trying to install it as:
./configure --prefix=/path/to/xyz/dir --with-ssl
But I am not getting the SSL-support as yes
When you build curl with openssl at a non-standard location you have to tell configure where to find it.
Setting PATH is for running executable programs, setting LD_LIBRARY_PATH is for finding run-time libraries. These are not sufficient for building. LD_LIBRARY_PATH may be necessary later for your curl program and library to find your openssl shared library.
See https://askubuntu.com/q/475670
I didn't check which of the options from the answers are correct. Try
./configure --with-ssl --with-libssl-prefix=/path/to/xyz/dir`
Try to configure with below parameters.
./configure --with-ssl --with-libssl-prefix=/usr/local/ssl

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded

Running into this issue when working with Hugo and the AWS CLI on Ubuntu 18.04.
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (failed to map segment from shared object): ignored.
This is a fresh install of Ubuntu 18.04, Hugo, and AWS CLI.
Found the answer after a bit of web searching here: https://github.com/PX4/Firmware/issues/9409
Solution
If you update your .bashrc with the below line it should fix the issue:
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
In addition, you may need to install the following package:
sudo apt install gtk3-nocsd
An Alternative
Another user reported installing the following package fixed their issue:
sudo apt-get install libgtk3-nocsd0:i386
Running
$ sudo grep -r LD_PRELOAD /etc $HOME
I found lots of configuration files of the removed package gtk3-nocsd like
/etc/X11/Xsession.d/51gtk3-nocsd-detect: export LD_PRELOAD="libgtk3-nocsd.so.0${LD_PRELOAD:+:$LD_PRELOAD}"
Just remove those old configuration with:
$ sudo apt-get purge gtk3-nocsd
in file /etc/X11/Xsession.d/51gtk3-nocsd-detect
change the line # 22 to
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0"

How to compile a C file with an OpenSSL dependency? [duplicate]

I'm trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the "-lssl" option. The source includes:
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
I ran:
$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
But I guess the openssl package doesn't include the library. I get these errors on make:
foo.cpp:21:25: error: openssl/bio.h: No such file or directory
foo.cpp:22:28: error: openssl/buffer.h: No such file or directory
foo.cpp:23:25: error: openssl/des.h: No such file or directory
foo.cpp:24:25: error: openssl/evp.h: No such file or directory
foo.cpp:25:25: error: openssl/pem.h: No such file or directory
foo.cpp:26:25: error: openssl/rsa.h: No such file or directory
How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS?
I did a man g++ and (under "Options for Linking") for the -l option it states: " The linker searches a standard list of directories for the library..." and "The directories searched include several standard system directories..." What are those standard system directories?
You want to install the development package, which is libssl-dev:
sudo apt-get install libssl-dev
Run:
apt-get install libssl-dev
All of these answers are very outdated and from when the package was still being developed. You can now just use the "normal" command listed below:
sudo apt install openssl
Edit: OP's question is poorly worded... after all, OpenSSL is a library itself, so I read his question too quickly before answering. The command above installs "normal" OpenSSL.
Toward the bottom of his question he mentions that make fails, suggesting he is compiling the package manually. And yes, even if you download the TAR ball, it will include all of the openssl and libssl files, which you can then make from.
What OP is really asking for is the OpenSSL Development Library, in which case you can first install OpenSSL using the above command, and then run this afterwards:
sudo apt install libssl-dev
More info: https://linuxtect.com/how-to-install-openssl-libraries-on-ubuntu-debian-mint/
I found a detailed solution here: Install OpenSSL Manually On Linux
From the blog post...:
Steps to download, compile, and install are as follows (I'm installing version 1.0.1g below; please replace "1.0.1g" with your version number):
Step – 1 : Downloading OpenSSL:
Run the command as below :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
Also, download the MD5 hash to verify the integrity of the downloaded file for just varifacation purpose. In the same folder where you have downloaded the OpenSSL file from the website :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5
$ md5sum openssl-1.0.1g.tar.gz
$ cat openssl-1.0.1g.tar.gz.md5
Step – 2 : Extract files from the downloaded package:
$ tar -xvzf openssl-1.0.1g.tar.gz
Now, enter the directory where the package is extracted like here is openssl-1.0.1g
$ cd openssl-1.0.1g
Step – 3 : Configuration OpenSSL
Run below command with optional condition to set prefix and directory where you want to copy files and folder.
$ ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
You can replace “/usr/local/openssl” with the directory path where you want to copy the files and folders. But make sure while doing this steps check for any error message on terminal.
Step – 4 : Compiling OpenSSL
To compile openssl you will need to run 2 command : make, make install as below :
$ make
Note: check for any error message for verification purpose.
Step -5 : Installing OpenSSL:
$ sudo make install
Or without sudo,
$ make install
That’s it. OpenSSL has been successfully installed. You can run the version command to see if it worked or not as below :
$ /usr/local/openssl/bin/openssl version
OpenSSL 1.0.1g 7 Apr 2014
How could I have figured that out for
myself (other than asking this
question here)? Can I somehow tell
apt-get to list all packages, and grep
for ssl? Or do I need to know the
"lib*-dev" naming convention?
If you're linking with -lfoo then the library is likely libfoo.so. The library itself is probably part of the libfoo package, and the headers are in the libfoo-dev package as you've discovered.
Some people use the GUI "synaptic" app (sudo synaptic) to (locate and) install packages, but I prefer to use the command line. One thing that makes it easier to find the right package from the command line is the fact that apt-get supports bash completion.
Try typing sudo apt-get install libssl and then hit tab to see a list of matching package names (which can help when you need to select the correct version of a package that has multiple versions or other variations available).
Bash completion is actually very useful... for example, you can also get a list of commands that apt-get supports by typing sudo apt-get and then hitting tab.
Another way to install openssl library from source code on Ubuntu, follows steps below, here WORKDIR is your working directory:
sudo apt-get install pkg-config
cd WORKDIR
git clone https://github.com/openssl/openssl.git
cd openssl
./config
make
sudo make install
# Open file /etc/ld.so.conf, add a new line: "/usr/local/lib" at EOF
sudo ldconfig
You want the openssl-devel package.
At least I think it's -devel on Ubuntu. Might be -dev. It's one of the two.
As a general rule, when on Debian or Ubuntu and you're missing a development file (or any other file for that matter), use apt-file to figure out which package provides that file:
~ apt-file search openssl/bio.h
android-libboringssl-dev: /usr/include/android/openssl/bio.h
libssl-dev: /usr/include/openssl/bio.h
libwolfssl-dev: /usr/include/cyassl/openssl/bio.h
libwolfssl-dev: /usr/include/wolfssl/openssl/bio.h
A quick glance at each of the packages that are returned by the command, using apt show will tell you which among the packages is the one you're looking for:
~ apt show libssl-dev
Package: libssl-dev
Version: 1.1.1d-2
Priority: optional
Section: libdevel
Source: openssl
Maintainer: Debian OpenSSL Team <pkg-openssl-devel#lists.alioth.debian.org>
Installed-Size: 8,095 kB
Depends: libssl1.1 (= 1.1.1d-2)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Tag: devel::lang:c, devel::library, implemented-in::TODO, implemented-in::c,
protocol::ssl, role::devel-lib, security::cryptography
Download-Size: 1,797 kB
APT-Sources: http://ftp.fr.debian.org/debian unstable/main amd64 Packages
Description: Secure Sockets Layer toolkit - development files
This package is part of the OpenSSL project's implementation of the SSL
and TLS cryptographic protocols for secure communication over the
Internet.
.
It contains development libraries, header files, and manpages for libssl
and libcrypto.
N: There is 1 additional record. Please use the '-a' switch to see it
Go to the official website and download the source code for the version you need
Then unzip the update package and execute the following command
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared
Because the default is to generate only static libraries, if you want dynamic libraries, add the "shared" option
make && make install
sudo apt-get install libcurl4-openssl-dev

./configure error while installing conky

I've downloaded conky from GitHub and when I try to use the ./configure command, I get this following error :
bash: ./configure: No such file or directory
I opened my terminal in the Src folder and tried this command. What am I missing?
This is the screenshot of the terminal and the downloaded conky folder
I see CMakeLists.txt and doubled checked, per the documentation use cmake
1.10 and later versions
Conky 2 will use cmake instead of autotools which means you won't need autoconf and automake anymore but you'll need cmake.
autoconf and automake (and autogen) are what generally drive "configure".
You will need the tolua library (Ref.), which can be installed for Linux with apt-get install libtolua-dev libtolua++5.1-dev. You also need the following development packages if you keep the default cmake configuration: apt-get install libx11-dev libxft-dev libxdamage-dev libncurses5-dev libxinerama-dev.
Then, building conky will work like this:
$ mkdir build
$ cd build
$ ccmake ..
# this will launch a curses-based UI where you can configure
# everything, when you are ready you can build as usual:
$ make # This will compile conky in the `src` subdirectory
$ make install

osm2pgsql Protobuf not Found: Centos

The Problem:
I have a program I am installing from source. When I run ./configure, it stops saying "no protobuf development libraries found", however, protobuf is installed on my system.
How do I specify the path to those libraries when I run ./configure?
The program I am trying to install is osm2pgsql on CentOS 6.6.
Update:
I fixed the problem fortunately.
What Happened?:
osm2pgsql uses pkg-config to point to dependent libraries. On CentOS 7 pkg-config uses this directory /usr/share/pkgconfig/. Within this directory there are .pc files for different programs. These files are used by pkg-config to show where libraries of certain programs are located. When you install protobuf from package manager or source the installation doesn't automatically let pkg-config know where the libraries are at via a .pc file.
The Fix:
Install protobuf from source from their git page. After you've ran make install there will be several .pc files within the cloned directory. You need to place these in /usr/share/pkgconfig. To do this run the following in the cloned directory:
sudo cp protobuf.pc* /usr/share/pkgconfig/
sudo cp protobuf-lite.pc* /usr/share/pkgconfig/
Conclusion:
Ta Da! Now go back to your osm2pgsql install folder and rerun ./configure.

Resources