Linking OpenSSL libraries to a program
Silly "Linux-isms" strike again! Apparently, I need to change my command such that the -L
and -l
stuff is at the end like (despite what man gcc
seems to indicate):
gcc -Wall -Wextra -Werror -static -o myApp source1.o source2.o common.o -Lopenssl/openssl-0.9.8k/ -lssl -lcrypto -Iopenssl/openssl-0.9.8k/include
How to link OpenSSL libraries statically in VS2019?
The .lib files that are created in a default build are just stubs to call the dlls.
When building OpenSSL you need to specify that you want to build it for static linking.
Modify the "Configure" line that you used to add "no-shared" onto the end, e.g.
perl Configure --prefix=d:\your\prefix\here VC-WIN32 no-shared
Then you will need to rebuild OpenSSL:
nmake clean
nmake
nmake test
nmake install
Safely call openSSL functions from inside a shared library
Self-response:
set -fvisibility=hidden
to hide internal symbols of openSSL from outer modules in the compilation process of openSSL.
OR
use -Wl,--exclude-libs,ALL
when you compile the SO. For example: g++ -shared -o mylib.so obj1.o obj2.o -L/path/to/openssl/static-libs -lssl -lcrypto -Wl,--exclude-libs,ALL
I prefer the second method because it also solved the problem of version conflicts on openssl engine (at least in my case).
Related Topics
Controlling a Usb Power Supply (On/Off) With Linux
Connection Refused to Mongodb Errno 111
Pipe Only Stderr Through a Filter
Linux/Unix Command to Determine If Process Is Running
How to Remove a Close_Wait Socket Connection
What Does O_Direct Really Mean
Disable Randomization of Memory Addresses
Difference Between Clock_Realtime and Clock_Monotonic
Find Multiple Files and Rename Them in Linux
How to Show All Shared Libraries Used by Executables in Linux
Apache Virtualhost 403 Forbidden
Externalizing Tomcat Webapp Config from .War File
How to Redirect Stderr and Stdout to Different Files in the Same Line in Script