0

I'm trying to compile an app with static openssl. I compiled openssl with mingw options and now my lib directory has: libcrypto.a libssl.a libcrypto.dll.a libssl.dll.a I used the correct -L compiler options and still I get these errors:

x86_64-w64-mingw32-gcc main.c -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -static -L/rw/usrlocal/lib/ -I/rw/usrlocal/include/ -lssl -lcrypto
                                                               ~~~~~~~~^~~~~
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libssl.a when searching for -lssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lssl
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libcrypto.a when searching for -lcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status

Can someone here tell me why mingw is using the libcrypto.a and not libcrypto.dll.a? And what's more important: How I can change that? Greetings

1 Answers1

0

It literally says "skipping incompatible", which leads me to think the libraries are not targetting the same platform. Are you sure you're not mixing 32-bit and 64-bit Windows?

Run the file command with the .dll file of openssl to see if they are also targetting x86_64.

When building openssl you should specify mingw64 with the ./Configure command.

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40