2017-08-01 112 views
0

我正在閱讀這篇文章。使用Visual Studio 2017構建源於Windows 10的Perl

http://www.cpan.org/src/README.htmlhttp://search.cpan.org/~rjbs/perl-5.16.0/README.win32#Building

我提取的文件:c:\Sources\perl-5.26.0\現在我想建立它。

我設置CCTYPE = MSVC141

我現在運行:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2017 

後來:

C:\Sources\perl-5.26.0>win32\Makefile 
    'win32\Makefile' is not recognized as an internal or external command, 
    operable program or batch file. 

    C:\Sources\perl-5.26.0>nmake -f win32\Makefile 

    Microsoft (R) Program Maintenance Utility Version 14.10.25019.0 
    Copyright (C) Microsoft Corporation. All rights reserved. 

    NMAKE : fatal error U1073: don't know how to make 'config_H.vc' 
    Stop. 

    C:\Sources\perl-5.26.0> 

通過CMake:

mkdir c:\Sources\perl-5.26.0\bld 
cd /d c:\Sources\perl-5.26.0\bld 

cmake . -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX="c:\Custom\perl" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo 
CMake Error: The source directory "C:/Sources/perl-5.26.0/bld" does not appear to contain CMakeLists.txt. 
Specify --help for usage, or press the help button on the CMake GUI. 

c:\Sources\perl-5.26.0\bld> 

對不起,我忘了檢查是否存在: CMakeLists.txt文件

是否有可能建立的perl,而不是獲得的ActivePerl下載(安裝程序無法正常工作)草莓的Perl(該網站已經關閉)

請告訴我。

我該怎麼定義這個變量:

MSVCDIR  = ??? 
CCHOME  = $(MSVCDIR) 
CCINCDIR = $(CCHOME)\include 
CCLIBDIR = $(CCHOME)\lib 

我的輸出。

generate_uudmap.c 
     link -out:..\generate_uudmap.exe @C:\Users\...\AppData\Local\Temp\nmFB0B.tmp 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_exit 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_fputc 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_fopen 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp___acrt_iob_func 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_fclose 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vfprintf 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp__errno 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_fputs 
generate_uudmap.obj : error LNK2001: unresolved external symbol __imp_strerror 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _seh_filter_exe 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _set_app_type 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol __setusermatherr 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _configure_narrow_argv 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _configure_narrow_argv 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _initialize_narrow_environment 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_narrow_environment 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _get_initial_narrow_environment 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _initterm 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _initterm_e 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol exit 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _exit 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _set_fmode 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol __p___argc 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol __p___argv 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _cexit 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _cexit 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _c_exit 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _register_thread_local_exe_atexit_callback 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _configthreadlocale 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol _set_new_mode 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol __p__commode 
msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbol __C_specific_handler 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol __C_specific_handler 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _seh_filter_dll 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_onexit_table 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _register_onexit_function 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _execute_onexit_table 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_atexit 
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_at_quick_exit 
msvcrt.lib(tncleanup.obj) : error LNK2001: unresolved external symbol __std_type_info_destroy_list 
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol terminate 
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol memset 
..\generate_uudmap.exe : fatal error LNK1120: 38 unresolved externals 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\link.EXE"' : return code '0x460' 
Stop. 

c:\Sources\perl-5.26.0\win32> 

回答

0

win32/Makefile不正式有支持使用Visual Studio 2017年構建但是,它確實有一個與2015年VS建築之所以建設與Visual Studio 2015年工具需要一個單獨的配置比與Visual Studio建設的支持2013工具與Visual Studio 2017工具相同,因此您可以使用相同的配置。

要做到這一點:

  • 開出「64位本機命令工具命令提示符爲VS 2017年」從啓動命令窗口。

  • 轉到您在其中提取的Perl 5.26.0來源,並編輯win32/Makefile目錄:

  • 集:

    CCTYPE  = MSVC140 
    
    ... 
    CCHOME  = C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017 
    CCINCDIR = $(CCHOME)\include 
    CCLIBDIR = $(CCHOME)\lib\x64 
    

    注意到CCHOME版本相關的目錄。確保您使用的版本與您擁有的版本相對應。

  • 運行nmake<perl source directory>\win32。現在,我通常會做出一些更改,但這是進行構建所需的最少量更改。

  • 然後,nmake test,nmake install

注意,與Visual Studio 2015年和2017年建成perl S可最終是沒有用處,因爲它們與新的平臺運行時OpenSSL將不與工作聯繫起來。我認爲這意味着你不能使用模塊LWPHTTP::Tiny等與https。我還沒有調查過這麼多,所以如果我錯了,我很樂意去糾正。

請注意,當您安裝Visual Studio 2017時,也會安裝Visual Studio 2013工具,因此如果您可以使用某些bugs以及事實上默認情況下Perl的VS 2013構建配置忽略了VS 2013中包含的C99功能,或者如果你願意手動編輯配置文件,我發現用它來構建更可靠。

一般來說,你最好用Strawberry Perl。如果您想使用依賴於C庫的模塊,使用MinGW工具鏈可以節省大量時間。

+1

非常感謝!!! !!!'CCTYPE = MSVC140' 我沒想到...... –

+0

我們必須熟悉爲什麼早期的'perl's不能用Visual Studio 2015構建來知道這一點。我希望'perl'源代碼沒有抓住'stdio.h'數據結構的膽量,但它確實。 –

相關問題