You are not logged in.

#1 2022-09-15 13:00:20

Carlo1983
Member
Registered: 2022-09-15
Posts: 5

Compiling OpenSSL in shared mode with relative library path

Hi to all,
I'm a Newbie on this forum and apologize me for my eventually poor english.

I've compiled successfully the openssl version 3.0.5 in shared  mode with those steps:

./config -fPIC shared -Wl,-rpath=/opt/OpenSSL/openssl-3.0.5/lib64 --prefix=/opt/OpenSSL/openssl-3.0.5 --openssldir=/opt/OpenSSL/openssl-3.0.5

make

make install

Now I want to compile another OpenSSL (version 1.1.1q) with  this commands:

./config -fPIC shared -Wl,-rpath=/opt/OpenSSL/openssl-1.1.1q/lib --prefix=/opt/OpenSSL/openssl-1.1.1q --openssldir=/opt/OpenSSL/openssl-1.1.1q

make

make install

but I've got this error at the making step:

/usr/bin/ld: cannot find rpath=/opt/OpenSSL/openssl-1.1.1q/lib: No such file or directory

As for the OpenSSL version 3.0.5, the /opt/OpenSSL/openssl-3.0.5 path was empty before the compiling commands.

(I have used even this rpath flag

-Wl,-rpath=/opt/OpenSSL/openssl-1.1.1q/lib64

without fortune)

Can you help me please?
What I miss?

Last edited by Carlo1983 (2022-09-15 13:03:10)

Offline

#2 2022-09-15 23:55:02

loqs
Member
Registered: 2014-03-06
Posts: 18,964

Re: Compiling OpenSSL in shared mode with relative library path

$ git clone https://github.com/archlinux/svntogit-packages.git --single-branch --branch 'packages/openssl' openssl
Cloning into 'openssl'...
remote: Enumerating objects: 1353, done.
remote: Counting objects: 100% (105/105), done.
remote: Compressing objects: 100% (64/64), done.
remote: Total 1353 (delta 71), reused 41 (delta 41), pack-reused 1248
Receiving objects: 100% (1353/1353), 250.14 KiB | 5.96 MiB/s, done.
Resolving deltas: 100% (303/303), done.
$ cd openssl/trunk/

Added the rpath which does not exist on this system to the end of LDFLAGS as below

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 54b81e4..f9584e6 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -35,7 +35,7 @@ build() {
        # mark stack as non-executable: http://bugs.archlinux.org/task/12434
        ./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib \
                shared no-ssl3-method enable-ec_nistp_64_gcc_128 linux-x86_64 \
-               "-Wa,--noexecstack ${CPPFLAGS} ${CFLAGS} ${LDFLAGS}"
+               "-Wa,--noexecstack ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -Wl,-rpath=/opt/OpenSSL/openssl-1.1.1q/lib"
 
        make depend
        make

Then built the package with makepkg -rs without issue.

Offline

#3 2022-09-16 08:36:26

Carlo1983
Member
Registered: 2022-09-15
Posts: 5

Re: Compiling OpenSSL in shared mode with relative library path

Hi and thanks for your quick response.
I don't get what you have done.

I think you have downloaded from the github the source code (I assume the version is the 1.1.1q).
Then you have added the  -Wl,-rpath=/opt/OpenSSL/openssl-1.1.1q/lib manually to the end of the PKGBUILD file and than the command makepkg -rs

Is it correct?

I will compile the sources downloaded from the official site with the rpath flag.

Is it possible?

Because your solution I think is usable only for Arch Linux users.
Even I know it's Arch Linux forum though big_smile.

Thanks anyway for your help !

Last edited by Carlo1983 (2022-09-16 08:38:21)

Offline

#4 2022-09-16 12:05:23

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Compiling OpenSSL in shared mode with relative library path

Carlo1983 wrote:

Because your solution I think is usable only for Arch Linux users.
Even I know it's Arch Linux forum though big_smile.

What system are you installing this on? Not Arch?

Offline

#5 2022-09-16 16:26:39

Carlo1983
Member
Registered: 2022-09-15
Posts: 5

Re: Compiling OpenSSL in shared mode with relative library path

Hi to all.
Yes, my system is Arch Linux and my goal is to compile the source of the OpenSSL, version 1.1.1q in shared mode.

So, I suppose the method will be:
./confugure
make
make install

Is it correct my assumptions?

Last edited by Carlo1983 (2022-09-16 16:32:27)

Offline

#6 2022-09-16 18:04:26

loqs
Member
Registered: 2014-03-06
Posts: 18,964

Re: Compiling OpenSSL in shared mode with relative library path

Carlo1983 wrote:

Yes, my system is Arch Linux and my goal is to compile the source of the OpenSSL, version 1.1.1q in shared mode.

As part of the your Arch install you will have the shared libraries from OpenSSL 1.1.1q already installed in /usr/lib.  Arch does not require an rpath as /usr/lib is on the default search path of the dynamic loader ld.so.

Carlo1983 wrote:

So, I suppose the method will be:
./confugure
make
make install

Arch creates packages using makepkg from PKGBUILDs.

Offline

#7 2022-09-23 13:11:03

Carlo1983
Member
Registered: 2022-09-15
Posts: 5

Re: Compiling OpenSSL in shared mode with relative library path

Hi and sorry for my late response.

I have solved my first issue (the topic of this tread).
Now I have compiled OpenSSL in shared mode with rpath flag in this way:

- downloaded source code of OpenSSL v1.1.1q from OpenSSL.org repo
- extracted the source in a dir of my convinience and entered into it
- execute the follow commands:

CFLAGS=-fPIC ./config shared -Wl,--enable-new-dtags -Wl,-rpath=/opt/OpenSSL/openssl-1.1.1q/lib --prefix=/opt/OpenSSL/openssl-1.1.1q --openssldir=/opt/OpenSSL/openssl-1.1.1q
make
make install

- verified that the linked resources are binding to my OpenSSL version as follow:

ldd -v /opt/OpenSSL/openssl-1.1.1q/bin/openssl 
        linux-vdso.so.1 => linux-vdso.so.1 (0x00007fffff79a000)
        libssl.so.1.1 => /opt/OpenSSL/openssl-1.1.1q/lib/libssl.so.1.1 (0x00007fafaa28a000)
        libcrypto.so.1.1 => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1 (0x00007fafa9f9d000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fafa9d9a000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fafaa3da000)

        Version information:
        /opt/OpenSSL/openssl-1.1.1q/bin/openssl:
                libc.so.6 (GLIBC_2.14) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.34) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.4) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.3) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.33) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.7) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /usr/lib/libc.so.6
                libssl.so.1.1 (OPENSSL_1_1_1) => /opt/OpenSSL/openssl-1.1.1q/lib/libssl.so.1.1
                libssl.so.1.1 (OPENSSL_1_1_0) => /opt/OpenSSL/openssl-1.1.1q/lib/libssl.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_1) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_0) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
        /opt/OpenSSL/openssl-1.1.1q/lib/libssl.so.1.1:
                libc.so.6 (GLIBC_2.14) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.4) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /usr/lib/libc.so.6
                libcrypto.so.1.1 (OPENSSL_1_1_0d) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_0i) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_0f) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_1) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
                libcrypto.so.1.1 (OPENSSL_1_1_0) => /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1
        /opt/OpenSSL/openssl-1.1.1q/lib/libcrypto.so.1.1:
                libc.so.6 (GLIBC_2.14) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.3.4) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.4) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.3) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.25) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.3.2) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.33) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.7) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.17) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.16) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.34) => /usr/lib/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /usr/lib/libc.so.6
        /usr/lib/libc.so.6:
                ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /usr/lib64/ld-linux-x86-64.so.2
                ld-linux-x86-64.so.2 (GLIBC_2.3) => /usr/lib64/ld-linux-x86-64.so.2
                ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /usr/lib64/ld-linux-x86-64.so.2

With my previous attempts the latter command give me always the wrong linking libraries.

Now I have another problem, related to my Apache httpd installation but I guess I have to create new topic.

If you all are agree, I'll mark this topic as Solved.
Let me know before if my actions have side effects or not.

Thanks to all

Last edited by Carlo1983 (2022-09-23 14:58:44)

Offline

Board footer

Powered by FluxBB