Skip to content
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

Xmake in Windows failed to compile projects stored inside WSL2 #3013

Closed
itdevwu opened this issue Nov 2, 2022 · 6 comments
Closed

Xmake in Windows failed to compile projects stored inside WSL2 #3013

itdevwu opened this issue Nov 2, 2022 · 6 comments
Labels
Milestone

Comments

@itdevwu
Copy link

itdevwu commented Nov 2, 2022

Xmake Version

2.7.2

Operating System Version and Architecture

Host: Windows 11 version 21H2; WSL2: Ubuntu 22.04 5.10.102.1-microsoft-standard-WSL2

Describe Bug

In Windows 11, Microsoft PowerShell has supported access files and paths inside WSL2. User can directly copy a path of WSL2 from Windows' file explorer and use cd command in PowerShell to change their working path to somewhere inside the WSL2 VM.

Theoretically, this should have allowd xmake installed on Windows directly compile source code stored in WSL2 without copying them back to host. Since MSVC has the widest support of C++20 (much more than gcc/clang), such feature is supposed to be useful.

However, current version of xmake failed to parse such sort of path, who behaved as follows:

PS Microsoft.PowerShell.Core\FileSystem::\\wsl.localhost\Ubuntu-22.04\home\user> xmake
error: cannot change directory \wsl.localhost\Ubuntu-22.04\home\user\wsl.localhost\Ubuntu-22.04\home\user, not found this directory Unknown
PS Microsoft.PowerShell.Core\FileSystem::\\wsl.localhost\Ubuntu-22.04\home\user>

The path used in the example above is: \\wsl.localhost\Ubuntu-22.04\home\user .

Expected Behavior

For xmake installed inside WSL2, things are fine just like they are in normal Linux:

(base) user@Apple:~$ xmake
[ 18%]: cache compiling.release code/dp.cpp
[ 18%]: cache compiling.release code/divide_conque.cpp
[ 18%]: cache compiling.release code/datagen.cpp
[ 63%]: linking.release ma
[ 63%]: linking.release datagen
[100%]: build ok!
(base) user@Apple:~$

Project Configuration

No response

Additional Information and Error Logs

No response

@itdevwu itdevwu added the bug label Nov 2, 2022
@waruqi
Copy link
Member

waruqi commented Nov 2, 2022

PowerShell has supported access files and paths inside WSL2.

powershell support it, but xmake maybe does not support it. xmake use the native Win32 API to access windows path. It seems not support it.

I don't have a windows wsl2 environment at the moment to test and improve it further. You can open a pr to improve it.

@SirLynix
Copy link
Member

SirLynix commented Nov 2, 2022

Isn't it because xmake processes paths and deduplicate (back)slashes? (turning \\wsl.localhost into \wsl.localhost)

@waruqi
Copy link
Member

waruqi commented Nov 2, 2022

I don't know, I don't have the environment to test it right now.

@waruqi
Copy link
Member

waruqi commented Nov 9, 2022

@waruqi
Copy link
Member

waruqi commented Nov 24, 2022

I have improved it, you can try it again. xmake update dev

@waruqi
Copy link
Member

waruqi commented Nov 25, 2022

It should work.

@waruqi waruqi closed this as completed Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants