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

Japanese Windows User issue, adb: error: cannot stat 'scrcpy-server': No such file or directory #2619

Closed
urashita opened this issue Sep 7, 2021 · 28 comments

Comments

@urashita
Copy link

urashita commented Sep 7, 2021

Hi there, I checked #448 and #567.

I installed scrcpy into this folder.
C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy

I got this error.

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" --crop 1600:900:2017:510 -b 8000000 --max-fps 0 --max-size 0 -n --window-title "SideQuest Stream" -s 1WMHH842XM0492
INFO: scrcpy 1.11 https://github.com/Genymobile/scrcpy
adb: error: cannot stat '.\scrcpy-server': No such file or directory
ERROR: "adb push" returned with value 1
Press any key to continue...

Then I set SCRCPY_SERVER_PATH
C:\Users\1階のPC>set SCRCPY_SERVER_PATH=C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server

I got this error.

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" --crop 1600:900:2017:510 -b 8000000 --max-fps 0 --max-size 0 -n --window-title "SideQuest Stream" -s 1WMHH842XM0492
INFO: scrcpy 1.11 https://github.com/Genymobile/scrcpy
adb: error: cannot stat 'C:\Users\1�K��PC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server': No such file or directory
ERROR: "adb push" returned with value 1
Press any key to continue...

I think there must a reason I encounter scrambled text.

@rom1v
Copy link
Collaborator

rom1v commented Sep 7, 2021

INFO: scrcpy 1.11

Try with the latest version, scrcpy v1.18.

@urashita
Copy link
Author

urashita commented Sep 7, 2021

I tested this using scrcpy v1.18

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" --crop 1600:900:2017:510 -b 8000000 --max-fps 0 --max-size 0 -n --window-title "SideQuest Stream" -s 1WMHH842XM0492
INFO: scrcpy 1.18 https://github.com/Genymobile/scrcpy
stat: No such file or directory
ERROR: '.\scrcpy-server' does not exist or is not a regular file

Then I set SCRCPY_SERVER_PATH
C:\Users\1階のPC>set SCRCPY_SERVER_PATH=C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" --crop 1600:900:2017:510 -b 8000000 --max-fps 0 --max-size 0 -n --window-title "SideQuest Stream" -s 1WMHH842XM0492
INFO: scrcpy 1.18 https://github.com/Genymobile/scrcpy
C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy...1 file pushed, 0 skipped. 5.9 MB/s (37330 bytes in 0.006s)
[server] INFO: Device: Oculus Quest 2 (Android 10)
INFO: Renderer: direct3d
INFO: Initial texture: 1600x896

Seems to be working fine.

Do I have to set SCRCPY_SERVER_PATH?

@rom1v
Copy link
Collaborator

rom1v commented Sep 7, 2021

Do I have to set SCRCPY_SERVER_PATH?

In theory, no, but there might be a bug. cc @npes87184?

@npes87184
Copy link
Contributor

I think this problem is not related to language. @urashita executed scrcpy with current directory C:\Users\1階のPC which does not contain the scrcpy-server. @urashita can you change current directory to C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy and execute scrcpy without environment variable again?

Thank you.

@rom1v
Copy link
Collaborator

rom1v commented Sep 7, 2021

But on Windows it looks into the executable path:

// use scrcpy-server in the same directory as the executable

@urashita
Copy link
Author

urashita commented Sep 7, 2021

I executed scrcpy with current directory C:\Users\1階のPC which does not contain the scrcpy-server.

But when I executed scrcpy with another user,
C:\Users\urashita>"C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" --crop 1600:900:2017:510 -b 8000000 --max-fps 0 --max-size 0 -n --window-title "SideQuest Stream" -s 1WMHH842XM0492,
even if C:\Users\urashita does not contain scrcpy-server, it worked fine.

@rom1v
Copy link
Collaborator

rom1v commented Sep 7, 2021

I could not reproduce in a VM (it fails because no device are detected):

windows

The scrcpy-server path looks correct.

What is the output if you enable debug logs?

"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug

@urashita
Copy link
Author

urashita commented Sep 8, 2021

Is this what you are talking?

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 https://github.com/Genymobile/scrcpy
DEBUG: Using server (portable): .\scrcpy-server
stat: No such file or directory
ERROR: '.\scrcpy-server' does not exist or is not a regular file

command2

@urashita
Copy link
Author

urashita commented Sep 8, 2021

This is a correct case.

C:\Users\urashita>"C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 https://github.com/Genymobile/scrcpy
DEBUG: Using server (portable): C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy-server
C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy-... file pushed, 0 skipped. 38.7 MB/s (37330 bytes in 0.001s)
DEBUG: Screensaver enabled
[server] INFO: Device: Oculus Quest 2 (Android 10)
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 3664x1920
DEBUG: Starting stream thread
DEBUG: User requested to quit
DEBUG: quit...
DEBUG: End of frames
DEBUG: Receiver stopped
[server] DEBUG: Controller stopped
WARN: Killing the server...
DEBUG: Server terminated

2021-09-08

@npes87184
Copy link
Contributor

Is this what you are talking?

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 https://github.com/Genymobile/scrcpy
DEBUG: Using server (portable): .\scrcpy-server
stat: No such file or directory
ERROR: '.\scrcpy-server' does not exist or is not a regular file

It is a relative path. Maybe this is the different part.

command2

@rom1v
Copy link
Collaborator

rom1v commented Sep 8, 2021

I just added a log to print the detected executable path:

diff --git a/app/src/server.c b/app/src/server.c
index a4cdb0c9..7e52c378 100644
--- a/app/src/server.c
+++ b/app/src/server.c
@@ -54,6 +54,7 @@ get_server_path(void) {
 
     // use scrcpy-server in the same directory as the executable
     char *executable_path = get_executable_path();
+    LOGI("executable_path = [%s]\n", executable_path);
     if (!executable_path) {
         LOGE("Could not get executable path, "
              "using " SERVER_FILENAME " from current directory");

Here is a binary, to replace in your v1.18 release: scrcpy.exe sha256:722bab340496f6665cd7a3542884d073f2c2b59575599a6002b98a94f8d67113

Please re-run and share the logs (console output).

@urashita
Copy link
Author

urashita commented Sep 9, 2021

Thanks for your sincere support.
I replaced scrcpy.exe and re-run, but I am not sure this information is helpful.

C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy>dir
 ドライブ C のボリューム ラベルは Windows です
 ボリューム シリアル番号は 28D3-5070 です

 C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy のディレクトリ

2021/09/09  09:48    <DIR>          .
2021/09/09  09:48    <DIR>          ..
2021/09/07  18:07         5,937,152 adb.exe
2021/09/07  18:07            97,792 AdbWinApi.dll
2021/09/07  18:07            62,976 AdbWinUsbApi.dll
2021/09/07  18:07        50,103,296 avcodec-58.dll
2021/09/07  18:07        11,094,016 avformat-58.dll
2021/09/07  18:07           866,304 avutil-56.dll
2021/09/07  18:07                90 scrcpy-console.bat
2021/09/07  18:07               212 scrcpy-noconsole.vbs
2021/09/07  18:07            37,330 scrcpy-server
2021/09/09  09:32           633,630 scrcpy.exe
2021/09/07  18:07           633,630 scrcpy.exe-orig
2021/09/07  18:07         1,561,088 SDL2.dll
2021/09/07  18:07           433,664 swresample-3.dll
2021/09/07  18:07           552,960 swscale-5.dll
              14 個のファイル          72,014,140 バイト
               2 個のディレクトリ  17,677,307,904 バイトの空き領域

C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy>certutil -hashfile scrcpy.exe SHA256
SHA256 ハッシュ (対象 scrcpy.exe):
722bab340496f6665cd7a3542884d073f2c2b59575599a6002b98a94f8d67113
CertUtil: -hashfile コマンドは正常に完了しました。

C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe"  -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
INFO: executable_path = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe]
DEBUG: Using server (portable): .\scrcpy-server
.\scrcpy-server: 1 file pushed, 0 skipped. 63.6 MB/s (37330 bytes in 0.001s)
DEBUG: Screensaver enabled
[server] INFO: Device: Oculus Quest 2 (Android 10)
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 3664x1920
DEBUG: Starting stream thread
DEBUG: User requested to quit
DEBUG: quit...
DEBUG: Server terminated
WARN: Killing the server...
DEBUG: End of frames
DEBUG: Receiver stopped

C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy>cd /d %homedrive%%homepath%

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe"  -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
INFO: executable_path = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe]
DEBUG: Using server (portable): .\scrcpy-server
stat: No such file or directory
ERROR: '.\scrcpy-server' does not exist or is not a regular file

command3
command4

@urashita
Copy link
Author

urashita commented Sep 9, 2021

The problem is that
"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe"
cannot locate
"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server"
if I execute scrcpy.exe from "C:\Users\1階のPC>"

@urashita
Copy link
Author

urashita commented Sep 9, 2021

If I executed the same scrcpy.ese (which you send me yesterday) from a single byte user, the result seems to be fine.

C:\Users\urashita>"C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
INFO: executable_path = [C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe]
DEBUG: Using server (portable): C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy-server
C:\Users\urashita\AppData\Roaming\SideQuest\scrcpy\scrcpy-... file pushed, 0 skipped. 37.7 MB/s (37330 bytes in 0.001s)
DEBUG: Screensaver enabled
[server] INFO: Device: Oculus Quest 2 (Android 10)
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 3664x1920
DEBUG: Starting stream thread
DEBUG: User requested to quit
DEBUG: quit...
DEBUG: Receiver stopped
[server] DEBUG: Controller stopped
DEBUG: End of frames
WARN: Killing the server...
DEBUG: Server terminated

@rom1v
Copy link
Collaborator

rom1v commented Sep 9, 2021

OK, let's add more logs:

diff --git a/app/src/server.c b/app/src/server.c
index a4cdb0c9..99746726 100644
--- a/app/src/server.c
+++ b/app/src/server.c
@@ -54,6 +54,7 @@ get_server_path(void) {
 
     // use scrcpy-server in the same directory as the executable
     char *executable_path = get_executable_path();
+    LOGI("executable_path = [%s]\n", executable_path);
     if (!executable_path) {
         LOGE("Could not get executable path, "
              "using " SERVER_FILENAME " from current directory");
@@ -61,7 +62,9 @@ get_server_path(void) {
         return strdup(SERVER_FILENAME);
     }
     char *dir = dirname(executable_path);
+    LOGI("dir = [%s]\n", dir);
     size_t dirlen = strlen(dir);
+    LOGI("dirlen = [%d]\n", (int) dirlen);
 
     // sizeof(SERVER_FILENAME) gives statically the size including the null byte
     size_t len = dirlen + 1 + sizeof(SERVER_FILENAME);
@@ -78,6 +81,8 @@ get_server_path(void) {
     memcpy(&server_path[dirlen + 1], SERVER_FILENAME, sizeof(SERVER_FILENAME));
     // the final null byte has been copied with SERVER_FILENAME
 
+    LOGI("server_path = [%s]\n", server_path);
+
     free(executable_path);
 
     LOGD("Using server (portable): %s", server_path);

scrcpy.exe sha256:a6ce08c280f10d2c939c5dbfdc23da868d1dda3582a3ad9b2d4565abeda1df13

@urashita
Copy link
Author

urashita commented Sep 9, 2021

I executed a new scrcpy.exe.

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
INFO: executable_path = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe]
INFO: dir = [.]
INFO: dirlen = [1]
INFO: server_path = [.\scrcpy-server]
DEBUG: Using server (portable): .\scrcpy-server
stat: No such file or directory
ERROR: '.\scrcpy-server' does not exist or is not a regular file

command5

@rom1v
Copy link
Collaborator

rom1v commented Sep 9, 2021

👍 OK so dirname() is the culprit.

@rom1v
Copy link
Collaborator

rom1v commented Sep 9, 2021

I'm not sure why I can't reproduce on Windows 10 :/

Could you try this fix/workaround, please:
scrcpy.exe sha256:420343c9d2944d7fa4a9296ed6b701533e32631ab949fa0d3c8854edd4897247

@urashita
Copy link
Author

urashita commented Sep 9, 2021

Now, I could successfully execute scrcpy.exe.
Thanks!

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe" -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
INFO: executable_path = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe]
INFO: dir = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy]
INFO: dirlen = [51]
INFO: server_path = [C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server]
DEBUG: Using server (portable): C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server
C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy... file pushed, 0 skipped. 62.6 MB/s (37330 bytes in 0.001s)
DEBUG: Screensaver enabled
[server] INFO: Device: Oculus Quest 2 (Android 10)
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 3664x1920
DEBUG: Starting stream thread
DEBUG: User requested to quit
DEBUG: quit...
DEBUG: End of frames
DEBUG: Receiver stopped
[server] DEBUG: Controller stopped
WARN: Killing the server...
DEBUG: Server terminated

command6

@urashita
Copy link
Author

urashita commented Sep 9, 2021

I am worry whether this fix would not be applied in master branch, because I will continue to use scrcpy.
I wish you would apply this fix to new scrcpy.
I believe this problem is not my PC's unique problem, because my company has the same issue in other PCs.
The reason that you could not recreate the problem is , I believe, that you do not install Japanese locale.
I am a software developer and familiar with C, C++, so I am willing to help you find a real solution if I could anything to do.

rom1v added a commit that referenced this issue Sep 9, 2021
The function dirname() does not work correctly everywhere with non-ASCII
characters.

Fixes #2619 <#2619>
@rom1v
Copy link
Collaborator

rom1v commented Sep 9, 2021

Here is a fix applied above dev branch: 4d6dd9d

Please test:
scrcpy.exe sha256:8c27223efa171446220d5a564f0e3413d6980011e110a4a4c6c40d0406618a74

If it works, I'll merged into dev, so it will be fixed in the next release (v1.19).

@npes87184
Copy link
Contributor

Here is a fix applied above dev branch: 4d6dd9d

Please test:
scrcpy.exe sha256:8c27223efa171446220d5a564f0e3413d6980011e110a4a4c6c40d0406618a74

If it works, I'll merged into dev, so it will be fixed in the next release (v1.19).

To prevent similar problem in the future, what about implement dirname by yourself?

@rom1v
Copy link
Collaborator

rom1v commented Sep 9, 2021

@npes87184 That's almost what I did in the first fix/workaround (I just posted the binary).

But in fact there are many special cases to handle to implement dirname() ("/", paths with several trailing \ like C:\abc\\\\def, etc.), and here the path necessarily points to the scrcpy executable, so it may not be a directory, etc., so I kept things as simple as possible.

@npes87184
Copy link
Contributor

@npes87184 That's almost what I did in the first fix/workaround (I just posted the binary).

But in fact there are many special cases to handle to implement dirname() ("/", paths with several trailing \ like C:\abc\\\\def, etc.), and here the path necessarily points to the scrcpy executable, so it may not be a directory, etc., so I kept things as simple as possible.

Thank you for your explanation.

@urashita
Copy link
Author

Hi, I tested a fixed scrcpy.exe and worked fine.

If it works, I'll merged into dev, so it will be fixed in the next release (v1.19).

This would be really appreciated.
Thank you.

C:\Users\1階のPC>certutil -hashfile "C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe"  SHA256
SHA256 ハッシュ (対象 C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe):
8c27223efa171446220d5a564f0e3413d6980011e110a4a4c6c40d0406618a74
CertUtil: -hashfile コマンドは正常に完了しました。

C:\Users\1階のPC>"C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy.exe"  -Vdebug
INFO: scrcpy 1.18 <https://github.com/Genymobile/scrcpy>
DEBUG: Using server (portable): C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy-server
C:\Users\1階のPC\AppData\Roaming\SideQuest\scrcpy\scrcpy...1 file pushed, 0 skipped. 4.3 MB/s (37330 bytes in 0.008s)
DEBUG: Screensaver enabled
[server] INFO: Device: Oculus Quest 2 (Android 10)
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer)
INFO: Initial texture: 3664x1920
DEBUG: Starting stream thread
DEBUG: User requested to quit
DEBUG: quit...
DEBUG: End of frames
DEBUG: Receiver stopped

@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2021

Merged into dev.

@rom1v rom1v closed this as completed Sep 10, 2021
@rom1v
Copy link
Collaborator

rom1v commented Sep 10, 2021

Btw, I think you have a locale issue with your Windows: why \ are replaced by ¥ in your console?

@urashita
Copy link
Author

Btw, I think you have a locale issue with your Windows: why \ are replaced by ¥ in your console?

In Japanese, \ are replaced by ¥.

Japanese-language locales of Microsoft operating systems use the code page 932 character encoding, which is a variant of Shift JIS. Hence, 0x5C is displayed as a yen sign in Japanese-locale fonts on Windows.
https://en.wikipedia.org/wiki/Yen_and_yuan_sign

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

No branches or pull requests

3 participants