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
$Config{incpath} and $Config{libpth} are garbage paths on >= VC 2005 #14409
Comments
From @bulk88Created by @bulk88VC 2005 and newer don't set the MSVCDIR env var. There is a comment from chunk of win32/makefile that is the problem (makefile.mk will also need ------------------------------------------------------------------ # ----------------------------------------------------------------- ICL with VC 2008 ---------------------------------------------------------------------- C:\p521\srcnew>perl -MConfig -E" say $Config::Config{libpth} C:\p521\srcnew>perl -V d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, Characteristics of this binary (from libperl): C:\p521\srcnew> C:\>perl -MConfig -E" say $Config::Config{libpth} C:\>perl -V d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, Characteristics of this binary (from libperl): C:\> Even though README.w32 says CCHOME has to be set by hand I've never ever ------------------------------------------------------- Perl should now build using the win32/Makefile. You will need to edit that CCTYPE = MSVC80FREE and to set CCHOME, CCINCDIR and CCLIBDIR as per the environment setup above. Perl Info
|
From @bulk88Since there have been no comments for this bug, I have written a patch for review. Mingw is likely to fail -- |
From @bulk880001-WIP-perl-123575-make-sure-Config-incpath-and-Config-.patchFrom 73620a5de4d991017a0256b4f52a2a1a4f6ca185 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Tue, 28 Apr 2015 20:26:13 -0400
Subject: [PATCH] WIP [perl #123575] make sure $Config{incpath} and
$Config{libpth} are valid
VC 2005 and up used a different env var, and these 2 were being set to
"/include" and "/lib", which aren't valid paths on Win32. Fix it so newer
VC's are correctly looked up. libpth is mainly used by
ExtUtils::Liblist::Kid and it usually warns on VC Perl that it couldn't
absolute path the libraries when EUMM building and specifying additional
libs to EUMM to link with. Despite the warnings, linking still succeeds
since VC typically uses env vars to find standard c INCLUDE and LIB,
not cmd line args). Unix Perl typically leaves libpth and incpath as empty
string, so skip the tests if it is empty string.
Mingw is likely to fail the tests unless CCHOME is changed manually, which
it didn't need to be changed previously.
---
lib/Config.t | 24 ++++++++++++++++++++++++
win32/Makefile | 6 ++++++
win32/makefile.mk | 8 +++++++-
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/lib/Config.t b/lib/Config.t
index abd9316..751abc0 100644
--- a/lib/Config.t
+++ b/lib/Config.t
@@ -277,3 +277,27 @@ foreach my $lib (qw(applibexp archlibexp privlibexp sitearchexp sitelibexp
}
}
_diag ('@INC is:', @orig_inc) if $failed;
+
+#can't use Text::ParseWords in this .t
+sub extract_path {
+ my $paths = shift;
+ if(substr($paths,0,1) eq '"') {
+ return substr($paths, 1, index($paths, '"', 1));
+ }
+ else {
+ my $path_end = index($paths, ' ');
+ $path_end = length $paths if $path_end == -1;
+ return substr($paths, 0, $path_end);
+ }
+}
+#empty string on some platforms
+SKIP: {
+ skip '$Config{incpath} is empty string' if $Config{incpath} eq '';
+ my $path = extract_path($Config{incpath});
+ ok(-d $path, '$Config{incpath} is a valid dir');
+}
+SKIP: {
+ skip '$Config{libpth} is empty string' if $Config{libpth} eq '';
+ my $path = extract_path($Config{libpth});
+ ok(-d $path, '$Config{libpth} is a valid dir');
+}
diff --git a/win32/Makefile b/win32/Makefile
index 62d6ea8..bb99fd8 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -207,7 +207,13 @@ CCTYPE = MSVC60
# so you may have to set CCHOME explicitly (spaces in the path name should
# not be quoted)
#
+!IF "$(MSVCDIR)" != ""
CCHOME = $(MSVCDIR)
+!ELSEIF "$(VCINSTALLDIR)" != ""
+CCHOME = $(VCINSTALLDIR)
+!ELSE
+!ERROR CCHOME has not been set and could not be automatically determined.
+!ENDIF
CCINCDIR = $(CCHOME)\include
CCLIBDIR = $(CCHOME)\lib
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 7937c5c..c069c6b 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -228,8 +228,10 @@ CCTYPE *= GCC
#
.IF "$(CCTYPE)" == "GCC"
CCHOME *= C:\MinGW
-.ELSE
+.ELIF "$(MSVCDIR)" != ""
CCHOME *= $(MSVCDIR)
+.ELIF "$(VCINSTALLDIR)" != ""
+CCHOME *= $(VCINSTALLDIR)
.ENDIF
#
@@ -1043,6 +1045,10 @@ CHECKDMAKE :
@echo Please get the latest dmake from http://search.cpan.org/dist/dmake/
@exit 1
.ENDIF
+.IF "$(CCHOME)" == ""
+ @echo CCHOME has not been set and could not be automatically determined.
+ @exit 1
+.ENDIF
$(GLOBEXE) : perlglob$(o)
.IF "$(CCTYPE)" == "GCC"
--
1.8.0.msysgit.0
|
From @tonycozOn Tue Apr 28 17:27:53 2015, bulk88 wrote:
If you don't set CCHOME t/op/taint.t will probably fail, since it needs the files Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @steve-m-hayI think this ticket can be closed in the light of commits 74102a8 and 6f669bf? |
Yep, I get reasonable values with MSVC 2019:
closing. |
Migrated from rt.perl.org#123575 (status was 'open')
Searchable as RT123575$
The text was updated successfully, but these errors were encountered: