ninja fails on server - no such file or directory
Jumper@Jumper-PC MINGW64 ~/scrcpy/x
$ ninja
[1/1] Generating scrcpy-server with a custom command.
FAILED: server/scrcpy-server.jar
"bash" "C:/msys64/home/Jumper/scrcpy/server/./scripts/build-wrapper.sh" "../server/." "server/scrcpy-server.jar" "release"
/bin/bash: C:/msys64/home/Jumper/scrcpy/server/./scripts/build-wrapper.sh: No such file or directory
ninja: build stopped: subcommand failed.
$ ls ~/scrcpy/server/scripts/
build-wrapper.sh
Are you trying to build using the pre-compiled server jar? I found that the directory I put that jar in had to be under a particular directory root. The error message outputted a path to my jar file that did not match what I passed as an arg to meson, and that discrepancy helped me figure out what relative path it was expecting the server jar to reside under.
@doublejumper That's weird.
What is the result of:
ls C:/msys64/home/Jumper/scrcpy/server/./scripts/build-wrapper.sh
?
Just in case, what if you apply this patch:
--- a/server/meson.build
+++ b/server/meson.build
@@ -6,7 +6,7 @@ if prebuilt_server == ''
build_always: true, # gradle is responsible for tracking source changes
input: '.',
output: 'scrcpy-server.jar',
- command: [find_program('./scripts/build-wrapper.sh'), '@INPUT@', '@OUTPUT@', get_option('buildtype')],
+ command: [find_program('scripts/build-wrapper.sh'), '@INPUT@', '@OUTPUT@', get_option('buildtype')],
install: true,
install_dir: 'share/scrcpy')
else
$ ls C:/msys64/home/Jumper/scrcpy/server/./scripts/build-wrapper.sh
C:/msys64/home/Jumper/scrcpy/server/./scripts/build-wrapper.sh
After applying the patch:
[5/10] Generating scrcpy-server with a custom command.
FAILED: server/scrcpy-server.jar
"bash" "C:/msys64/home/Jumper/scrcpy/server/scripts/build-wrapper.sh" "../server/." "server/scrcpy-server.jar" "release"
/bin/bash: C:/msys64/home/Jumper/scrcpy/server/scripts/build-wrapper.sh: No such file or directory
and similarly,
$ ls C:/msys64/home/Jumper/scrcpy/server/scripts/build-wrapper.sh
C:/msys64/home/Jumper/scrcpy/server/scripts/build-wrapper.sh
@doublejumper
I meet this issue caused by CRLF problem, it seems that the developer use windows file,it make the build-wrapper.sh file can't be exec in unix enviroment.
i fix it by this
cd scrcpy
vim gradlew
# set ff=unix
# :wq
vim server/scripts/build-wrapper.sh
# set ff=unix
# :wq
then you can use ninja
@hanks-zyh
My build-wrapper.sh has only LF endings, but tried that just in case i misunderstood, but I still get the same error. Though for some reason now ninja does an extra step before stopping ([2/2] Linking target app/scrcpy.exe.), maybe it was just a recent commit.
I bypassed this issue by using a string with the direct path to build-wrapper.sh instead of using the find_program subcommand.
I then promptly ran into a permissions issue with ninja directly afterwards...
I bypassed this issue by using a string with the direct path to
build-wrapper.shinstead of using thefind_programsubcommand.
Cool :+1:
If you find any way to fix it "properly" for msys2, I'm interested :wink:
Probably fixed by c456e3826470753bdaefcffc93e9ae1bf25b12f7.
Reopen if this not the case.