2

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.

dgBP
  • 1,681
  • 6
  • 27
  • 42
  • Where's the rest of the error message? – melpomene Aug 24 '17 at 19:30
  • 2
    http://strawberryperl.com/ has the latest version: 5.26.0. – melpomene Aug 24 '17 at 19:31
  • 1
    @melpomene I wanted to try installing it manually... just for kicks really, but if possible I want to try. – dgBP Aug 24 '17 at 19:31
  • I'll update the error message, forgot that it puts the error at the top rather than at the end of the output! EDIT: Which actually makes a difference lol. But still, not sure about the conflict, any thoughts? – dgBP Aug 24 '17 at 19:32
  • This does seem to be a previously known issue as of here: https://lists.gt.net/perl/porters/319603, but it doesn't look like the patch was ever incorporated into the main build. From the comments, it also looks like it might not work. Any other solutions? – dgBP Aug 24 '17 at 19:45
  • The error is `conflicting types for 'mkstemp' extern int mkstemp(const char *path);` vs `__cdecl __MINGW_NOTHROW int mkstemp (char *__filename_template)`. I get my kicks out of building with MSVC, so can't help much. – Sinan Ünür Aug 24 '17 at 20:09
  • But, I will say, forget about `dmake` given that you are using MinGW. Just use the regular GNU toolchain (which, obviously, does not solve your problem). – Sinan Ünür Aug 24 '17 at 20:12
  • 1
    @SinanÜnür yeh, it's looking like more trouble than it's worth. I don't have MSV tools installed so I might just go with Strawberry Perl. Shame really, I like seeing what I'm installing. It somehow makes me feel closer to the program and how it works. Sounds weird now I've said it haha! – dgBP Aug 24 '17 at 20:54
  • @dgBP I know what you mean and I agree ;-) – Sinan Ünür Aug 24 '17 at 22:56

1 Answers1

0

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.

melpomene
  • 84,125
  • 8
  • 85
  • 148