使用MinGW

时间:2017-08-24 19:26:31

标签: windows perl dmake

如果对于这个问题这是错误的地方,我道歉并请将我重定向到合适的部分。

我从命令行安装时有些生疏,特别是在Windows上。我决定在我的PC上安装最新的Perl版本,在Windows 10下运行。我以前使用Strawberry Perl下载安装它,但由于它是几个版本过时我决定删除它并刷新我的技能(ha)手动安装。我从https://www.perl.org/get.html#win32下载了最新的Perl版本,并且一直在阅读README.win32,以确保我正确安装它。

由于我需要编译器,我决定使用Gccdmake。我安装并可以成功运行它们,所以回去安装Perl。根据说明,我尝试在Perl下载文件夹的win32子目录中运行dmake。在此之前,我编辑了makefile.mk,其中这些变量从Build配置部分取消注释:

INST_DRV/INST_TOP (left as is)
INST_VER *= \5.26.0
USE_MULTI *= define
USE_ITHREADS *= define
USE_IMP_SYS *= define
USE_LARGE_FILES *= define
USE_64_BIT_INT *= define
USE_LONG_DOUBLE *= define
DEFAULT_INC_EXCLUDES_DOT *= define
CCTYPE = GCC
GCCWRAPV *=define
CCHOME *= C:\MinGW
(nothing else changed after this)

当我在目录中运行dmake时,很快就会出现此错误:

gcc -c  -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -
D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing
-DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\toke.o  ..\toke.c
In file included from ..\perl.h:3220:0,
                 from ..\toke.c:40:
./win32.h:417:13: error: conflicting types for 'mkstemp'
 extern  int mkstemp(const char *path);
             ^~~~~~~
In file included from ..\perl.h:790:0,
                 from ..\toke.c:40:
c:\mingw\include\stdlib.h:809:30: note: previous definition of 'mkstemp' was here
 __cdecl __MINGW_NOTHROW  int mkstemp (char *__filename_template)
                              ^~~~~~~
In file included from ..\toke.c:40:0:
..\toke.c: In function 'Perl_filter_add':
..\perl.h:1756:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */
                    ^
..\perl.h:1769:28: note: in expansion of macro 'PTR2nat'
 #define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
                            ^~~~~~~
..\toke.c:4397:21: note: in expansion of macro 'FPTR2DPTR'
     IoANY(datasv) = FPTR2DPTR(void *, funcp); /* stash funcp into spare field */
                     ^~~~~~~~~
..\perl.h:1769:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
                         ^
..\toke.c:4397:21: note: in expansion of macro 'FPTR2DPTR'
     IoANY(datasv) = FPTR2DPTR(void *, funcp); /* stash funcp into spare field */
                     ^~~~~~~~~
..\toke.c: In function 'Perl_filter_del':
..\perl.h:1756:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */
                    ^
..\perl.h:1769:28: note: in expansion of macro 'PTR2nat'
 #define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
                            ^~~~~~~
..\toke.c:4463:26: note: in expansion of macro 'FPTR2DPTR'
     if (IoANY(datasv) == FPTR2DPTR(void *, funcp)) {
                          ^~~~~~~~~
..\perl.h:1769:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
                         ^
..\toke.c:4463:26: note: in expansion of macro 'FPTR2DPTR'
     if (IoANY(datasv) == FPTR2DPTR(void *, funcp)) {
                          ^~~~~~~~~
..\toke.c: In function 'Perl_filter_read':
..\perl.h:1756:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */
                    ^
..\perl.h:1768:28: note: in expansion of macro 'PTR2nat'
 #define DPTR2FPTR(t,p) ((t)PTR2nat(p)) /* data pointer to function pointer */
                            ^~~~~~~
..\toke.c:4554:13: note: in expansion of macro 'DPTR2FPTR'
     funcp = DPTR2FPTR(filter_t, IoANY(datasv));
             ^~~~~~~~~
..\perl.h:1768:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #define DPTR2FPTR(t,p) ((t)PTR2nat(p)) /* data pointer to function pointer */
                         ^
..\toke.c:4554:13: note: in expansion of macro 'DPTR2FPTR'
     funcp = DPTR2FPTR(filter_t, IoANY(datasv));
             ^~~~~~~~~
In file included from ..\perl.h:5644:0,
                 from ..\toke.c:40:
..\toke.c: In function 'S_pending_ident':
..\perl.h:1734:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #  define INT2PTR(any,d) (any)(d)
                          ^
..\embed.h:427:59: note: in definition of macro 'newUNOP_AUX'
 #define newUNOP_AUX(a,b,c,d) Perl_newUNOP_AUX(aTHX_ a,b,c,d)
                                                           ^
..\toke.c:8912:37: note: in expansion of macro 'INT2PTR'
                                     INT2PTR(UNOP_AUX_item *,
                                     ^~~~~~~

我事先得到一堆关于从指针转换为不同大小的整数的警告,但这是它停止并产生错误的位置。我错过了一些明显的东西吗我暂时没有做到这一点,所以我希望我这是一个愚蠢的用户错误!感谢。

1 个答案:

答案 0 :(得分:0)

尝试获取MinGW source packages,并使用makepkg-mingw进行安装以构建它们。

大多数(如果不是全部)都有应用补丁来为MSYS2 / MinGW环境定制(或修复)它们。

从其作者下载的股票源可能无法像在Linux上那样直接在该环境中编译,或者OS X使用" configure"和"制作"。

说明是available,并且可能还有与Arch Linux相关的其他类似说明。