Trying to override the phantom alias executable "cl" - Microsoft "call"
Hello,
In Microsoft Visual Studio, "cl" is the compiler.
```
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25027 for x64
. . .
etc
. . .
/favor:<blend|AMD64|INTEL64|ATOM> select processor to optimize for, one of:
```
However, in appveyor, "cl" is mapped to the windows batch "call" command.
I tried to find where "cl" is. The answer is nowhere.
But in appveyor it exists as `some sort of alias`.
See here "cl" in Appveyor:
https://ci.appveyor.com/project/AndreMikulec/appveyortest2/builds/38566488
```
cl /?
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
```
I tried to find the path (line 66 of the same output)
However, cl, is not in the path anywhere . . .
https://ci.appveyor.com/project/AndreMikulec/appveyortest2/builds/38566488#L66
```
which cl
which: no cl in (/c/Program Files/Docker/Docker/Resources/bin:/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/c/Perl/site/bin:/c/Perl/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/7-Zip:/c/Tools/GitVersion:/c/Tools/NuGet:/c/Program Files/Microsoft/Web Platform Installer:/c/Tools/PsTools:/c/Program Files/Git LFS:/c/Program Files/Mercurial:/c/Program Files (x86)/Subversion/bin:/c/Tools/WebDriver:/c/Tools/Coverity/bin:/c/Tools/MSpec:/c/Tools/NUnit/bin:/c/Tools/NUnit3:/c/Tools/xUnit:/c/Program Files/nodejs:/c/Program Files (x86)/iojs:/c/Program Files/iojs:/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn/ManagementStudio:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/c/Program Files/Microsoft SQL Server/130/DTS/Binn:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/c/Ruby193/bin:/c/go/bin:/c/Program Files/Java/jdk1.8.0/bin:/c/Program Files (x86)/Apache/Maven/bin:/c/Python27:/c/Python27/Scripts:/c/Program Files (x86)/CMake/bin:/c/Tools/curl/bin:/c/Program Files/Microsoft DNX/Dnvm:/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin:/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Extensions/Microsoft/SQLDB/DAC/130:/c/Program Files/dotnet:/c/Tools/vcpkg:/c/Program Files (x86)/dotnet:/c/Program Files (x86)/Microsoft SQL Server/140/Tools/Binn:/c/Program Files/Microsoft SQL Server/140/Tools/Binn:/c/Program Files/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/Extensions/TestPlatform:/c/Program Files (x86)/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files/erl9.2/bin:/c/Program Files (x86)/NSIS:/c/Tools/Octopus:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/c/Program Files/Docker/Docker/resources:/c/Program Files/LLVM/bin:/c/Users/appveyor/AppData/Roaming/npm:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files/PowerShell/6:/c/Program Files (x86)/nodejs:/cmd:/usr/bin:/c/Program Files/Meson:/c/ProgramData/chocolatey/bin:/c/Program Files/Amazon/AWSCLI:/c/Program Files (x86)/Yarn/bin:/c/Users/appveyor/AppData/Local/Microsoft/WindowsApps:/c/Users/appveyor/.dotnet/tools:/c/Users/appveyor/AppData/Roaming/npm:/c/Users/appveyor/AppData/Local/Yarn/bin:/c/Program Files/AppVeyor/BuildAgent)
```
Here is my appeyor.yml (comments have been removed).
https://github.com/AndreMikulec/appveyortest2/blob/b5bca5089eed96b9992cae21ac639296eeb9c9d6/appveyor.yml
```
image: Visual Studio 2015
environment:
matrix:
- PlatformToolset: v141
configuration: Release
platform: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
```
install:
build_script:
- cl /?
- which cl
```
I am trying to remove call-cl or put the compiler-cl in front of call-cl, so that when
I execute "cl /?" it shows me the Microsoft compiler help, compiler-cl (like it should).
This important because, I am trying to build a 32bit PostgreSQL extension, (yes, still 32bit),
and PostgreSQL, exclusively, only uses "cl /?" to determine the platform x64 or x86(Win32).
Here is the exact code that does the determination.
https://github.com/postgres/postgres/blob/REL_13_0/src/tools/msvc/Solution.pm#L68
```
($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
```
This outputs to the running log, this line exactly
https://github.com/postgres/postgres/blob/REL_13_0/src/tools/msvc/Solution.pm#L74
```
print "Detected hardware platform: $self->{platform}\n";
```
I thought that perl may be the problem. So I used a better perl.
So I tested
1.
```
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>C:\APPLICATIONS\strawberry-perl-5.32.1.1-64bit-portable\perl\bin\perl -e "my $output = `cl /help 2>&1`; $val = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32'; print $val;"
x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>
```
2.
```
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>C:\APPLICATIONS\strawberry-perl-5.32.1.1-32bit-portable\perl\bin\perl -e "my $output = `cl /help 2>&1`; $val = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32'; print $val;"
Win32
```
So, I ran and looked for ""Detected hardware platform: Win32" in the output. (see below: I did not find: Win32)
https://github.com/AndreMikulec/plr/blob/34ae62b8c361a28318630ac660ff886cb3312f6d/appveyor.yml
```
image: Visual Studio 2015
- pg: REL_13_0 # tag - static commit
PlatformToolset: v141
configuration: Release
platform: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
rversion: 4.0.3
#
githubcache: true
install:
- if %PLATFORM%==x64 (set BIT=64) else set BIT=32
- set betterperlurl=https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-%BIT%bit-portable.zip
- set betterperl=strawberry%BIT%
- if not exist %betterperl%.zip curl -o %betterperl%.zip %betterperlurl%
- 7z x %betterperl%.zip -oc:\%betterperl%
- set Path=c:\%betterperl%\perl\bin;%Path%
- which perl
- set Path=%Path%;c:\%betterperl%\c\bin
```
It ran my perl.
https://ci.appveyor.com/project/AndreMikulec/plr/builds/38566914?fullLog=true#L53
https://ci.appveyor.com/project/AndreMikulec/plr/builds/38566914?fullLog=true#L54
```
which perl
/c/strawberry32/perl/bin/perl
```
However, the output still shows up as "Detected hardware platform: x64".
That was the wrong answer.
https://ci.appveyor.com/project/AndreMikulec/plr/builds/38566914?fullLog=true#L2501
```
Detected hardware platform: x64
```
I need "Detected hardware platform: Win32".
When I try to call cl directly I still get call-cl.
https://ci.appveyor.com/project/AndreMikulec/appveyortest2/builds/38568282#L484
```
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl" /?
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
``
Following
VsDevCmd.bat is new with Visual Studio 2017
and replaces vsvars32.bat that came with Visual Studio 2015 and earlier
https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd_bat
After setting the environment, I still am getting call-cl instead of compile-cl.
https://ci.appveyor.com/project/AndreMikulec/appveyortest2/builds/38569248#L833
https://ci.appveyor.com/project/AndreMikulec/appveyortest2/builds/38569248#L834
```
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" -arch=x86
cl /?
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters
```
Any ideas?
Please help. Is there a command somewhere,
that I can use to turn call-cl off?
Thanks.
Andre
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by andre_mikulec on 06 Apr, 2021 05:52 PM
What I am saying is that cl seems to be always aliased to
cl /?
```
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters
```
Maybe cl is something like a Powershell alias. Or something else?