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

Long Path checkbox #3821

Merged
merged 3 commits into from
Jun 7, 2023
Merged

Long Path checkbox #3821

merged 3 commits into from
Jun 7, 2023

Conversation

A2va
Copy link
Contributor

@A2va A2va commented Jun 6, 2023

Sometimes when xmake is building a package on Windows, it fails because the path is too long to handle. This issue can also occur when installing a package from a repository with a lot of submodules. Therefore, this PR attempts to mitigate the problem by providing a setting in the NSIS installer.

The NSIS configuration file is modified to:

  • Enable the Long Path option in the registry.
  • Execute a git command to enable the long path option.

Unfortunately, the execution of git opens a terminal for a short time (~100ms). I did some research to remove this behavior, but it seems that the only way is to use nsExec plugin which is already present in the codebase but not enabled by default. Therefore, if you prefer to have a silent execution, you would have to compile the plugin first (That's why I have set this PR in draft mode).

${If} $NOADMIN == "false"
; In admin enable long path on both git system config and in registry
WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
Exec '"$R0\cmd\git.exe" config --system core.longpaths true'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If git is not installed on the user's system, or if the installation path is not cmd\git.exe, the installation may fail.

And, xmake may install git in its own package installation directory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only for installing the xmake-repo package does git need to support long paths, but for some packages that need to handle long paths, we will turn on long paths to support it.

https://github.com/xmake-io/xmake-repo/blob/e1581652ef8cdfb3605d341eebea240a05a580f9/packages/l/libtorch/xmake.lua#L45

So I don't think git's setting of longpath is necessary, it's automatically supported by xmake when installing packages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this setting may have an effect on other programs and it is recommended that more detailed descriptive information be provided to tell the user the context in which it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about that policy, so I will remove the execution of git. The description will be modified to inform the user that it needs to reboot to make sure that all program have registered the new key value.
From the Microsoft docs:

The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

@waruqi waruqi marked this pull request as ready for review June 7, 2023 00:42
@waruqi
Copy link
Member

waruqi commented Jun 7, 2023

ok, thanks

@waruqi waruqi merged commit dd792b8 into xmake-io:dev Jun 7, 2023
@A2va A2va deleted the longpath branch June 7, 2023 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants