perl 最新源码 windows下编译
2014-04-29 22:48
253 查看
源码目录:
http://www.cpan.org/src/README.html
解压,\win32目录,
nmake
nmake test
nmake install
1. 使用SDK的头文件,DDK中的cl、link等工具,好处,保证运行库是msvcrt.dll
2. 当然也可以用vs2010不加修改的完成编译,可是用的是MSVCR100。
如果使用gcc编译,可以直接用strawberry即可,遗憾的是activeperl最新三方提供的也是gcc编译,与strawberry基本无异。
==================================================
下面使用方式一进行编译:
比如源码:
http://www.cpan.org/src/5.0/perl-5.18.2.tar.gz
使用方式一的修改点:
(op.c 、toke.c和pad.c有宽字符,用txt另存为ansi编码即可)
win32.c
注释掉:
1.
2.
makefile修改
1. setargv 使用一致的宏
改成:
2. 运行库的扩展支持
增量一些自定义扩展的
3. /GS 去掉
替换为:
4.
比如标准msvcrt.dll中没有localtime_s函数,可以写一个commonCRT.lib包含这个函数即可,如下:
由于ddk中提供的msvcrt.lib不完全包含msvcrt.dll中导出的函数,我们可以自已做一个msvcrtex.lib包含这个函数(使用dumpbin lib工具)。
安装模块:
http://www.cpan.org/src/README.html
解压,\win32目录,
nmake
nmake test
nmake install
1. 使用SDK的头文件,DDK中的cl、link等工具,好处,保证运行库是msvcrt.dll
2. 当然也可以用vs2010不加修改的完成编译,可是用的是MSVCR100。
如果使用gcc编译,可以直接用strawberry即可,遗憾的是activeperl最新三方提供的也是gcc编译,与strawberry基本无异。
==================================================
下面使用方式一进行编译:
比如源码:
http://www.cpan.org/src/5.0/perl-5.18.2.tar.gz
使用方式一的修改点:
(op.c 、toke.c和pad.c有宽字符,用txt另存为ansi编码即可)
win32.c
注释掉:
1.
//~ #if _MSC_VER >= 1400 && defined(_WRITE_ABORT_MSG) //~ # define SET_INVALID_PARAMETER_HANDLER //~ #endif
2.
//~ #if !defined __MINGW32__ /* compiler intolerance */ //~ extern int sys_nerr; //~ #endif
makefile修改
1. setargv 使用一致的宏
$(GLOBEXE) : perlglob$(o) $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ perlglob$(o) setargv$(o)
改成:
$(GLOBEXE) : perlglob$(o) $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ perlglob$(o) $(SETARGV_OBJ)
2. 运行库的扩展支持
LIBC = msvcrt.lib
增量一些自定义扩展的
LIBC = msvcrt.lib msvcrtex.lib commonCRT.lib
3. /GS 去掉
!IF "$(WIN64)" == "define" && "$(CCTYPE)" == "SDK2003SP1" LIBBASEFILES = $(LIBBASEFILES) bufferoverflowU.lib !ENDIF
替换为:
LIBBASEFILES = $(LIBBASEFILES) bufferoverflow.lib
4.
EXTRACFLAGS = -nologo -GF -W3 -GS-
比如标准msvcrt.dll中没有localtime_s函数,可以写一个commonCRT.lib包含这个函数即可,如下:
#include <stdio.h> errno_t localtime_s(struct tm* _tm,const time_t *time ) { _tm=(struct tm *)localtime(time); return 0; }
由于ddk中提供的msvcrt.lib不完全包含msvcrt.dll中导出的函数,我们可以自已做一个msvcrtex.lib包含这个函数(使用dumpbin lib工具)。
C:\Users\G-Spider>perl -V Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -GS- -O1 -MD -DWIN32 -D_CONSOLE -DNO_STRI CT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PE RLIO', optimize='-O1 -MD', cppflags='-DWIN32' ccversion='15.00.30729.207', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksi ze=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -libpath:"c:\perl\lib\CORE" -m achine:x86' libpth=\lib libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.l ib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32 .lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib buffero verflow.lib msvcrt.lib commonCRT.lib ntdll.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg 32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws 2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib buf feroverflow.lib msvcrt.lib commonCRT.lib ntdll.lib libc=msvcrt.lib commonCRT.lib ntdll.lib, so=dll, useshrplib=true, libperl=p erl518.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -libpath:"c:\perl\li b\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at May 3 2014 16:02:42 @INC: C:/perl/site/lib C:/perl/lib .
安装模块:
C:\Users\G-Spider\.cpan\build\DBD-SQLite-1.42-T5V6Gi>nmake install Microsoft (R) Program Maintenance Utility Version 9.00.30729.207 Copyright (C) Microsoft Corporation. All rights reserved. Files found in blib\arch: installing files in blib\lib into architecture depende nt library tree Installing C:\perl\site\lib\auto\DBD\SQLite\SQLite.bs Installing C:\perl\site\lib\auto\DBD\SQLite\SQLite.dll Installing C:\perl\site\lib\auto\DBD\SQLite\SQLite.exp Installing C:\perl\site\lib\auto\DBD\SQLite\SQLite.lib Installing C:\perl\site\lib\auto\share\dist\DBD-SQLite\sqlite3.c Installing C:\perl\site\lib\auto\share\dist\DBD-SQLite\sqlite3.h Installing C:\perl\site\lib\auto\share\dist\DBD-SQLite\sqlite3ext.h Installing C:\perl\site\lib\DBD\SQLite.pm Installing C:\perl\site\lib\DBD\SQLite\Cookbook.pod Appending installation info to c:\perl\lib/perllocal.pod
文件名: C:\perl\bin\perl.exe ------------------------------------------------ 导入表所处的节:.rdata ------------------------------------------------ 导入库: MSVCRT.dll ------------------------------------------------ OriginalFirstThunk 00002088 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 00002000 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 211 _exit 72 _XcptFilter 585 exit 100 __p___initenv 88 __getmainargs 271 _initterm 131 __setusermatherr 157 _adjust_fdiv 106 __p__commode 111 __p__fmode 129 __set_app_type 202 _except_handler3 183 _controlfp ------------------------------------------------ 导入库: perl518.dll ------------------------------------------------ OriginalFirstThunk 000020C0 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 00002038 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 1073 RunPerl
文件名: C:\perl\bin\perl518.dll ------------------------------------------------ 导入表所处的节:.rdata ------------------------------------------------ 导入库: KERNEL32.dll ------------------------------------------------ OriginalFirstThunk 000D998C TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 000C101C ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 278 GetFullPathNameA 279 GetFullPathNameW 675 TlsFree 93 DisableThreadLibraryCalls 605 SetCurrentDirectoryA 484 MultiByteToWideChar 606 SetCurrentDirectoryW 250 GetCurrentThreadId 85 DeleteCriticalSection 269 GetFileAttributesA 429 InterlockedDecrement 179 FreeEnvironmentStringsW 264 GetEnvironmentStringsW 287 GetLogicalDriveStringsW 178 FreeEnvironmentStringsA 262 GetEnvironmentStrings 286 GetLogicalDriveStringsA 373 GetVersionExA 288 GetLogicalDrives 292 GetModuleFileNameA 293 GetModuleFileNameW 74 CreateThread 722 WideCharToMultiByte 151 FindFirstFileW 144 FindClose 158 FindNextFileW 355 GetTempFileNameA 27 CloseHandle 716 WaitForMultipleObjects 184 GenerateConsoleCtrlEvent 670 TerminateProcess 510 Process32Next 508 Process32First 76 CreateToolhelp32Snapshot 495 OpenProcess 375 GetVolumeInformationA 273 GetFileInformationByHandle 52 CreateFileA 148 FindFirstFileA 265 GetEnvironmentVariableA 324 GetProcessTimes 247 GetCurrentProcess 432 InterlockedIncrement 667 SystemTimeToFileTime 616 SetFileAttributesA 620 SetFileTime 276 GetFileTime 351 GetSystemTimeAsFileTime 347 GetSystemInfo 206 GetComputerNameA 267 GetExitCodeProcess 268 GetExitCodeThread 468 LockFileEx 687 UnlockFileEx 175 FormatMessageA 460 LocalFree 456 LocalAlloc 57 CreateHardLinkW 478 MoveFileExA 235 GetConsoleMode 610 SetEnvironmentVariableA 245 GetCurrentDirectoryA 68 CreateProcessA 451 LoadLibraryExA 318 GetProcAddress 338 GetStdHandle 577 SetConsoleCtrlHandler 662 Sleep 671 TerminateThread 335 GetShortPathNameW 357 GetTempPathA 636 SetStdHandle 609 SetEndOfFile 266 GetEnvironmentVariableW 294 GetModuleHandleA 677 TlsSetValue 676 TlsGetValue 536 ReadFile 735 WriteFile 618 SetFilePointer 99 DuplicateHandle 180 FreeLibrary 523 RaiseException 430 InterlockedExchange 450 LoadLibraryA 426 InitializeCriticalSection 674 TlsAlloc 282 GetLastError 625 SetLastError 102 EnterCriticalSection 458 LocalFileTimeToFileTime 449 LeaveCriticalSection ------------------------------------------------ 导入库: USER32.dll ------------------------------------------------ OriginalFirstThunk 000D9D68 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 000C13F8 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 480 PostQuitMessage 149 DispatchMessageA 642 TranslateMessage 19 CallMsgFilterA 476 PeekMessageA 458 MsgWaitForMultipleObjects 405 KillTimer 142 DestroyWindow 594 SetTimer 89 CreateWindowExA 498 RegisterClassA 132 DefWindowProcA 478 PostMessageA 47 CharUpperA 481 PostThreadMessageA ------------------------------------------------ 导入库: ADVAPI32.dll ------------------------------------------------ OriginalFirstThunk 000D9970 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 000C1000 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 347 RegCloseKey 370 RegOpenKeyExA 215 GetUserNameA 379 RegQueryValueExA ------------------------------------------------ 导入库: COMCTL32.dll ------------------------------------------------ OriginalFirstThunk 000D9984 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 000C1014 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 17 (按序号导入) ------------------------------------------------ 导入库: MSVCRT.dll ------------------------------------------------ OriginalFirstThunk 000D9B00 TimeDateStamp 00000000 ForwarderChain 00000000 FirstThunk 000C1190 ------------------------------------------------ 导入序号 导入函数名称 ------------------------------------------------ 606 free 157 _adjust_fdiv 271 _initterm 14 ??1type_info@@UAE@XZ 179 _close 404 _putenv 215 _fdopen 213 _fcloseall 230 _flushall 209 _execvp 664 memmove 695 strchr 573 atoi 200 _errno 665 memset 696 strcmp 663 memcpy 704 strncmp 702 strlen 662 memcmp 652 localeconv 685 setlocale 724 toupper 630 islower 723 tolower 634 isupper 714 strxfrm 198 _environ 661 memchr 585 exit 710 strtod 709 strstr 437 _spawnv 424 _setjmp3 676 qsort 656 longjmp 720 time 669 pow 598 fmod 597 floor 570 atan2 580 cos 586 exp 654 log 691 sqrt 688 sin 678 rand 692 srand 577 ceil 633 isspace 667 modf 653 localtime 625 isalpha 699 strcspn 690 sprintf 648 isxdigit 632 ispunct 631 isprint 628 isgraph 627 isdigit 626 iscntrl 624 isalnum 608 frexp 712 strtol 481 _vsnprintf 701 strftime 584 div 694 strcat 698 strcpy 705 strncpy 735 wcscat 739 wcscpy 745 wcsncpy 742 wcslen 611 fsetpos 593 fgetpos 722 tmpnam 211 _exit 16 ??3@YAXPAX@Z 575 bsearch 564 abort 657 malloc 707 strrchr 679 realloc 15 ??2@YAPAXI@Z 588 fclose 275 _iob 592 fgetc 727 ungetc 160 _assert 257 _getpid 443 _stati64 579 clock 245 _get_osfhandle 590 ferror 589 feof 700 strerror 462 _sys_nerr 729 vfprintf 731 vprintf 605 fread 614 fwrite 607 freopen 602 fputs 601 fputc 616 getc 578 clearerr 591 fflush 464 _telli64 610 fseek 682 rewind 239 _fstati64 400 _pipe 325 _lseeki64 668 perror 684 setbuf 686 setvbuf 594 fgets 619 gets 671 putc 673 puts 617 getchar 672 putchar 576 calloc 392 _open_osfhandle 687 signal 599 fopen 231 _fmode 736 wcschr 182 _control87 753 wcstombs 459 _strupr 142 _access 249 _getcwd 387 _mktemp 475 _umask 203 _execl 222 _fileno 477 _unlink 480 _utime 449 _stricmp 427 _setmode 391 _open 199 _eof 193 _dup 194 _dup2 408 _read 535 _write 386 _mkdir 409 _rmdir 172 _chdir 176 _chmod 207 _execv
相关文章推荐
- windows下CSipSimple编译【带最新源码】
- FBReader 最新源码编译(Windows环境)和研究(一)
- cpp_redis (Windows C++ Redis客户端)(C++11实现)官方最新源码编译
- windows平台源码编译最新版openssl
- windows xp vc 6.0编译最新net-snmp源码
- 在windows系统下用VC6编译最新版PHP5.3.3扩展(以vld为例)
- netcdf源码在windows上的编译
- 利用Cmake 将最新版本OBS编译成windows版本。
- 分享实用工具源码--实现Windows IDE中查看Linux下编译信息
- 最新ffmpeg编译和用eclipse进行源码调试(linux)
- docker最新代码源码编译
- Android源码编译全过程记录(基于最新安卓5.1.0)【转】
- windows环境下编译spark源码和搭建源码调试环境
- Lua源码阅读一——在Windows下编译
- windows环境下编译最新的x264库
- Windows Spring源码编译
- Windows 源码编译Hadoop 2.7.4生成X64
- 3gpp amr 源码 windows 下编译及使用
- Ubuntu12.04编译hadoop2.6.0源码与源码导入windows下的Eclipse查看方法
- SQLite3源码在Windows及WinCE平台下的编译方法