Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert a VSTS .lib to a MinGW .a?

I have a static library compiled with Visual Studio and I want to link to it from MinGW.

I tried changing the suffix but I get a bunch of warnings like: Warning: .drectve /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized.

Also a few errors including: ./libetpan.a(Release_ssl/mailimap.obj):(.text[_mailimap_noop]+0x7): undefined reference to___security_cookie'`.

Any help is greatly appreciated.

like image 871
chacham15 Avatar asked Aug 03 '12 09:08

chacham15


2 Answers

You can try to convert the .lib to .a with

http://code.google.com/p/lib2a/

like image 157
moskito-x Avatar answered Sep 24 '22 21:09

moskito-x


.lib and .a are not the same format. Changing the file extension is lying to the linker, which is why it isn't working.

If it is a 32-bit library you are trying to link, it should "just work." MinGW supports 32-bit .lib files. If it doesn't, file a bug report.

If it is a 64-bit library, and you are using MinGW-w64 or something based on it (like the TDM-GCC 64-bit version) see the MinGW-w64 FAQ entry:

gendef mylib.dll
dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libmylib.a --input-def mylib.def
like image 37
Jonathan Baldwin Avatar answered Sep 24 '22 21:09

Jonathan Baldwin