我在读这篇文章。
http://www.cpan.org/src/README.html和http://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 (安装程序不能正常工作)或 Strawberry-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>
发布于 2017-08-01 23:37:06
win32/Makefile
官方不支持使用Visual 2017进行构建。但是,它确实支持使用VS 2015。使用Visual 2015 tools构建比使用Visual 2013 tools构建需要单独配置的原因是Visual 2017 tools的配置相同,因此您可以使用相同的配置。
为此:
win32/Makefile
CCHOME
中的版本依赖目录。确保使用与您所拥有的版本相对应的版本。nmake
in <perl source directory>\win32
。现在,我通常会做一些更多的更改,但这是进行构建所必需的最小数量的更改。nmake test
,nmake install
。请注意,使用Visual 2015和2017构建的perl
可能会变得非常无用,因为它们链接到OpenSSL不使用的新平台运行时。我认为这意味着您将无法在LWP
、HTTP::Tiny
等模块中使用https
。我没有对此进行过多的调查,所以如果我错了,我希望得到纠正。
请注意,安装Visual 2017时还会安装Visual 2013工具,因此,如果您可以使用某些错误,并且Perl的VS 2013构建配置默认忽略VS 2013中包含的C99特性,或者如果您愿意手动编辑配置文件,我发现使用该配置文件构建更可靠。
一般来说,您最好使用草莓Perl。如果要使用依赖于C库的模块,使用MinGW工具链可以节省大量时间。
https://stackoverflow.com/questions/45448032
复制相似问题