Adding the '/' makes sense, as I expect that PKI/openssl-3.6.0 isn't in your path
As for the linker errors, I'm fairly certain you've somehow mistakenly copied the libcrypto.so.3 library from your 3.1.2 build into /PKI/openssl-3.6.0/lib
If you run this command:
objdump -x /PKI/openssl-3.6.0/apps/openssl
you'll see output that includes this table:
Version References:
required from libc.so.6:
0x069691b3 0x00 16 GLIBC_2.33
0x06969194 0x00 15 GLIBC_2.14
0x069691b4 0x00 13 GLIBC_2.34
0x069691b8 0x00 11 GLIBC_2.38
0x0d696913 0x00 09 GLIBC_2.3
0x09691a75 0x00 06 GLIBC_2.2.5
required from libssl.so.3:
0x06702f20 0x00 18 OPENSSL_3.4.0
0x06702d20 0x00 05 OPENSSL_3.2.0
0x06702b20 0x00 03 OPENSSL_3.0.0
required from libcrypto.so.3:
0x06702b29 0x00 17 OPENSSL_3.0.9
0x06702b23 0x00 14 OPENSSL_3.0.3
0x06702e20 0x00 12 OPENSSL_3.3.0
0x06703020 0x00 10 OPENSSL_3.5.0
0x06702120 0x00 08 OPENSSL_3.6.0
0x06702f20 0x00 07 OPENSSL_3.4.0
0x06702d20 0x00 04 OPENSSL_3.2.0
0x06702b20 0x00 02 OPENSSL_3.0.0
That says the ELF file that is your openssl app requires that symbols from the OPENSSL_3.0.0 through OPENSSL_3.6.0 need to be resolved by this binary in libcrypto.so.3, as well as version 3.0.0, 3.2.0 and 3.4.0 from libssl.so.3. This makes sense, because as we add api calls in minor versions the build system tags them with the version number in which they are added.
If you now run this command:
objdump -x /PKI/openssl-3.6.0/lib/libcrypto.so.3
What you _should_ see is a table that looks like this:
Version definitions:
1 0x01 0x06af4743 libcrypto.so.3
2 0x00 0x06702b20 OPENSSL_3.0.0
3 0x00 0x06702b23 OPENSSL_3.0.3
OPENSSL_3.0.0
4 0x00 0x06702b28 OPENSSL_3.0.8
OPENSSL_3.0.3
5 0x00 0x06702b29 OPENSSL_3.0.9
OPENSSL_3.0.8
6 0x00 0x06702c20 OPENSSL_3.1.0
OPENSSL_3.0.9
7 0x00 0x06702d20 OPENSSL_3.2.0
OPENSSL_3.1.0
8 0x00 0x06702e20 OPENSSL_3.3.0
OPENSSL_3.2.0
9 0x00 0x06702f20 OPENSSL_3.4.0
OPENSSL_3.3.0
10 0x00 0x06703020 OPENSSL_3.5.0
OPENSSL_3.4.0
11 0x00 0x06702120 OPENSSL_3.6.0
OPENSSL_3.5.0
Which define the versions that the openssl app needs from the library, and everything matches up.
What I expect you _will_ see however is a table that looks like this:
objdump -x /PKI/openssl-3.6.0/lib/libcrypto.so.3
Version definitions:
1 0x01 0x06af4743 libcrypto.so.3
2 0x00 0x06702b20 OPENSSL_3.0.0
i.e. the library being pointed to by LD_LIBRARY_PATH doesn't contain the version definitions that the application requires.
I should be a bit more through here. I asserted that somehow you inadvertently copied libcrypto.so.3 and libssl.so.3 from a non-matching build to /PKI/openssl-3.6.0/lib/ . Its possible that didn't happen. Instead it may also be possible that the needed libraries in /PKI/openssl-3.6.0/lib/ don't exist there at all. If that were the case, the LD_LIBRARY_PATH lookup would fail and the runtime loader would fall back to the standard search path, loading /usr/lib64/libcrypto.so.3, which on ubuntu 22.04 would be a build from openssl-3.0.2, which would give you exactly the same error.
I would suggest the following:
1) confirm that /PKI/openssl-3.6.0/lib/libcrypto.so.3 and /PKI/openssl-3.6.0/lib/libssl.so.3 exist
2) Assuming that they do, run the above objdump commands to confirm the output I presented.
If the result of (1) is that those files don't exist in that location, the problem is that you're loading the system libcrypto/libssl and we need to adjust either your library locations or search path to find the right version that you want to use.
If the result of (1) is that those files do exist there in that location, then my initial theory is correct, and you've got an old version of libcrypto/libssl where it shouldn't be.
Regards
Neil