Problems compiling with libcrypto

I am getting some linking issues when adding openSSL encrypting code to the client code , have used apis from below headers
Code:
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/evp.h>
#include <openssl/bio.h>


I get some compilation errors while compiling my client code
Code:
/master/usr/src/stand/common/sign.c:65: undefined reference to `BIO_new_mem_buf'
/usr/bin/ld: /master/usr/src/stand/common/sign.c:66: undefined reference to `PEM_read_bio_PUBKEY'
/usr/bin/ld: /master/usr/src/stand/common/sign.c:67: undefined reference to `EVP_PKEY_get1_RSA'
/usr/bin/ld: /master/usr/src/stand/common/sign.c:69: undefined reference to `RSA_size'
/usr/bin/ld: /master/usr/src/stand/common/sign.c:71: undefined reference to `RSA_public_decrypt'
/usr/bin/ld: start.o: in function `_start':
when I add LDFAGS+= -lcrypto -ldl and CFLAGS+=-I/master/usr/include to Makefile I get below err

/usr/bin/ld: /lib/libc.so.7: undefined reference to `__progname'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[2]: stopped in /master/usr/src/stand/efi/loader_4th
*** Error code 1
Please let me know if I am missing anything?
 
Last edited by a moderator:
To me, these messages don't look like it's related to libcrypto. You're trying to compile something in /usr/src/stand, which contains bootcode source, so it should compile "freestanding" binaries. __progname seems to be a symbol that user code has to define/export, but that's just guessed…
 
I would think to check if the header files are even on the disk...

My guess is that libcrypto was installed as a package, which would install .so files in /usr/lib... Packages tend to have very conservative options, so I think it's not far-fetched to imagine that libcrypto was compiled without the option to install header files. Ports do offer to install sources and header files, I'd check that for libcrypto.
 
Back
Top