rav1e icon indicating copy to clipboard operation
rav1e copied to clipboard

install-rav1e-c requires elevation in MSYS2/MinGW under Windows

Open LigH-de opened this issue 4 years ago • 11 comments

Details available in media-autobuild suite issue 1606

/opt/cargo/bin/cargo.exe cinstall --release --prefix /build/rav1e-git/install-32bit --jobs 3
error: could not execute process `E:/MABS/msys64/opt/cargo\bin\cargo-cinstall.exe cinstall --release --prefix 'E:/MABS/build/rav1e-git/install-32bit' --jobs 3` (never executed)

Caused by:
{{Process requires elevation}}. (os error 740)

logs.zip collected by media-autobuild suite

LigH-de avatar Jun 23 '20 13:06 LigH-de

I guess the readme could explicitly mention --destdir.

lu-zero avatar Jun 23 '20 13:06 lu-zero

@lu-zero, what is the difference between --prefix and --destdir? I see these lines https://github.com/lu-zero/cargo-c/blob/e22e54a01372375ce5b578c8d442c88b5d2e4d30/src/cinstall.rs#L97-L100 and these https://github.com/lu-zero/cargo-c/blob/5806c3a740ffc46408a55ad1b60f3037bc6ac2af/src/install_paths.rs#L16-L23 , but I can't mentally map destdir to any options in autotools or cmake, at least immediately

1480c1 avatar Jun 23 '20 16:06 1480c1

DESTDIR is used to tell the install process where to put the files temporary, prefix is the path you put over the default bin/lib/...etc directorires. By default is /usr/local.

Ideally when you package you install with --destdir /tmp/some/unique/path and then tar it up. When you install after building with a non-root user you first use --destdir and the do sudo cp -a or similar.

lu-zero avatar Jun 23 '20 16:06 lu-zero

I see that cmake warns about windows in its documentation for destdir.

lu-zero avatar Jun 23 '20 16:06 lu-zero

Oh, you mean the variable, I was thinking about something like --destdir ... or -DCMAKE_INSTALL_DESTDIR=...

1480c1 avatar Jun 23 '20 16:06 1480c1

That's its usage anyway :)

lu-zero avatar Jun 23 '20 16:06 lu-zero

I see, so

cargo cinstall --release --prefix "${LOCALDESTDIR:-/mingw64}" --destdir "$PWD/install-$bits" --jobs $(nproc)
install ...

?

1480c1 avatar Jun 23 '20 16:06 1480c1

Yes

lu-zero avatar Jun 23 '20 17:06 lu-zero

@LigH-de would gsudo be a solution?

lu-zero avatar Jun 24 '20 15:06 lu-zero

@LigH-de patch to try gsudo, it will pop up a uac prompt when it runs cargo-c (at least on my machine)

diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh
index c5d854c..85fbd64 100644
--- a/build/media-suite_compile.sh
+++ b/build/media-suite_compile.sh
@@ -1053,6 +1053,14 @@ if { [[ $dav1d = y ]] || { [[ $ffmpeg != no ]] && enabled libdav1d; }; } &&
     do_checkIfExist
 fi
 
+# Get gsudo
+if enabled librav1e &&
+    [[ ! "$(/opt/bin/gsudo.exe --version 2> /dev/null | head -1)" = "gsudo v0.7.1" ]] &&
+    do_wget -h 56d2f93ac2f772981569c185c753969354702b1f0d069040ab4b945e6987421c \
+        "https://github.com/gerardog/gsudo/releases/download/v0.7.1/gsudo.v0.7.1.zip"; then
+    do_install gsudo.exe /opt/bin/gsudo.exe
+fi
+
 _check=(/opt/cargo/bin/cargo-c{build,install}.exe)
 if enabled librav1e &&
     [[ ! -x /opt/cargo/bin/cargo-cbuild || $(/opt/cargo/bin/cargo-cbuild --version) =~ 0.6* ]] &&
@@ -1095,7 +1103,9 @@ if { [[ $rav1e = y ]] || enabled librav1e; } &&
         export CPATH LIBRARY_PATH
 
         rm -f "$CARGO_HOME/config" 2> /dev/null
-        log "install-rav1e-c" "$RUSTUP_HOME/bin/cargo.exe" \
+        log -e "install-rav1e-c" "$RUSTUP_HOME/bin/cargo.exe" \
+            cinstall --release --prefix "$PWD/install-$bits" --jobs "$cpuCount" ||
+            log "install-rav1e-c.gsudo" /opt/bin/gsudo.exe "$RUSTUP_HOME/bin/cargo.exe" \
             cinstall --release --prefix "$PWD/install-$bits" --jobs "$cpuCount"
 
         mapfile -t compiler_builtins < <(

1480c1 avatar Jun 24 '20 16:06 1480c1

I did not try the gsudo patch yet as @1480c1 first let me try a patch which renames some files from "install" to "inst" and adds the dest-dir. For me this appeared to be sufficient.

LigH-de avatar Jun 25 '20 06:06 LigH-de