dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Statically linking “libcrypto” (openssl) ?

  1. #1
    Join Date
    Mar 2020
    Posts
    2

    Statically linking “libcrypto” (openssl) ?

    Hi, I downloaded a static pre-compiled version of openssl without dependencies (from an official sponsored link https://bintray.com/vszakats/generic/openssl in openssl wiki (https://wiki.openssl.org/index.php/Binaries), I’d like to statically link libcrypto library to my C program, I’m using MingGW. Can you provide me some guidelines to make it working in eclipse or netbeans ide in windows?

    What I tried: I created a directory in my netbeans project path with all include headers and the libcrypto.a , then I configured the library and netbeans added -lcrypto .
    Everytime I use any headers like #include <aes.h> there is a dipendence inside the header file that is not resolved, for example:
    HTML Code:
    *there is this error: "openssl/aes.h:13:11: fatal error: openssl/opensslconf.h: No such file or directory # include <openssl/opensslconf.h>"

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,038

    Re: Statically linking “libcrypto” (openssl) ?

    The openssl files need to be in a folder called openssl.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.5.1)

  3. #3
    Join Date
    Mar 2020
    Posts
    2

    Re: Statically linking “libcrypto” (openssl) ?

    Yes I was using a folder "openssl" with *.h headers and libcrypto.a, linking with -static the libcrypto.a file, the error is the one described in the thread
    Now I tried to put the full openssl folder (openssl/engines-1_1, openssl/include, openssl/lib ..) linking the correct libcrypto.a file with -static flag, in this case the error is:

    main.c:10:10: fatal error: openssl/include/openssl/conf.h: No such file or directory
    #include <openssl/include/openssl/conf.h>

    obviously I edited my include using the netbeans autocomplete feature and checking that the path was correct, the error is not that the .h file is not found but it's an unresolved dependence inside the .h file, as happened in the previous attempt.
    Thanks for your patience.

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,038

    Re: Statically linking “libcrypto” (openssl) ?

    You need to specify to MingGW the location of the openssl folder. As the #include uses <> rather than "", it won't automatically look in your current project folder. Sorry I can't say how you do that with MingGW as I use MS VS.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.5.1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)