Compiling and linking OpenSSL on Ubuntu vs OSX

前端 未结 2 775
天涯浪人
天涯浪人 2020-12-21 00:14

Attempt 1, Vanilla Link to Library

I\'m trying to use a patched version of OpenSSL (so DTLS is easier to use). OpenSSL is in

/usr/lo         


        
2条回答
  •  醉酒成梦
    2020-12-21 01:03

    Your compilation command appears to work on OSX but is actually compiling and linking with the system-provided OpenSSL rather than the version you wanted. It fails outright on Ubuntu because you don't have the headers and development library links for the system OpenSSL installed.

    This is because you have the search path options mixed up, and you need two of them. To tell GCC where headers are you use -I. To tell it where object-code libraries are you use -L. The compilation command you need, ON BOTH SYSTEMS, is something like this:

    $ gcc -I /usr/local/openssl-1.0.1c/include -L /usr/local/openssl-1.0.1c/lib \
          -o server server.c -lssl -lcrypto
    

提交回复
热议问题