From 0a2b0783aa8669b8a2778d5a9da0202456fda17f Mon Sep 17 00:00:00 2001 From: Anton Oks <2266872+AntonOks@users.noreply.github.com> Date: Mon, 13 May 2024 21:04:32 +0200 Subject: [PATCH 1/3] Config.pm: Windows: Ensure x64 architecture As far as I know, Rakudo is not building under 32bit Windows. If so, let's check and assure we use the MSVC 64bit cl.exe for a desired build run. See also https://github.com/MoarVM/MoarVM/issues/1789#issuecomment-2028464981 --- lib/NQP/Config.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/NQP/Config.pm b/lib/NQP/Config.pm index 892cc71..679af53 100644 --- a/lib/NQP/Config.pm +++ b/lib/NQP/Config.pm @@ -247,16 +247,23 @@ sub make_cmd { my $has_gcc = 0 == system('gcc --version >NUL 2>&1'); if ($has_cl) { if ( $cl_report =~ - /Microsoft\s.*\sCompiler\s+Version\s+(\d+(?:\.\d+)+)/i ) + /Microsoft\s.*\sCompiler\s+Version\s+(\d+(?:\.\d+)+)\s+for\s+(x\d+)/i ) { my $actual_version = $1; + my $cl_arch = $2; my $expect_version = "19.0"; + if ( version->parse($actual_version) < $expect_version ) { $self->sorry( "Expected Microsoft Compiler version " . $expect_version . "+, but got " . $actual_version ); } + if ( $cl_arch ne "x64 ) { + $self->sorry( "Rakudo compiles currently only on " + . "x64 architectures, but we are on " + . $cl_arch ); + } } } if ( From 9b2e938006fdbd3353f2addd13a6846c33164ca7 Mon Sep 17 00:00:00 2001 From: Anton Oks <2266872+AntonOks@users.noreply.github.com> Date: Mon, 13 May 2024 21:09:31 +0200 Subject: [PATCH 2/3] Config.pm: Fix typo --- lib/NQP/Config.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/NQP/Config.pm b/lib/NQP/Config.pm index 679af53..06f1aec 100644 --- a/lib/NQP/Config.pm +++ b/lib/NQP/Config.pm @@ -259,7 +259,7 @@ sub make_cmd { . "+, but got " . $actual_version ); } - if ( $cl_arch ne "x64 ) { + if ( $cl_arch ne "x64" ) { $self->sorry( "Rakudo compiles currently only on " . "x64 architectures, but we are on " . $cl_arch ); From 6d3e774f599b1c79b5a15076384a29edd0265cce Mon Sep 17 00:00:00 2001 From: Anton Oks <2266872+AntonOks@users.noreply.github.com> Date: Mon, 13 May 2024 21:47:00 +0200 Subject: [PATCH 3/3] Config.pm: Adopt regex to also cover ARM64 Windows thanks to @ugexe for the review and hint! --- lib/NQP/Config.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/NQP/Config.pm b/lib/NQP/Config.pm index 06f1aec..2f01e89 100644 --- a/lib/NQP/Config.pm +++ b/lib/NQP/Config.pm @@ -247,7 +247,7 @@ sub make_cmd { my $has_gcc = 0 == system('gcc --version >NUL 2>&1'); if ($has_cl) { if ( $cl_report =~ - /Microsoft\s.*\sCompiler\s+Version\s+(\d+(?:\.\d+)+)\s+for\s+(x\d+)/i ) + /Microsoft\s.*\sCompiler\s+Version\s+(\d+(?:\.\d+)+)\s+for\s+(\D+\d+)/i ) { my $actual_version = $1; my $cl_arch = $2; @@ -259,9 +259,9 @@ sub make_cmd { . "+, but got " . $actual_version ); } - if ( $cl_arch ne "x64" ) { - $self->sorry( "Rakudo compiles currently only on " - . "x64 architectures, but we are on " + if ( $cl_arch !~ m/\D+64$/ ) { + $self->sorry( "On Microsoft Windows, Rakudo compiles currently only on " + . "64bit architectures, but we are on " . $cl_arch ); } }