mingw: pkg-config --libs outputs gdi32 before crypto

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

mingw: pkg-config --libs outputs gdi32 before crypto

Ray Satiro
OpenSSL 1.0.2d static built with mingw32.

make clean
perl ./Configure mingw
make depend
make
make check
make install

I'm using the pkg-config 0.26 that comes with Strawberry Perl to get the
libs when I want to link to OpenSSL:

pkg-config --static --libs-only-l openssl
-lssl -lws2_32 -lgdi32 -lcrypt32 -lcrypto

I see errors related to the order:
libcrypto.a(rand_win.o):rand_win.c:(.text+0xeab): undefined reference to
`_GetDeviceCaps@8'

I'd expect gdi32 after crypto. The pc files generated by OpenSSL appear
to do that but that's not the output pkg-config gives me. I'm not sure
if this is an OpenSSL issue or a pkg-config issue. Is anyone else using
pkg-config successfully in this configuration?

Briefly:

openssl.pc
----------
Name: OpenSSL
Description: Secure Sockets Layer and cryptography libraries and tools
Version: 1.0.2d
Requires: libssl libcrypto


libcrypto.pc
------------
Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Version: 1.0.2d
Requires:
Libs: -L${libdir} -lcrypto
Libs.private: -lws2_32 -lgdi32 -lcrypt32
Cflags: -I${includedir}


libssl.pc
---------
Name: OpenSSL-libssl
Description: Secure Sockets Layer and cryptography libraries
Version: 1.0.2d
Requires.private: libcrypto
Libs: -L${libdir} -lssl
Libs.private: -lws2_32 -lgdi32 -lcrypt32
Cflags: -I${includedir}

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: mingw: pkg-config --libs outputs gdi32 before crypto

Richard Levitte - VMS Whacker
This is quite odd.  Just for comparison, I tried the same on my laptop
(running Debian):

    : ; pkg-config --static --libs-only-l openssl
    -lssl -ldl -lcrypto -ldl

My .pc files look like this:

    : ; cat /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc
    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib/x86_64-linux-gnu
    includedir=${prefix}/include
   
    Name: OpenSSL
    Description: Secure Sockets Layer and cryptography libraries and tools
    Version: 1.0.2d
    Requires: libssl libcrypto
    : ; cat /usr/lib/x86_64-linux-gnu/pkgconfig/libssl.pc
    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib/x86_64-linux-gnu
    includedir=${prefix}/include
   
    Name: OpenSSL-libssl
    Description: Secure Sockets Layer and cryptography libraries
    Version: 1.0.2d
    Requires.private: libcrypto
    Libs: -L${libdir} -lssl
    Libs.private: -ldl
    Cflags: -I${includedir}
    : ; cat /usr/lib/x86_64-linux-gnu/pkgconfig/libcrypto.pc
    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib/x86_64-linux-gnu
    includedir=${prefix}/include
   
    Name: OpenSSL-libcrypto
    Description: OpenSSL cryptography library
    Version: 1.0.2d
    Requires:
    Libs: -L${libdir} -lcrypto
    Libs.private: -ldl
    Cflags: -I${includedir}

As you can see, my '-ldl' is specified the same way as your '-lws2_32
-lgdi32 -lcrypt32' (*).

    : ; pkg-config --version
    0.28

Cheers,
Richard

(*) quite interestingly, really, as libssl doesn't have any direct
dependency with libdl...

In message <[hidden email]> on Tue, 20 Oct 2015 21:30:43 -0400, Ray Satiro <[hidden email]> said:

raysatiro> OpenSSL 1.0.2d static built with mingw32.
raysatiro>
raysatiro> make clean
raysatiro> perl ./Configure mingw
raysatiro> make depend
raysatiro> make
raysatiro> make check
raysatiro> make install
raysatiro>
raysatiro> I'm using the pkg-config 0.26 that comes with Strawberry Perl to get
raysatiro> the libs when I want to link to OpenSSL:
raysatiro>
raysatiro> pkg-config --static --libs-only-l openssl
raysatiro> -lssl -lws2_32 -lgdi32 -lcrypt32 -lcrypto
raysatiro>
raysatiro> I see errors related to the order:
raysatiro> libcrypto.a(rand_win.o):rand_win.c:(.text+0xeab): undefined reference
raysatiro> to `_GetDeviceCaps@8'
raysatiro>
raysatiro> I'd expect gdi32 after crypto. The pc files generated by OpenSSL
raysatiro> appear to do that but that's not the output pkg-config gives me. I'm
raysatiro> not sure if this is an OpenSSL issue or a pkg-config issue. Is anyone
raysatiro> else using pkg-config successfully in this configuration?
raysatiro>
raysatiro> Briefly:
raysatiro>
raysatiro> openssl.pc
raysatiro> ----------
raysatiro> Name: OpenSSL
raysatiro> Description: Secure Sockets Layer and cryptography libraries and tools
raysatiro> Version: 1.0.2d
raysatiro> Requires: libssl libcrypto
raysatiro>
raysatiro>
raysatiro> libcrypto.pc
raysatiro> ------------
raysatiro> Name: OpenSSL-libcrypto
raysatiro> Description: OpenSSL cryptography library
raysatiro> Version: 1.0.2d
raysatiro> Requires:
raysatiro> Libs: -L${libdir} -lcrypto
raysatiro> Libs.private: -lws2_32 -lgdi32 -lcrypt32
raysatiro> Cflags: -I${includedir}
raysatiro>
raysatiro>
raysatiro> libssl.pc
raysatiro> ---------
raysatiro> Name: OpenSSL-libssl
raysatiro> Description: Secure Sockets Layer and cryptography libraries
raysatiro> Version: 1.0.2d
raysatiro> Requires.private: libcrypto
raysatiro> Libs: -L${libdir} -lssl
raysatiro> Libs.private: -lws2_32 -lgdi32 -lcrypt32
raysatiro> Cflags: -I${includedir}
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: mingw: pkg-config --libs outputs gdi32 before crypto

Ray Satiro
On 10/24/2015 11:41 AM, Richard Levitte wrote:
> This is quite odd.  Just for comparison, I tried the same on my laptop
> (running Debian):
>
>      : ; pkg-config --static --libs-only-l openssl
>      -lssl -ldl -lcrypto -ldl

Thanks for checking Richard. I installed pkg-config .29 and that solved
the problem so I guess it was a bug in pkg-config. Now I get the same
pattern, ie -lssl <libs> -lcrypto <libs>

$ pkg-config --static --libs-only-l openssl
-lssl -lws2_32 -lgdi32 -lcrypt32 -lcrypto -lws2_32 -lgdi32 -lcrypt32


Side note for anyone who needs to install the latest pkg-config in
mingw32, these are the steps I followed:

Get the latest version at http://pkgconfig.freedesktop.org/releases/?C=M;O=D
Since mingw32 doesn't have MemoryBarrier() I used mfence:

CFLAGS="-g -O2 -DMemoryBarrier\\(\\)=asm\\(\\\"mfence\\;\\\"\\)"
./configure --with-internal-glib >config.out 2>&1
make V=1 >make.out 2>&1
make install

So pkg.m4 can be found add /usr/local/share/aclocal to the aclocal
dirlist if it's not there already:

grep -E "^/usr/local/share/aclocal$" /mingw/share/aclocal/dirlist
2>/dev/null
if [[ $? -ne 0 ]]; then echo /usr/local/share/aclocal >>
/mingw/share/aclocal/dirlist; fi


_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev