diff options
author | Bram <perl-rt@wizbit.be> | 2022-08-17 23:08:39 +0200 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-08-18 08:42:26 -0600 |
commit | 1ae8c315c4a002a0929723ac1f93a64eac6a1c3f (patch) | |
tree | db17f2ba10b92cd45733f545007bc0484498e7b6 /win32/Makefile | |
parent | 2fbb1a06df7219e842b3a2a0c9dcbab10de433fc (diff) | |
download | perl-1ae8c315c4a002a0929723ac1f93a64eac6a1c3f.tar.gz |
win32: check if CCHOME is correctly set
When building on Windows one must provide a value for 'CCHOME'.
The value of 'CCHOME' is used to set the value of 'CCLIBDIR' and 'CCINCDIR'.
(These eventually become `$Config{libpth}` and `$Config{incpath}`.)
When 'CCHOME' is incorrectly set the build mostly works; what fails
is building cpan/Win32 and this then fails with non-obvious errors such as:
Warning (mostly harmless): No library found for -luserenv
Warning (mostly harmless): No library found for -lwinhttp
...
g++ Win32.def -o ....
C:/.../ld.exe: ... undefined reference to `WinHttpCrackUrl'
...
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [Makefile:472: ..\..\lib\auto\Win32\Win32.dll] Error 1
gmake[1]: Leaving directory 'C:/Perl/perl5/cpan/Win32'
Unsuccessful make(cpan/Win32): code=512 at ..\make_ext.pl line 584.
Make this a bit more obvious by checking if the path(s) specified in
'CCLIBDIR' and 'CCINCDIR' actually exist.
If these do not exist then stop the build process at an early stage with
a clear(er) error.
Example error:
..\miniperl.exe -I..\lib config_sh.PL ...
'CCLIBDIR' contains the following non-existing paths:
C:\MinGW\lib
C:\MinGW\x86_64-w64-mingw32\lib
C:\MinGW\lib\gcc\x86_64-w64-mingw32\8.3.0
Did you provide a correct value for the 'CCHOME' option?
(This check can be skipped by using the SKIP_CCHOME_CHECK=1 option)
gmake: *** [GNUmakefile:1176: ..\config.sh] Error 1
Some notes:
- This check can be skipped/overridden by adding 'SKIP_CCHOME_CHECK=1'
on the make cmd line. (I added this because I don't know if there are
valid use cases for having a non-existing path in 'libpth'/'incpath')
- My first idea was to do this in the Makefile/GNUmakefile at a very early
stage but that is more complex to do and the resulting code is messy/ugly.
So instead I opted to do it in 'config_sh.PL' since this is the
first(/only) place that uses these vars.
- I (only) tested on Windows 10 using GNU Make and gcc
Diffstat (limited to 'win32/Makefile')
-rw-r--r-- | win32/Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/win32/Makefile b/win32/Makefile index eee9362a54..147786ab76 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -834,7 +834,8 @@ CFG_VARS = \ "default_inc_excludes_dot=$(DEFAULT_INC_EXCLUDES_DOT)" \ "LINK_FLAGS=$(LINK_FLAGS:"=\")" \ "optimize=$(OPTIMIZE:"=\")" \ - "WIN64=$(WIN64)" + "WIN64=$(WIN64)" \ + "SKIP_CCHOME_CHECK=$(SKIP_CCHOME_CHECK)" # # Top targets |