Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

Compiling for Windows using WSL2

Sachin_m_
Novice
735 Views

We wanted to replace the slow cygwin toolset with WSL for building our Windows executable.

Here is my process:

In a DOS window call the Intel compiler setup script:

CALL "C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2017.4.051\bin\psxevars.bat" intel64

 

Start WSL2 (or WSL):

wsl

And compile with this Intel compiler for Windows:

osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ which icl.exe
/c/Program Files (x86)/IntelSWTools/parallel_studio_xe_2017.4.051/compilers_and_libraries_2017/windows/bin/intel64/icl.exe
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ icl.exe hello.c
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.4.210 Build 20170411
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.

hello.c
hello.c(3): warning #1079: return type of function "main" must be "int"
void main(void)
^

Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.

-out:hello.exe
hello.obj
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ file hello.exe
hello.exe: PE32+ executable (console) x86-64, for MS Windows
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ ./hello.exe
Hello World

The same executable works on windows as well:

C:\Users\osqa\workarea\osqa_ca-w10-bld-05_os_211\os>hello.exe
Hello World

 

This works fine on my windows machine, or on a machine I can RDP into. The performance is much better than the cygwin toolset we use.

 

I also have OpenSSH setup on the remote machine. If I ssh into the machine and do the same steps, it does not work.

prog\osqa@CA-W10-BLD-05 C:\Users\osqa\workarea\osqa_ca-w10-bld-05_os_211\os>CALL "C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2017.4.051\bin\psxevars.bat" intel64
Intel(R) Parallel Studio XE 2017 Update 4
Copyright (C) 2017 Intel Corporation. All rights reserved.


Intel(R) MPI Library 2017 Update 3 for Windows* Target Build Environment for Intel(R) 64 applications
Copyright (C) 2007-2017 Intel Corporation. All rights reserved.

Intel(R) Compiler 17.0 Update 4 (package 210)


prog\osqa@CA-W10-BLD-05 C:\Users\osqa\workarea\osqa_ca-w10-bld-05_os_211\os>wsl
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ which icl.exe
/c/Program Files (x86)/IntelSWTools/parallel_studio_xe_2017.4.051/compilers_and_libraries_2017/windows/bin/intel64/icl.exe
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ icl.exe hello.c
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$ echo $?
66
osqa@ca-w10-bld-05:/c/Users/osqa/workarea/osqa_ca-w10-bld-05_os_211/os$

 

Invoking icl.exe just returns without any message. A return value of '66' is left.

What is the 66 return value?

Any ideas/help is greatly appreciated. Asking Intel Premier support only gave me a "WSL is not supported environment response". But I think this can be solved if I can figure out what the shell error value 66 means in this case. 

What is different when one logs in via ssh versus RDP?

The id, group values of the user are identical in both cases

Microsoft Windows [Version 10.0.19041.804]

Ubuntu 20.04.2 LTS in WSL2

-Sachin

0 Kudos
6 Replies
GouthamK_Intel
Moderator
679 Views

Hi Sachin,

Thanks for reaching out to us!

>>Asking Intel Premier support only gave me a "WSL is not supported environment response". 

Could you please let us know the Case ID of Intel Premier Support (IPS) ticket which you are referring to? So that we can check your case internally.


Regards

Goutham


Sachin_m_
Novice
663 Views

This is the request# 04993238 I see.

-Sachin

GouthamK_Intel
Moderator
652 Views

Hi Sachin,

Thanks for providing the case number.

We have checked your case internally, as mentioned by Viet, WSL isn't a supported Env on Windows for ICL. It may work in some cases and fails in others. It is recommended to use the supported ENV listed on our RN. Any issues outside of supported ENV, we afraid that we won't be able to assist.

https://software.intel.com/content/www/us/en/develop/articles/intel-c-compiler-170-for-windows-relea...


>>what the shell error value 66 means in this case. 

If you are looking for what "66" means, you can see it in /usr/include/sysexits.h

#define EX_NOINPUT  66  /* cannot open input */


Please let us know if you have any other issues that we can help you with.

Have a Good day!


Thanks & Regards

Goutham


GouthamK_Intel
Moderator
613 Views

Hi Sachin,

Could you please let us know if you have any other issues that we can help you with?

If not, let us know if we can close this thread from our end?


Regards

Goutham


Sachin_m_
Novice
603 Views

I could workaround the issue by making the account an administrator account.
Without the Windows Administrator privileges, the user can only use WSL + Intel compilers in interop mode when using RDP (or logged in locally). But not when ssh into the windows machine.

Once I gave the Windows Administrator privileges to the user, the user account could use WSL + Intel_windows_compilers in interop mode to cross-compile for windows from WSL when doing either RDP or ssh logins.

I am asking Microsoft to shed more light on the fine-grained rights so that I don't have to give full Admin privileges to a build/QA account.

Please close this issue.

-Sachin

GouthamK_Intel
Moderator
575 Views

Hi, 

Thanks for the confirmation!

We will no longer respond to this thread. 

If you require any additional assistance from Intel, please start a new thread. 

Any further interaction in this thread will be considered community only. 

Have a Good day.


Thanks & Regards

Goutham


Reply