scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

ninja fails on server - no such file or directory

Open SergioVJr opened this issue 8 years ago • 8 comments

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

SergioVJr avatar Apr 05 '18 02:04 SergioVJr

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.

atrich-ms avatar Apr 05 '18 05:04 atrich-ms

@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

rom1v avatar Apr 05 '18 07:04 rom1v

$ 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

SergioVJr avatar Apr 05 '18 12:04 SergioVJr

@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 avatar Apr 13 '18 06:04 hanks-zyh

@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.

SergioVJr avatar Apr 13 '18 13:04 SergioVJr

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...

Ghoulean avatar Dec 02 '18 01:12 Ghoulean

I bypassed this issue by using a string with the direct path to build-wrapper.sh instead of using the find_program subcommand.

Cool :+1:

If you find any way to fix it "properly" for msys2, I'm interested :wink:

rom1v avatar Dec 02 '18 09:12 rom1v

Probably fixed by c456e3826470753bdaefcffc93e9ae1bf25b12f7.

Reopen if this not the case.

rom1v avatar Jun 25 '19 14:06 rom1v