ldd do not show cygcrypto-1.1.dll and/or cygssl-1.1.dll

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,

I am trying to setup a lab to Code a program with C++ (g++ (GCC) 11.2.0) and OpenSSL (OpenSSL 1.1.1m 14 Dec 2021) and Cygwin.

Below is my basic C++ skeleton to start with ...

#ifndef __TLS_HPP__
#define __TLS_HPP__

#include <memory>
#include <stdexcept>

#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/opensslconf.h>
#include <openssl/opensslv.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

namespace TLS {

class Tls {
public:
    Tls();
    ~Tls();
private:
};

Tls::Tls()
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
    SSL_library_init();
    SSL_load_error_strings();
    ERR_load_crypto_strings();
#endif

}

}   // end-of namespace TLS

#endif

#include <chrono>
#include <iostream>
#include <vector>

int main() {
    return 0;
}

I can successfully compile this Code with the following command ..

$ g++ -O0 -std=c++11 -x c++ -lssl -lcrypto ./tls.hpp

But none of the commands below do show any linking with OpenSSL libraries ?

$ ldd ./a.exe
        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffd731d0000)
        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffd71c20000)
        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffd70bd0000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000)
        cygstdc++-6.dll => /usr/bin/cygstdc++-6.dll (0x3fbeb0000)
        cyggcc_s-seh-1.dll => /usr/bin/cyggcc_s-seh-1.dll (0x3fee10000)

$ objdump -x ./a.exe | grep 'DLL'
 vma:            Hint    Time      Forward  DLL       First
        DLL Name: cygwin1.dll
        DLL Name: cygstdc++-6.dll
        DLL Name: KERNEL32.dll

$ nm ./a.exe | egrep -i 'ssl|crypt'

.. finally and just to be sure, my Cygwin env is enough to proceed like this, I made a try compiling Curl ... this one do correctly show the linking with both cygcrypto-1.1.dll and cygssl-1.1.dll ..

$ ldd /usr/bin/curl
        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffd731d0000)
        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffd71c20000)
        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffd70bd0000)
        cygcurl-4.dll => /usr/bin/cygcurl-4.dll (0x3ff600000)
        cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000)
        cygz.dll => /usr/bin/cygz.dll (0x3fb940000)
        cygbrotlidec-1.dll => /usr/bin/cygbrotlidec-1.dll (0x3ffcd0000)
        cygcrypto-1.1.dll => /usr/bin/cygcrypto-1.1.dll (0x3ff6b0000)
        cyggsasl-7.dll => /usr/bin/cyggsasl-7.dll (0x3fe640000)
        cyggssapi_krb5-2.dll => /usr/bin/cyggssapi_krb5-2.dll (0x3fe5f0000)
        cygidn2-0.dll => /usr/bin/cygidn2-0.dll (0x3fe020000)
        cyglber-2-5-0.dll => /usr/bin/cyglber-2-5-0.dll (0x3fd7b0000)
        cygldap-2-5-0.dll => /usr/bin/cygldap-2-5-0.dll (0x3fd6a0000)
        cygnghttp2-14.dll => /usr/bin/cygnghttp2-14.dll (0x3fcdb0000)
        cygpsl-5.dll => /usr/bin/cygpsl-5.dll (0x3fc4e0000)
        cygssh2-1.dll => /usr/bin/cygssh2-1.dll (0x3fc190000)
        cygssl-1.1.dll => /usr/bin/cygssl-1.1.dll (0x3fc090000)
        cygzstd-1.dll => /usr/bin/cygzstd-1.dll (0x3fb840000)
        cygbrotlicommon-1.dll => /usr/bin/cygbrotlicommon-1.dll (0x3ffcf0000)
        cyggcrypt-20.dll => /usr/bin/cyggcrypt-20.dll (0x3fecf0000)
        cygidn-11.dll => /usr/bin/cygidn-11.dll (0x3fe090000)
        cygintl-8.dll => /usr/bin/cygintl-8.dll (0x3fdfe0000)
        cygntlm-0.dll => /usr/bin/cygntlm-0.dll (0x3fcd90000)
        cygk5crypto-3.dll => /usr/bin/cygk5crypto-3.dll (0x3fd8e0000)
        cygkrb5-3.dll => /usr/bin/cygkrb5-3.dll (0x3fd810000)
        cygkrb5support-0.dll => /usr/bin/cygkrb5support-0.dll (0x3fd7f0000)
        cygcom_err-2.dll => /usr/bin/cygcom_err-2.dll (0x3ffbd0000)
        cygiconv-2.dll => /usr/bin/cygiconv-2.dll (0x3fe0d0000)
        cygunistring-2.dll => /usr/bin/cygunistring-2.dll (0x3fbc40000)
        cyglber-2.dll => /usr/bin/cyglber-2.dll (0x3fd730000)
        cygsasl2-3.dll => /usr/bin/cygsasl2-3.dll (0x3fc3f0000)
        cyggpg-error-0.dll => /usr/bin/cyggpg-error-0.dll (0x3fe6e0000)
        cyggcc_s-seh-1.dll => /usr/bin/cyggcc_s-seh-1.dll (0x3fee10000)

When I try to compile with extra Coding, the situation is getting Worse ..

int main()
{
  BIO *cbio;
  ERR_load_crypto_strings();
  cbio = BIO_new_connect("localhost:http");
  if(BIO_do_connect(cbio) <= 0) {
    fprintf(stderr, "Error connecting to serve\n");
    ERR_print_errors_fp(stderr);
  }
  return 0;
}

$ g++ -O0 -std=c++11 -x c++ -lssl -lcrypto ./tls.hpp
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc4wqkGZ.o:tls.hpp:(.text+0x23): undefined reference to `OPENSSL_init_crypto'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc4wqkGZ.o:tls.hpp:(.text+0x32): undefined reference to `BIO_new_connect'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc4wqkGZ.o:tls.hpp:(.text+0x53): undefined reference to `BIO_ctrl'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc4wqkGZ.o:tls.hpp:(.text+0x94): undefined reference to `ERR_print_errors_fp'
collect2: error: ld returned 1 exit status

Do I do something Wrong ? .. Am I missing something ?

Thank You in advance for Your help ..
Sincerely,

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux