0

I'm trying to use libMcrypt as a static lib for windows. My code is already using the dll port for it found here. There does not exists a 'vcproj/solution' for the project so I did not know how to go about to compile it directly using visual studio. ( I was getting abundant errors when I tried to create one and compile)

However, I could cross compile using MingW and get a windows dll which worked fine. I found the instructions here. I then compiled a static lib for the same giving --enable=static as an option to configure. It created a .a and .la file successfully.

But when I'm trying to use the compile lib, I'm getting the following linker errors in my project

libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_prm,5' encountered; ignored
libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_sb2,5' encountered; ignored
libmcrypt.lib(loki97.o) : warning LNK4229: invalid directive '/aligncomm:_sb1,5' encountered; ignored
LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
MSVCRT.lib(MSVCR100.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
     Creating library ..\..\..\bin\myProj.lib and object ..\..\..\bin\myProj.exp
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
libmcrypt.lib(blowfish-compat.o) : error LNK2001: unresolved external symbol ___chkstk_ms
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__is_block_algorithm
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_algorithm_version
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_decrypt
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_encrypt
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_algo_iv_size
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_algorithms_name
myProj.exp : error LNK2001: unresolved external symbol arcfour_LTX__mcrypt_get_block_size
  1. From the 1st two errors, I feel it is a CRT mismatch error. How can I give the option to gcc to build static lib without CRT? (I'm not sure if I'm thinking correct)
  2. Or can I use the .a file, extract obj files and recreate a lib from it?
  3. Has anyone compile a static lib for libMcrypt on Windows

Thanks a lot for your help!

mots_g
  • 637
  • 8
  • 27
  • Have you try to search on stackoverflow.com? I think this will help http://stackoverflow.com/questions/2096519/from-mingw-static-library-a-to-visual-studio-static-library-lib – Sergei Nikulov Sep 14 '12 at 09:16
  • @Sergey: Yes, that is exactly what I'm trying (adding the .a file directly to the linker input) but, I'm getting linking errors and also CRT mismatch – mots_g Sep 14 '12 at 10:05
  • so just change your CRT lib as mentioned "Also, there may occur problems regarding mixed C run-time libraries properties of C/C++->Code Generation->Runtime Library" - have you tried this? – Sergei Nikulov Sep 14 '12 at 10:32
  • @Sergey: Yea, it tried those options too, dint make it work. Currently, I'm getting linking errors for some functions in mcrypt.c which are exposed(probably for a dll build). I've modified their signatures but still it doesn't seem to work.. – mots_g Sep 17 '12 at 08:44

0 Answers0