PDA

View Full Version : Linking against ssl. Simple SSL example.




oakcreeker
Feb 6, 2008, 08:42 PM
Anyone give me any suggestions on how to fix or where to find help for linking problems with ssl? I've copied a simple ssl example program from here: simple ssl client example (http://h71000.www7.hp.com/doc/83final/BA554_90007/ch05s03.html) I fixed a couple of compile errors, and then dragged the .dylib from /usr/lib/libssl.0.9.7.dylib to the "Link Binary With Library" for the target in XCode. I get a bunch of link errors:

Undefined symbols:
"_X509_free", referenced from:
_main in main.o
"_X509_get_subject_name", referenced from:
_main in main.o
"_X509_NAME_oneline", referenced from:
_main in main.o
_main in main.o
"_X509_get_issuer_name", referenced from:
_main in main.o
"_ERR_print_errors_fp", referenced from:
_main in main.o
ld: symbol(s) not found

...

I don't think I'm linking properly. Btw, I have tried compiling it from the command line ... same errors.

$ g++ -o simple_ssl main.cpp -lsslUndefined symbols:
"_X509_free", referenced from:
_main in ccSTv0wZ.o
"_X509_get_subject_name", referenced from:
_main in ccSTv0wZ.o
"_X509_NAME_oneline", referenced from:
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
"_X509_get_issuer_name", referenced from:
_main in ccSTv0wZ.o
"_ERR_print_errors_fp", referenced from:
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
_main in ccSTv0wZ.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Thanks in advance.

Derrick



kainjow
Feb 7, 2008, 08:49 AM
I think you might need to link against libcrypto as well.

oakcreeker
Feb 7, 2008, 10:02 AM
I think you might need to link against libcrypto as well.

That did it. Thanks, kainjow, for the solution.

Derrick