我正在尝试在Windows上创建一个32位动态版本的OpenSSL。我还在Windows上构建了一个32位动态版本的Zlib。我的Zlib目录中没有可用的静态版本。
我读过的每个地方都说过所需要的一切;但是,当我编译Zlib时,它不会作为库中的依赖项出现。如何让OpenSSL以动态链接Zlib?
配置调用:
perl Configure threads shared zlib-dynamic --prefix=C:\local\windows\vc11\32\openssl --with-zlib-lib=C:\local\windows\vc11\32\zlib\lib\zlibd.lib --with-zlib-include=C:\local\windows\vc11\32\zlib\include no-rc5 no-idea no-ssl2 -D_REENTRANT debug-VC-WIN32
输出:
Configuring for debug-VC-WIN32
no-ec_nistp_64_gcc_128 [default] OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
no-gmp [default] OPENSSL_NO_GMP (skip dir)
no-idea [option] OPENSSL_NO_IDEA (skip dir)
no-jpake [experimental] OPENSSL_NO_JPAKE (skip dir)
no-krb5 [krb5-flavor not specified] OPENSSL_NO_KRB5
no-md2 [default] OPENSSL_NO_MD2 (skip dir)
no-rc5 [option] OPENSSL_NO_RC5 (skip dir)
no-rfc3779 [default] OPENSSL_NO_RFC3779 (skip dir)
no-sctp [default] OPENSSL_NO_SCTP (skip dir)
no-ssl2 [option] OPENSSL_NO_SSL2 (skip dir)
no-store [experimental] OPENSSL_NO_STORE (skip dir)
no-unit-test [default] OPENSSL_NO_UNIT_TEST (skip dir)
IsMK1MF=1
CC =cl
CFLAG =-DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -DDSO_WIN32 -D_REENTRANT -W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
EX_LIBS =
CPUID_OBJ =x86cpuid.o
BN_ASM =bn-586.o co-586.o x86-mont.o x86-gf2m.o
DES_ENC =des-586.o crypt586.o
AES_ENC =aes-586.o vpaes-x86.o aesni-x86.o
BF_ENC =bf-586.o
CAST_ENC =c_enc.o
RC4_ENC =rc4-586.o
RC5_ENC =rc5-586.o
MD5_OBJ_ASM =md5-586.o
SHA1_OBJ_ASM =sha1-586.o sha256-586.o sha512-586.o
RMD160_OBJ_ASM=rmd-586.o
CMLL_ENC =cmll-x86.o
MODES_OBJ =ghash-x86.o
ENGINES_OBJ =
PROCESSOR =
RANLIB =true
ARFLAGS =
PERL =perl
THIRTY_TWO_BIT mode
BN_LLONG mode
RC4_INDEX mode
RC4_CHUNK is undefined
Configured for debug-VC-WIN32.
命令:ms\do_nasm.bat
输出:
C:\Source\OpenSsl\openssl-1.0.1j>perl util\mkfiles.pl 1>MINFO
C:\Source\OpenSsl\openssl-1.0.1j>perl util\mk1mf.pl dll nasm VC-WIN32 1>ms\ntdll.mak
...
Link Ret:$(BIN_D)\$(E_EXE).exe: $(E_OBJ) $(LIBS_DEP)
$(LINK) $(LFLAGS) /out:$(BIN_D)\$(E_EXE).exe @<<
$(APP_EX_OBJ) $(E_OBJ) $(L_LIBS) $(EX_LIBS)
<<
IF EXIST $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
# Post zlib_opt:2
# Post zlib_lib:C:\local\windows\vc11\32\zlib\lib\zlibd.lib
Dumpbins:
Dump of file libeay32.dll
File Type: DLL
Section contains the following imports:
WS2_32.dll
100B620C Import Address Table
100EEB04 Import Name Table
0 time date stamp
0 Index of first forwarder reference
Ordinal 20
Ordinal 17
Ordinal 116
Ordinal 115
Ordinal 55
Ordinal 52
Ordinal 15
Ordinal 14
Ordinal 13
Ordinal 7
Ordinal 10
Ordinal 2
Ordinal 1
Ordinal 23
Ordinal 21
Ordinal 9
Ordinal 8
Ordinal 4
Ordinal 111
Ordinal 112
Ordinal 22
Ordinal 19
Ordinal 16
Ordinal 3
GDI32.dll
100B6010 Import Address Table
100EE908 Import Name Table
0 time date stamp
0 Index of first forwarder reference
2C9 SelectObject
1EB GetDeviceCaps
1C7 GetBitmapBits
105 DeleteObject
102 DeleteDC
32 CreateDCA
31 CreateCompatibleDC
30 CreateCompatibleBitmap
13 BitBlt
21B GetObjectA
ADVAPI32.dll
100B6000 Import Address Table
100EE8F8 Import Name Table
0 time date stamp
0 Index of first forwarder reference
2AA RegisterEventSourceA
EB DeregisterEventSource
2BA ReportEventA
USER32.dll
100B61F8 Import Address Table
100EEAF0 Import Name Table
0 time date stamp
0 Index of first forwarder reference
138 GetDesktopWindow
244 MessageBoxA
1B7 GetUserObjectInformationW
192 GetProcessWindowStation
MSVCR110.dll
100B60AC Import Address Table
100EE9A4 Import Name Table
0 time date stamp
0 Index of first forwarder reference
190 __clean_type_info_names_internal
422 _onexit
469 _snprintf
279 _exit
69C wcsstr
1B6 __iob_func
67A vfprintf
50A _vsnprintf
639 raise
63C realloc
61D malloc
5E4 free
628 memcpy
37A _localtime64
4CA _time64
62C memset
2EF _gmtime64
49A _stricmp
4A4 _strnicmp
26D _errno
65D strncpy
626 memchr
62A memmove
43B _read
588 _write
5FE isdigit
613 isxdigit
5DC fprintf
5BF atoi
648 sprintf
663 strstr
5DF fputs
5CF fclose
5D0 feof
5D1 ferror
5D2 fflush
5D5 fgets
287 _fileno
5DA fopen
5E2 fread
5EA fseek
5EC ftell
5EF fwrite
56D _wfopen
466 _setmode
650 strchr
62E perror
2B4 _ftime64
637 qsort
651 strcmp
27F _fdopen
5F4 getenv
235 _chmod
423 _open
490 _stat64i32
656 strerror
604 isspace
5FB isalnum
674 tolower
65C strncmp
605 isupper
668 strtoul
661 strrchr
64C sscanf
5CC exit
667 strtol
645 signal
2D6 _getch
630 printf
24B _crt_debugger_hook
1AA __crtUnhandledException
1A9 __crtTerminateProcess
270 _except_handler4_common
173 __CppXcptFilter
215 _amsg_exit
38D _malloc_crt
2FE _initterm
2FF _initterm_e
37C _lock
4E6 _unlock
22B _calloc_crt
1AC __dllonexit
KERNEL32.dll
100B603C Import Address Table
100EE934 Import Name Table
0 time date stamp
0 Index of first forwarder reference
1B8 FreeLibrary
8E CloseHandle
199 FindNextFileA
188 FindFirstFileA
3C0 LoadLibraryA
321 GetVersion
228 GetCurrentThreadId
26A GetLastError
257 GetFileType
2DD GetStdHandle
517 SetLastError
3EC MultiByteToWideChar
43C QueryPerformanceCounter
224 GetCurrentProcessId
310 GetTickCount
322 GetVersionExA
341 GlobalMemoryStatus
1AC FlushConsoleInputBuffer
383 IsDebuggerPresent
13C EncodePointer
388 IsProcessorFeaturePresent
117 DecodePointer
2F4 GetSystemTimeAsFileTime
184 FindClose
2B5 GetProcAddress
27E GetModuleHandleA
16D ExitProcess
Summary
9000 .data
54000 .rdata
B000 .reloc
1000 .rsrc
B5000 .text
Dump of file ssleay32.dll
File Type: DLL
Section contains the following imports:
LIBEAY32.dll
1002E030 Import Address Table
10035B9C Import Name Table
0 time date stamp
0 Index of first forwarder reference
Ordinal 903
Ordinal 188
Ordinal 181
Ordinal 3245
Ordinal 66
Ordinal 52
Ordinal 111
Ordinal 110
Ordinal 151
Ordinal 123
Ordinal 118
Ordinal 120
Ordinal 128
Ordinal 165
Ordinal 32
Ordinal 490
Ordinal 2760
Ordinal 495
Ordinal 498
Ordinal 4540
Ordinal 202
Ordinal 203
Ordinal 201
Ordinal 219
Ordinal 252
Ordinal 222
Ordinal 3837
Ordinal 3844
Ordinal 3896
Ordinal 3899
Ordinal 2630
Ordinal 2821
Ordinal 3883
Ordinal 3109
Ordinal 269
Ordinal 2936
Ordinal 2894
Ordinal 276
Ordinal 274
Ordinal 289
Ordinal 290
Ordinal 961
Ordinal 256
Ordinal 3315
Ordinal 2927
Ordinal 285
Ordinal 281
Ordinal 4119
Ordinal 4430
Ordinal 4233
Ordinal 4474
Ordinal 4369
Ordinal 4245
Ordinal 1070
Ordinal 4488
Ordinal 3695
Ordinal 3570
Ordinal 2924
Ordinal 2929
Ordinal 3010
Ordinal 3178
Ordinal 2578
Ordinal 3663
Ordinal 3422
Ordinal 3729
Ordinal 3575
Ordinal 3512
Ordinal 3608
Ordinal 3459
Ordinal 3480
Ordinal 3550
Ordinal 3666
Ordinal 3644
Ordinal 866
Ordinal 641
Ordinal 754
Ordinal 654
Ordinal 635
Ordinal 2747
Ordinal 2784
Ordinal 2572
Ordinal 964
Ordinal 965
Ordinal 2206
Ordinal 2201
Ordinal 3489
Ordinal 907
Ordinal 904
Ordinal 176
Ordinal 87
Ordinal 486
Ordinal 497
Ordinal 493
Ordinal 484
Ordinal 205
Ordinal 206
Ordinal 216
Ordinal 363
Ordinal 2712
Ordinal 2925
Ordinal 3165
Ordinal 268
Ordinal 333
Ordinal 316
Ordinal 282
Ordinal 4125
Ordinal 4262
Ordinal 4164
Ordinal 1071
Ordinal 2877
Ordinal 3711
Ordinal 3682
Ordinal 3719
Ordinal 577
Ordinal 763
Ordinal 572
Ordinal 464
Ordinal 4046
Ordinal 481
Ordinal 3528
Ordinal 3418
Ordinal 3244
Ordinal 1096
Ordinal 1097
Ordinal 78
Ordinal 109
Ordinal 95
Ordinal 3816
Ordinal 3873
Ordinal 3836
Ordinal 3888
Ordinal 3891
Ordinal 3874
Ordinal 2589
Ordinal 2915
Ordinal 323
Ordinal 3906
Ordinal 1144
Ordinal 1145
Ordinal 3823
Ordinal 3846
Ordinal 89
Ordinal 2292
Ordinal 1081
Ordinal 187
Ordinal 623
Ordinal 622
Ordinal 857
Ordinal 679
Ordinal 3857
Ordinal 267
Ordinal 503
Ordinal 1012
Ordinal 3631
Ordinal 3479
Ordinal 3664
Ordinal 3737
Ordinal 3633
Ordinal 3675
Ordinal 341
Ordinal 1011
Ordinal 3067
Ordinal 266
Ordinal 264
Ordinal 912
Ordinal 3312
Ordinal 3313
Ordinal 541
Ordinal 3925
Ordinal 3922
Ordinal 3124
Ordinal 2702
Ordinal 2898
Ordinal 1202
Ordinal 4144
Ordinal 4372
Ordinal 3782
Ordinal 2400
Ordinal 4174
Ordinal 3866
Ordinal 313
Ordinal 3724
Ordinal 3767
Ordinal 3758
Ordinal 3704
Ordinal 3647
Ordinal 3365
Ordinal 3766
Ordinal 3460
Ordinal 4114
Ordinal 3783
Ordinal 3454
Ordinal 3394
Ordinal 3754
Ordinal 1655
Ordinal 914
Ordinal 1041
Ordinal 1027
Ordinal 1025
Ordinal 1004
Ordinal 1007
Ordinal 1005
Ordinal 3826
Ordinal 53
Ordinal 85
Ordinal 67
Ordinal 65
Ordinal 74
Ordinal 98
Ordinal 58
Ordinal 892
Ordinal 890
Ordinal 897
Ordinal 2257
Ordinal 248
Ordinal 364
Ordinal 4331
Ordinal 4513
Ordinal 1010
Ordinal 629
Ordinal 626
Ordinal 628
Ordinal 630
Ordinal 3437
Ordinal 3527
Ordinal 3378
Ordinal 3610
Ordinal 3414
Ordinal 3495
Ordinal 3399
Ordinal 3559
Ordinal 575
Ordinal 636
Ordinal 2051
Ordinal 2478
Ordinal 246
Ordinal 3657
Ordinal 3396
Ordinal 911
Ordinal 93
Ordinal 1100
Ordinal 1023
Ordinal 2524
Ordinal 3505
Ordinal 3595
Ordinal 657
Ordinal 401
Ordinal 891
Ordinal 887
Ordinal 889
Ordinal 4045
Ordinal 2475
Ordinal 368
Ordinal 370
Ordinal 367
Ordinal 369
Ordinal 1671
Ordinal 189
Ordinal 1147
Ordinal 314
Ordinal 315
Ordinal 4383
Ordinal 4320
Ordinal 956
Ordinal 750
Ordinal 3205
Ordinal 279
Ordinal 283
Ordinal 748
Ordinal 280
Ordinal 774
Ordinal 751
Ordinal 2181
Ordinal 1959
Ordinal 400
Ordinal 399
Ordinal 3513
Ordinal 716
Ordinal 822
Ordinal 718
Ordinal 824
Ordinal 8
Ordinal 7
Ordinal 3700
Ordinal 3623
Ordinal 37
Ordinal 35
Ordinal 703
Ordinal 1091
Ordinal 88
Ordinal 2426
Ordinal 86
Ordinal 680
Ordinal 1101
Ordinal 299
Ordinal 304
Ordinal 329
Ordinal 325
Ordinal 959
Ordinal 4601
Ordinal 3155
Ordinal 2996
Ordinal 4615
Ordinal 4637
Ordinal 4656
Ordinal 3795
Ordinal 3807
Ordinal 3914
Ordinal 292
Ordinal 293
Ordinal 2252
Ordinal 91
Ordinal 955
Ordinal 225
Ordinal 247
Ordinal 125
Ordinal 129
Ordinal 4572
Ordinal 4580
Ordinal 4576
Ordinal 4570
Ordinal 4578
Ordinal 4582
Ordinal 4573
Ordinal 4577
Ordinal 4581
Ordinal 4575
Ordinal 4584
Ordinal 910
Ordinal 909
Ordinal 905
Ordinal 2411
Ordinal 1653
Ordinal 1654
Ordinal 170
Ordinal 3239
Ordinal 168
Ordinal 167
Ordinal 3314
Ordinal 169
MSVCR110.dll
1002E584 Import Address Table
100360F0 Import Name Table
0 time date stamp
0 Index of first forwarder reference
173 __CppXcptFilter
215 _amsg_exit
5E4 free
38D _malloc_crt
2FE _initterm
2FF _initterm_e
24B _crt_debugger_hook
1AA __crtUnhandledException
1A9 __crtTerminateProcess
37C _lock
4E6 _unlock
22B _calloc_crt
1AC __dllonexit
422 _onexit
190 __clean_type_info_names_internal
270 _except_handler4_common
26D _errno
650 strchr
2B4 _ftime64
65C strncmp
62C memset
628 memcpy
65D strncpy
62A memmove
4CA _time64
5DC fprintf
1B6 __iob_func
5B5 abort
KERNEL32.dll
1002E000 Import Address Table
10035B6C Import Name Table
0 time date stamp
0 Index of first forwarder reference
26A GetLastError
388 IsProcessorFeaturePresent
13C EncodePointer
117 DecodePointer
383 IsDebuggerPresent
43C QueryPerformanceCounter
224 GetCurrentProcessId
228 GetCurrentThreadId
2F4 GetSystemTimeAsFileTime
12E DisableThreadLibraryCalls
517 SetLastError
Summary
4000 .data
B000 .rdata
3000 .reloc
1000 .rsrc
2D000 .text
答案 0 :(得分:3)
在Windows中使用Dynamic Zlib进行编译...
当您静态链接zlib或使用no-comp
等选项时,通常会收到类似no-zlib-dynamic
的消息。我没有看到,所以我相信你得到了你所期望的。
但是,当我编译Zlib时,它不会作为库中的依赖项出现。
您是否可以在导入表上提供输出dumpbin
或使用Dependency Walker等内容查找依赖项?
相关:通常,您应该尝试避免压缩,因为它会泄漏信息。因此,您通常使用no-comp
进行配置。我只能说“通常”因为我不了解你的要求。
答案 1 :(得分:1)
如果你看一下OpenSSL源文件c_zlib.c,你会看到:
/*
* When OpenSSL is built on Windows, we do not want to require that
* the ZLIB.DLL be available in order for the OpenSSL DLLs to
* work. Therefore, all ZLIB routines are loaded at run time
* and we do not link to a .LIB file when ZLIB_SHARED is set.
*/
以及此行以下的代码:
zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
p_compress = (compress_ft) DSO_bind_func(zlib_dso, "compress");
p_inflate = (inflate_ft) DSO_bind_func(zlib_dso, "inflate");
...
因此,zlib1.dll将被此代码动态加载和绑定,因此您无法在libeay32.dll中看到与zlib1.dll的静态链接。
换句话说,一切都会很好地工作:)