You may need to rename the libraries on your system or use LD_PRELOAD when launching your application.
Another option is to specify the full path to the specific libraries you want when you link with, instead of the -l<library_name>. For example: gcc -I /sonus/p4/ws/shared/cmn_thirdparty.main/openssl/distrib/include -L /sonus/p4/ws/shared/cmn_thirdparty.main/bldtools/toolchain/current/sonus/lib/ <PATH_TO>/libssl.so.1.0.2 <PATH_TO>/libcrypto.so.1.0.2 cpxmain1.c -o cpxmain1 -Tom From: openssl-users <openssl-users-boun...@openssl.org> On Behalf Of Kumar Mishra, Sanjeev Sent: Thursday, May 6, 2021 12:48 AM To: openssl-users@openssl.org Cc: Paramashivaiah, Sunil <sunil.paramashiva...@rbbn.com>; Narayana, Sunil Kumar <sanaray...@rbbn.com>; Bhattacharjee, Debapriyo (c) <dbhattachar...@rbbn.com>; Shivakumar Poojari <shivakumar.pooj...@rbbn.com> Subject: How to switch between OpenSSL 1.0.2 and 1.1 in compilation loading and linking a C code. Hi, In my Linux Debian server both OpenSSL 1.0.2 and 1.1 is installed. As a user I am compiling C code for 1.0.2. But at the runtime and linking and loading it is picking version 1.1 as default. How to switch between OpenSSL 1.0.2 and 1.1 in compilation loading and linking a C code ? Is there any linux env is required to set? I am using following commands- export LD_LIBRARY_PATH=/sonus/p4/ws/shared/cmn_thirdparty.main/bldtools/toolchain/current/sonus/lib/ To compile gcc -I /sonus/p4/ws/shared/cmn_thirdparty.main/openssl/distrib/include -L /sonus/p4/ws/shared/cmn_thirdparty.main/bldtools/toolchain/current/sonus/lib/ -lssl -lcrypto cpxmain1.c -o cpxmain1 Both the libcrypto.so.1.0.2 and libcrypto.so.1.1 is present in this path but only picking 1.1 as a default. How to change this default setting? Thanks With Best Regards, Sanjeev Kumar Mishra Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. and its Affiliates that is confidential and/or proprietary for the sole use of the intended recipient. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments.