Undefined Reference to OpenSSL EVP functions

Chris dlang at guerrillamail.com
Tue Jan 16 02:59:02 UTC 2018


On Tuesday, 16 January 2018 at 00:52:09 UTC, Chris wrote:
> I am trying to hook up OpenSSL to a dlang project I'm working 
> on, but I have hit a problem when trying to link.
>
> I currently get the following linking error:
>
>>undefined reference to `EVP_CIPHER_CTX_init'
>
> I have made sure to include the module wrapping the c headers
>
>> import deimos.openssl.evp;
>
> And I have made sure that I am linking to "libcrypto" and 
> "libssl" in my "dub.json" file. I have even pointed the linker 
> to my "/usr/lib" folder
>
> And I made sure that those libraries are installed on my system 
> in "/usr/lib"
>
>>libcrypto.o
>>libssl.o
>
> Here is the code that I am trying to run:
>
>>import deimos.openssl.evp
>>
>>void main()
>>{
>>    EVP_CIPHER_CTX *ctx;
>>    EVP_CIPHER_CTX_init(ctx);
>>}
>
> Here is the full verbose output of dub: 
> https://pastebin.com/raw/4FnhCyr2
>
> Here is my full dub.json file: https://pastebin.com/raw/1Z3WGBET
>
> Any help would be greatly appreciated! Thank you so much!

Hi Everyone, this is not an error in D, or the OpenSSL wrapper 
code it's just me not reading the OpenSSL man pages...

EVP_CIPHER_CTX_init is not longer the way to create the context 
in 1.1.0 - It has been replaced by:

>EVP_CIPHER_CTX *ctx;
>ctx = EVP_CIPHER_CTX_new()

RTFM...


More information about the Digitalmars-d-learn mailing list