Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl 5.26.1 does not build on Windows with MSVC100 #16269

Closed
p5pRT opened this issue Nov 22, 2017 · 9 comments
Closed

perl 5.26.1 does not build on Windows with MSVC100 #16269

p5pRT opened this issue Nov 22, 2017 · 9 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 22, 2017

Migrated from rt.perl.org#132484 (status was 'resolved')

Searchable as RT132484$

@p5pRT
Copy link
Author

p5pRT commented Nov 22, 2017

From marc-philip@die-werners.de

Created by marc-philip@die-werners.de

This is a bug report for perl from marc-philip@​die-werners.de,
generated with the help of perlbug 1.40 running under perl 5.26.1.

-----------------------------------------------------------------
The documented procedure to build perl 5.26.1 from source on Windows
64bit with Visual Studio 2010 is this​:
1. extract source tarball
2. edit win32/Makefile and set CCTYPE=MSVC100
3. open a development shell with correct environment (run "vcvarsall.bat
amd64" of VS 2010)
4. cwd in this shell to win32 folder
5. run nmake

This results in a crippled libpth in lib/Config.pm​:
C​:\SAPDevelop\hmexternals\perl\gen\out\build-64de87d5\perl-5.26.1>perl
-V|grep libpth
  libpth="\lib"

One would expect the absolute path to the Studio's lib folder​:
C​:\SAPDevelop\hmexternals\perl\gen\out\build-64de87d5\perl-5.26.1>perl
-V|grep libpth
  libpth="c​:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\\lib\amd64"

With the crippled path you cannot build the module Compress​:Raw​:Zlib,
that comes with the perl,
against a prebuilt zlib. For the error that occurs, please see here​:
http​://www.perlmonks.org/?node_id=1203895

Please find attached a patchfile, that changes the CCLIBDIR variable in
win32/Makefile and win32/makefile.mk.
Please note that I'm running perlbug with a perl that I've built with
the patch applied, therefore the libpth that you
find below is not crippled.

Thanks and Regards
Marc-Philip

Perl Info

Flags:
     category=core
     severity=high

Site configuration information for perl 5.26.1:

Configured by d026948 at Wed Nov 22 11:25:13 2017.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration:

   Platform:
     osname=MSWin32
     osvers=6.3
     archname=MSWin32-x64-multi-thread
     uname=''
     config_args='undef'
     hint=recommended
     useposix=true
     d_sigaction=undef
     useithreads=define
     usemultiplicity=define
     use64bitint=define
     use64bitall=undef
     uselongdouble=undef
     usemymalloc=n
     default_inc_excludes_dot=define
     bincompat5005=undef
   Compiler:
     cc='cl'
     ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise 
-DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE  
-DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS'
     optimize='-O1 -MD -Zi -DNDEBUG -GL -fp:precise'
     cppflags='-DWIN32'
     ccversion='16.00.40219.01'
     gccversion=''
     gccosandvers=''
     intsize=4
     longsize=4
     ptrsize=8
     doublesize=8
     byteorder=12345678
     doublekind=3
     d_longlong=undef
     longlongsize=8
     d_longdbl=define
     longdblsize=8
     longdblkind=0
     ivtype='__int64'
     ivsize=8
     nvtype='double'
     nvsize=8
     Off_t='__int64'
     lseeksize=8
     alignbytes=8
     prototype=define
   Linker and Libraries:
     ld='link'
     ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg  
-libpath:"C:\SAPDevelop\hmexternals\perl\gen\out\perl-5.24.1-sap16-SNAPSHOT-ntamd64-release-c\lib\CORE"	-machine:AMD64'
     libpth="c:\Program Files (x86)\Microsoft Visual Studio 
10.0\VC\\lib\amd64"
     libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib	version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
     perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib	netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
     libc=msvcrt.lib
     so=dll
     useshrplib=true
     libperl=perl526.lib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_win32.xs
     dlext=dll
     d_dlsymun=undef
     ccdlflags=' '
     cccdlflags=' '
     lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  
-libpath:"C:\SAPDevelop\hmexternals\perl\gen\out\perl-5.24.1-sap16-SNAPSHOT-ntamd64-release-c\lib\CORE" 
  -machine:AMD64'



@INC for perl 5.26.1:
     
C:/SAPDevelop/hmexternals/perl/gen/out/build-64de87d5/perl-5.26.1/lib


Environment for perl 5.26.1:
     CYGWIN=mintty
     HOME (unset)
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     
PATH=C:\SAPDevelop\hmexternals\perl\gen\out\build-64de87d5\perl-5.26.1;C:\opt\pigz-2.3-bin-win32;C:\opt\perforce;C:\opt\Perl64\site\bin;C:\opt\Perl64\bin;C:\opscode\chef\embedded\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\opscode\chef\bin;C:\Program 
Files\OpenSSH\bin;C:\Program Files\Perforce;c:\Program Files 
(x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft 
SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL 
Server\100\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files 
(x86)\GitExtensions\;C:\Users\D026948\.dnx\bin;C:\Program 
Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL 
Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows 
Performance
Toolkit\;C:\Users\D026948\.dnx\bin;C:\SAPDevelop\xmake-0.9.2-MS10-13\bin;C:\Python27;C:\Program 
Files (x86)\MSBuild\14.0\bin;C:\Program Files (x86)\Microsoft Visual 
Studio 14.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 
14.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 
14.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program 
Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;C:\Program Files 
(x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 
14.0\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft 
SDKs\Windows\v10.0A\bin\NETFX 4.6.1 
Tools\;C:\opt\pigz-2.3-bin-win32;C:\opt\perforce;C:\opt\Perl64\site\bin;C:\opt\Perl64\bin;C:\opscode\chef\embedded\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\opscode\chef\bin;C:\Program 
Files\OpenSSH\bin;C:\Program
Files\Perforce;c:\Program Files (x86)\Microsoft SQL 
Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL 
Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL 
Server\100\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files 
(x86)\GitExtensions\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program 
Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL 
Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\130\Tools\Binn\;C:\Users\D026948\AppData\Local\HappyMake\bin;C:\SAPDevelop\cmake-3.3.2-sap3-ntamd64\bin
     PERL_BADLANG (unset)
     SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Nov 22, 2017

From marc-philip@die-werners.de

win32_Makefile.patch
diff -Naur perl-5.26.1.orig/win32/Makefile perl-5.26.1/win32/Makefile
--- perl-5.26.1.orig/win32/Makefile	2017-09-07 19:19:52.000000000 +0000
+++ perl-5.26.1/win32/Makefile	2017-11-22 12:06:52.248834100 +0000
@@ -458,7 +458,11 @@
 CCLIBDIR	= $(CCHOME)\lib\x86
 !  ENDIF
 !ELSE
+!  IF "$(WIN64)" == "define"
+CCLIBDIR	= $(CCHOME)\lib\amd64
+!  ELSE
 CCLIBDIR	= $(CCHOME)\lib
+!  ENDIF
 !ENDIF
 
 ARCHDIR		= ..\lib\$(ARCHNAME)
diff -Naur perl-5.26.1.orig/win32/makefile.mk perl-5.26.1/win32/makefile.mk
--- perl-5.26.1.orig/win32/makefile.mk	2017-09-07 19:19:52.000000000 +0000
+++ perl-5.26.1/win32/makefile.mk	2017-11-22 12:10:08.705532700 +0000
@@ -465,9 +465,13 @@
 CCLIBDIR *= $(CCHOME)\lib\x86
 .ENDIF
 .ELSE
+.IF "$(WIN64)" == "define"
+CCLIBDIR *= $(CCHOME)\lib\amd64
+.ELSE
 CCLIBDIR *= $(CCHOME)\lib
 .ENDIF
 .ENDIF
+.ENDIF
 
 # Set DLL location for GCC compilers.
 .IF "$(CCTYPE)" == "GCC"

@p5pRT
Copy link
Author

p5pRT commented Nov 27, 2017

From @steve-m-hay

Thanks for the report.

I understand how this happens in 5.26.0 and earlier, but it should be mostly fixed in 5.26.1 (though not quite correctly).

The code in question was changed in commit https://perl5.git.perl.org/perl.git/commit/74102a88af and should produce a full path in libpth, albeit to lib, rather than lib\amd64.

Prior to that change you would just have got \lib if CCHOME was blank, which is was likely to be since it was set to MSVCDIR, which isn't set up by the vcvarsall.bat in VC++ 2010.

I will look to apply the patch later today to correct the missing amd64 subfolder, but it would be helpful if you could confirm that the problem of only getting \lib occurs in 5.26.0, not in 5.26.1, otherwise I'm confused what is going on.

@p5pRT
Copy link
Author

p5pRT commented Nov 27, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 27, 2017

From marc-philip@die-werners.de

On Mon, 27 Nov 2017 00​:36​:00 -0800, shay wrote​:

Thanks for the report.
Hi Steve,
thank you for looking into this.

I understand how this happens in 5.26.0 and earlier, but it should be
mostly fixed in 5.26.1 (though not quite correctly).

The code in question was changed in commit
https://perl5.git.perl.org/perl.git/commit/74102a88af and should
produce a full path in libpth, albeit to lib, rather than lib\amd64.
I'm talking about 5.26.1.

Prior to that change you would just have got \lib if CCHOME was blank,
which is was likely to be since it was set to MSVCDIR, which isn't set
up by the vcvarsall.bat in VC++ 2010.
Yes you are right, it's not \lib. Looks like I got something wrong, just ran it again.

win32/Makefile sets CCHOME to $(VCINSTALLDIR) in line 236, which is set by "vcvarsall.bat amd64" to this value​: C​:\Program Files (x86)\Microsoft Visual Studio 10.0\VC

The problem is that appending just \lib to this points to the 32 bit liberaries like e.g. msvcrt.lib. We need to append \lib\amd64 if we want 64 bit.

I will look to apply the patch later today to correct the missing
amd64 subfolder, but it would be helpful if you could confirm that the
problem of only getting \lib occurs in 5.26.0, not in 5.26.1,
otherwise I'm confused what is going on.
I can confirm that only getting \lib problem does not occur in 5.26.1.

Thank you!
Marc-Philip

@p5pRT
Copy link
Author

p5pRT commented Nov 28, 2017

From @steve-m-hay

On Mon, 27 Nov 2017 03​:25​:40 -0800, marc-philip@​die-werners.de wrote​:

On Mon, 27 Nov 2017 00​:36​:00 -0800, shay wrote​:

I will look to apply the patch later today to correct the missing
amd64 subfolder, but it would be helpful if you could confirm that
the
problem of only getting \lib occurs in 5.26.0, not in 5.26.1,
otherwise I'm confused what is going on.
I can confirm that only getting \lib problem does not occur in 5.26.1.

Thanks. I've now applied a modified version of patch in commit 6f669bf. (The makefile.mk changes weren't quite correct since GCC also has to be accounted for, and GNUmakefile also needed changing.)

@p5pRT
Copy link
Author

p5pRT commented Nov 28, 2017

@steve-m-hay - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT p5pRT closed this as completed Jun 23, 2018
@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant