Error installing perl on Win10 using MinGW

297 Views Asked by At

If this is the wrong place for this question I apologise and please redirect me to the suitable section.

I'm somewhat rusty on installing from command line, especially on Windows. I decided to install the latest Perl version on my PC, running under Windows 10. I had previously installed it using Strawberry Perl download, but as it was a few versions out of date I decided to remove it and refresh my skills (ha) by installing it manually. I downloaded the lastest Perl release from https://www.perl.org/get.html#win32 and have been reading the README.win32 to make sure I install it correctly.

As I need a compiler, I decided to use Gcc and dmake. I installed and can run them successfully so went back to installing Perl. As per instructions I tried running dmake in the win32 subdirectory in the Perl download folder. Before this I edited makefile.mk, where these variables are uncommented from the Build configuration section:

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)

When I run dmake in the directory, it quickly comes to this error:

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 *,
                                     ^~~~~~~

I get a bunch of warnings beforehand about casting from pointers to integers of different sizes, but this is the bit where it stops and produces an error. Am I missing something obvious? I haven't done this for a while, so I'm hoping it is a silly user error on my part! Thanks.

1

There are 1 best solutions below

0
On

Try obtaining the MinGW source packages, and installing using makepkg-mingw to build them.

Most if not all have patches applied to customize (or fix) them for the MSYS2/MinGW environment.

Stock source downloaded from its author may not compile directly in that environment the way it would on Linux, or OS X using "configure" and "make".

Instructions are available, and there may be other similar instructions out there associated with Arch Linux.