1

I am trying to run a program that uses OpenSSL under Valgrind but OpenSSL does some funny stuff that results in a lot of "false positives" so after some searching around I discovered that I need to compile OpenSSL with the -DPURIFY option.

So I download the same OpenSSL version from the RedHat servers (openssl-1.0.0-10.el6.src.rpm) as the system is currently using (an old system). Then I try the following commands:

rpm2cpio openssl-1.0.0-10.el6.src.rpm | cpio -idmv
tar -xvf openssl-1.0.0-usa.tar.bz2
cd openssl-1.0.0
./config
make

but the make throws an error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

I saw a lot of patch files when I extracted the src.rpm file, I suppose I need to manually apply those (how and in what order?) or am I doing something else wrong?

Goal: To compile this version (1.0.0-10.el6) of OpenSSL with -DPURIFY

1

Usually, I prefer to build and install my own packages when I need changes, as in such way, you do not have unaccounted files/binaries in your system(s).

There are usually specific steps to (re)build packages from src.rpm source packages.

The process is mostly automated, and you do not need to compile or apply all the patches by hand.

From CentOS - Rebuild a Source RPM

The advantage of unpacking the SRPM first and then using rpmbuild -ba to rebuild it from the specfile is that you can modify the specfile (and maybe add some patches or even upgrade the source tarball) to suit your needs. This is a more complex situation than just rebuilding the SRPM, though, and if you are going down this route you should probably read more on the subject, as explained below, but the process goes like this:

cd ~/rpmbuild/SPECS/

rpmbuild -bp mypackage.spec

cd ~/rpmbuild/BUILD/

cp existing_directory existing_directory.orig

cd existing_directory

find the file you wish to change, modify it.

cd ~/rpmbuild/BUILD/

diff -Npru existing_directory.orig existing_directory > name_of_your_patch_file.patch

cp name_of_your_patch_file.patch ~/rpmbuild/SOURCES/

cd ~/rpmbuild/SPECS/

edit the mypackage.spec file to add the definition of name_of_your_patch_file.patch and the application of your_patch_file -- please look in the file to see how that is done.

rpmbuild -ba mypackage.spec

Finally, to install the package with your changes:

rpm -i mypackage

As per the OP comments, if you already have the package installed, you can use the following command to upgrade to your version:

rpm -Uvh --force mypackage
  • 1
    Thanks for your comment, I now build the RPM with the -Dpurify flag (it also required an additional patch, since the test certificates were expired). However, I ran the rpm -Uvh --force command for both openssl and openssl-devel since the original versions were still installed and -i would return that error. A small follow up question, how do I now know that I did indeed install the new openssl version (since the new one is the same version as the old one, but just with an additional flag)? – LinG Mar 14 '18 at 9:05
  • 1
    Never mind, you can run openssl version -b, to find the date it was build. – LinG Mar 14 '18 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.