[PATCH] Add information how to fix common build error on Windows in symlink-install-tree

Mateusz Krawczuk posted 1 patch 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230503150855.1182-1-mat.krawczuk@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>
There is a newer version of this series
scripts/symlink-install-tree.py | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] Add information how to fix common build error on Windows in symlink-install-tree
Posted by Mateusz Krawczuk 12 months ago
By default, Windows doesn't allow to create soft links for user account and only administrator is allowed to do this. To fix this problem you have to raise your permissions or enable Developer Mode, which available since Windows 10. Additional explanation when build fails will allow developer to fix the problem on his computer faster.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1386
Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
---
 scripts/symlink-install-tree.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
index 67cb86dd52..bb3a2d708c 100644
--- a/scripts/symlink-install-tree.py
+++ b/scripts/symlink-install-tree.py
@@ -7,12 +7,14 @@
 import subprocess
 import sys
 
+
 def destdir_join(d1: str, d2: str) -> str:
     if not d1:
         return d2
     # c:\destdir + c:\prefix must produce c:\destdir\prefix
     return str(PurePath(d1, *PurePath(d2).parts[1:]))
 
+
 introspect = os.environ.get('MESONINTROSPECT')
 out = subprocess.run([*introspect.split(' '), '--installed'],
                      stdout=subprocess.PIPE, check=True).stdout
@@ -28,5 +30,8 @@ def destdir_join(d1: str, d2: str) -> str:
         os.symlink(source, bundle_dest)
     except BaseException as e:
         if not isinstance(e, OSError) or e.errno != errno.EEXIST:
+            if os.name == 'nt':
+                print('\nPlease enable Developer Mode to support soft link '
+                      'without Administrator permission\n')
             print(f'error making symbolic link {dest}', file=sys.stderr)
             raise e
-- 
2.40.1.windows.1
Re: [PATCH] Add information how to fix common build error on Windows in symlink-install-tree
Posted by Thomas Huth 12 months ago
On 03/05/2023 17.08, Mateusz Krawczuk wrote:
> By default, Windows doesn't allow to create soft links for user account and only administrator is allowed to do this. To fix this problem you have to raise your permissions or enable Developer Mode, which available since Windows 10. Additional explanation when build fails will allow developer to fix the problem on his computer faster.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1386
> Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
> ---
>   scripts/symlink-install-tree.py | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
> index 67cb86dd52..bb3a2d708c 100644
> --- a/scripts/symlink-install-tree.py
> +++ b/scripts/symlink-install-tree.py
> @@ -7,12 +7,14 @@
>   import subprocess
>   import sys
>   
> +
>   def destdir_join(d1: str, d2: str) -> str:
>       if not d1:
>           return d2
>       # c:\destdir + c:\prefix must produce c:\destdir\prefix
>       return str(PurePath(d1, *PurePath(d2).parts[1:]))
>   
> +

Please avoid such white space damage. QEMU coding style is to use only one 
empty line between functions.

  Thomas


>   introspect = os.environ.get('MESONINTROSPECT')
>   out = subprocess.run([*introspect.split(' '), '--installed'],
>                        stdout=subprocess.PIPE, check=True).stdout
> @@ -28,5 +30,8 @@ def destdir_join(d1: str, d2: str) -> str:
>           os.symlink(source, bundle_dest)
>       except BaseException as e:
>           if not isinstance(e, OSError) or e.errno != errno.EEXIST:
> +            if os.name == 'nt':
> +                print('\nPlease enable Developer Mode to support soft link '
> +                      'without Administrator permission\n')
>               print(f'error making symbolic link {dest}', file=sys.stderr)
>               raise e