Bug #3231
closedDigest Does Not Build
Description
=begin
Revisiting this one from a few weeks back. MD5/rmd160/sha1/sha2 do not build using VC 2010. They do build with Mingw (mingw + msys). See compiler logs below.
Focusing on MD5 (they all have the same issue):
extconf.h is generated like this:
#ifndef EXTCONF_H
#define EXTCONF_H
#define HAVE_CONFIG_H 1
#define HAVE_OPENSSL_MD5_H 1
#endif
Then in md5init.c:
#include "digest.h"
#if defined(HAVE_OPENSSL_MD5_H)
#include "md5ossl.h"
#else
#include "md5.h"
#endif
Since extconf.h is never passed to the compiler, the error happens. Adding this to the top of the file:
#define HAVE_OPENSSL_MD5_H
Fixes the issue. Clearly that's a hack, but I don't understand how extconf.h is used in building the extension since the only place it comes into play is in the generated makefile:
$(OBJS): $(RUBY_EXTCONF_H)
So not sure the solution, but the problem is that having openssl installed correctly breaks the VC digest extension build.
-
Digest/MD5
cl -nologo -LD -Fe../../../.ext/i386-mswin32_100/digest/md5.so md5init.obj md5ossl.obj msvcr100-ruby191.lib crypto.lib unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -incremental:no -debug -opt:ref -opt:icf -dll -libpath:. -libpath:../../.. -implib:md5-i386-mswin32_100.lib -pdb:md5-i386-mswin32_100.pdb -def:md5-i386-mswin32_100.def
Creating library md5-i386-mswin32_100.lib and object md5-i386-mswin32_100.exp
md5init.obj : error LNK2001: unresolved external symbol _rb_Digest_MD5_Finish
md5init.obj : error LNK2001: unresolved external symbol _rb_Digest_MD5_Update
md5init.obj : error LNK2001: unresolved external symbol _rb_Digest_MD5_Init
../../../.ext/i386-mswin32_100/digest/md5.so : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop. -
Digest/rmd160
cl -nologo -LD -Fe../../../.ext/i386-mswin32_100/digest/rmd160.so rmd160init.obj rmd160ossl.obj msvcr100-ruby191.lib crypto.lib unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -incremental:no -debug -opt:ref -opt:icf -dll -libpath:. -libpath:../../.. -implib:rmd160-i386-mswin32_100.lib -pdb:rmd160-i386-mswin32_100.pdb -def:rmd160-i386-mswin32_100.def
Creating library rmd160-i386-mswin32_100.lib and object rmd160-i386-mswin32_100.exp
rmd160init.obj : error LNK2001: unresolved external symbol _rb_Digest_RMD160_Finish
rmd160init.obj : error LNK2001: unresolved external symbol _rb_Digest_RMD160_Update
rmd160init.obj : error LNK2001: unresolved external symbol _rb_Digest_RMD160_Init
../../../.ext/i386-mswin32_100/digest/rmd160.so : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2' -
Digest/sha1
cl -nologo -LD -Fe../../../.ext/i386-mswin32_100/digest/sha1.so sha1init.obj sha1ossl.obj msvcr100-ruby191.lib crypto.lib unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -incremental:no -debug -opt:ref -opt:icf -dll -libpath:. -libpath:../../.. -implib:sha1-i386-mswin32_100.lib -pdb:sha1-i386-mswin32_100.pdb -def:sha1-i386-mswin32_100.def
Creating library sha1-i386-mswin32_100.lib and object sha1-i386-mswin32_100.exp
sha1init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA1_Finish
sha1init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA1_Update
sha1init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA1_Init
../../../.ext/i386-mswin32_100/digest/sha1.so : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop. -
Digest/sha2
cl -nologo -LD -Fe../../../.ext/i386-mswin32_100/digest/sha2.so sha2init.obj sha2ossl.obj msvcr100-ruby191.lib crypto.lib unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link -incremental:no -debug -opt:ref -opt:icf -incremental:no -debug -opt:ref -opt:icf -dll -libpath:. -libpath:../../.. -implib:sha2-i386-mswin32_100.lib -pdb:sha2-i386-mswin32_100.pdb -def:sha2-i386-mswin32_100.def
Creating library sha2-i386-mswin32_100.lib and object sha2-i386-mswin32_100.exp
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA512_Finish
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA512_Update
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA512_Init
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA384_Finish
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA384_Update
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA384_Init
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA256_Finish
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA256_Update
sha2init.obj : error LNK2001: unresolved external symbol _rb_Digest_SHA256_Init
../../../.ext/i386-mswin32_100/digest/sha2.so : fatal error LNK1120: 9 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
c:\Development\src\ruby\ext\digest\sha2>
=end
Files