Open fuch123 opened 2 years ago
Illegal instruction
This is a problem on the client side, it looks like a build problem.
Could you build with sanitizer enabled please?
meson d -Db_sanitize=address,undefined
ninja -Cd
./run d
(or run in gdb to know where this "illegal instruction" happens)
Because I don't want to recompile the server, I compiled it with reference to common steps and option 2 on the website However, an error occurred, as follows:
pi@raspberrypi:~ $ cd scrcpy/
pi@raspberrypi:~/scrcpy $ meson d -Db_sanitize=address,undefined -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
The Meson build system
Version: 0.56.2
Source dir: /home/pi/scrcpy
Build dir: /home/pi/scrcpy/d
Build type: native build
Project name: scrcpy
Project version: 1.23
C compiler for the host machine: cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
C linker for the host machine: cc ld.bfd 2.35.2
Host machine cpu family: arm
Host machine cpu: armv7l
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency libavformat found: YES 58.45.100
Run-time dependency libavcodec found: YES 58.91.100
Run-time dependency libavutil found: YES 56.51.100
Run-time dependency sdl2 found: YES 2.0.14
Run-time dependency libavdevice found: YES 58.10.100
Run-time dependency libusb-1.0 found: YES 1.0.24
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Header <sys/socket.h> has symbol "SOCK_CLOEXEC" : YES
Configuring config.h using configuration
Build targets in project: 14
Found ninja-1.10.1 at /usr/bin/ninja
pi@raspberrypi:~/scrcpy $ ninja -Cd
ninja: Entering directory `d'
[94/94] Linking target app/test_vector
pi@raspberrypi:~/scrcpy $ ./run d
==9417==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
pi@raspberrypi:~/scrcpy $
Sorry, I don't quite understand the method you gave. Can you be more detailed. Thanks a lot.
meson d -Db_sanitize=address,undefined -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
This is correct :+1:
==9417==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
You should not have this error: https://github.com/google/sanitizers/issues/796
Maybe try building with clang
instead (even if it should work out-of-the-box with gcc):
rm -rf d
export CC=clang
meson d -Db_sanitize=address,undefined -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
ninja -Cd
./run d
Otherwise, run it from gdb
, you might get the backtrace:
export SCRCPY_SERVER_PATH=d/server/scrcpy-server
gdb d/app/scrcpy
Then, in gdb:
(gdb) r
And when it crashes with "illegal instruction":
(gdb) bt
It should print the backtrace. Paste it here.
You could also try to remove undefined
:
meson d -Db_sanitize=address -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
Hi I tried three methods you provided, but none of them succeeded.
(1) Common steps, with export CC = Lang, the results are as follows:
pi@raspberrypi:~/scrcpy $ export CC=clang
pi@raspberrypi:~/scrcpy $ meson d -Db_sanitize=address -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
The Meson build system
Version: 0.56.2
Source dir: /home/pi/scrcpy
Build dir: /home/pi/scrcpy/d
Build type: native build
Project name: scrcpy
Project version: 1.23
Using 'CC' from environment with value: 'clang'
meson.build:1:0: ERROR: Unknown compiler(s): [['clang']]
The follow exceptions were encountered:
Running "clang --version" gave "[Errno 2] No such file or directory: 'clang'"
A full log can be found at /home/pi/scrcpy/d/meson-logs/meson-log.txt
pi@raspberrypi:~/scrcpy $
(2) Common steps, without export CC = Lang, in gdb , the results are as follows:
pi@raspberrypi:~/scrcpy $ meson d -Db_sanitize=address -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server
The Meson build system
Version: 0.56.2
Source dir: /home/pi/scrcpy
Build dir: /home/pi/scrcpy/d
Build type: native build
Project name: scrcpy
Project version: 1.23
C compiler for the host machine: cc (gcc 10.2.1 "cc (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110")
C linker for the host machine: cc ld.bfd 2.35.2
Host machine cpu family: arm
Host machine cpu: armv7l
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency libavformat found: YES 58.45.100
Run-time dependency libavcodec found: YES 58.91.100
Run-time dependency libavutil found: YES 56.51.100
Run-time dependency sdl2 found: YES 2.0.14
Run-time dependency libavdevice found: YES 58.10.100
Run-time dependency libusb-1.0 found: YES 1.0.24
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Header <sys/socket.h> has symbol "SOCK_CLOEXEC" : YES
Configuring config.h using configuration
Build targets in project: 14
Found ninja-1.10.1 at /usr/bin/ninja
pi@raspberrypi:~/scrcpy $ ninja -Cd
ninja: Entering directory `d'
[94/94] Linking target app/test_vector
pi@raspberrypi:~/scrcpy $ export SCRCPY_SERVER_PATH=d/server/scrcpy-server
pi@raspberrypi:~/scrcpy $ gdb -q d/app/scrcpy
Reading symbols from d/app/scrcpy...
(gdb) r
Starting program: /home/pi/scrcpy/d/app/scrcpy
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
==2478==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
[Inferior 1 (process 2478) exited with code 01]
(gdb) bt
No stack.
(gdb)
(3) build scrcpy in Simple, and run it in GDB, the result is as follows:
pi@raspberrypi:~/scrcpy $ cd scrcpy
pi@raspberrypi:~/scrcpy $ sudo ninja -Cbuild-auto uninstall
pi@raspberrypi:~/scrcpy $ git pull
pi@raspberrypi:~/scrcpy $ ./install_release.sh
pi@raspberrypi:~/scrcpy $ gdb -q scrcpy
Reading symbols from scrcpy...
(No debugging symbols found in scrcpy)
(gdb) r
Starting program: /usr/local/bin/scrcpy
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
[New Thread 0xabdc9a80 (LWP 2977)]
[Detaching after fork from child process 2978]
[Detaching after fork from child process 2979]
[Detaching after fork from child process 2980]
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 2.8 MB/s (41123 bytes in 0.014s)
[Detaching after fork from child process 2982]
[Detaching after fork from child process 2983]
[New Thread 0xab3fea80 (LWP 2984)]
[server] INFO: Device: Xiaomi M2102J2SC (Android 12)
[Detaching after fork from child process 2986]
[New Thread 0xa3cb3a80 (LWP 3005)]
[New Thread 0xa32fea80 (LWP 3006)]
[New Thread 0xa28fea80 (LWP 3007)]
[New Thread 0xa1efea80 (LWP 3008)]
[New Thread 0xa14fea80 (LWP 3009)]
[New Thread 0xa0cfda80 (LWP 3010)]
[New Thread 0xa00fea80 (LWP 3011)]
[New Thread 0x9f8fda80 (LWP 3012)]
[New Thread 0x9efbba80 (LWP 3013)]
[New Thread 0x9e7baa80 (LWP 3014)]
[New Thread 0x9dfb9a80 (LWP 3015)]
[New Thread 0x9d7b8a80 (LWP 3016)]
[New Thread 0x9cfb7a80 (LWP 3017)]
[New Thread 0x9c7b6a80 (LWP 3018)]
INFO: Renderer: opengl
INFO: OpenGL version: 3.1 Mesa 20.3.5
INFO: Trilinear filtering enabled
Thread 1 "scrcpy" received signal SIGILL, Illegal instruction.
0xb5eee7e8 in avpriv_mpegaudio_decode_header () from /lib/arm-linux-gnueabihf/neon/vfp/libavcodec.so.58
(gdb) bt
#0 0xb5eee7e8 in avpriv_mpegaudio_decode_header () at /lib/arm-linux-gnueabihf/neon/vfp/libavcodec.so.58
#1 0xb6e59b34 in () at /lib/arm-linux-gnueabihf/neon/vfp/libavformat.so.58
(gdb)
Let me remind again that my Linux host is the raspbian Linux system of arm32, Is the problem still due to the hardware codec
I feel that test (3) can reflect the problem and help analyze it. How to solve it? Thanks a lot!
Hello, moderator.
After that, I did several experiments and installed clang. The compilation was successful, but there was still an illegal instruction error when running. The situation is as follows:
pi@raspberrypi:~/scrcpy $ rm -rfv d
pi@raspberrypi:~/scrcpy $ export CC=clang
pi@raspberrypi:~/scrcpy $ meson d -Db_sanitize=address -Dprebuilt_server=/home/pi/scrcpy/scrcpy-server The Meson build system Version: 0.56.2 Source dir: /home/pi/scrcpy Build dir: /home/pi/scrcpy/d Build type: native build Project name: scrcpy Project version: 1.23 Using 'CC' from environment with value: 'clang' C compiler for the host machine: clang (clang 11.0.1-2 "Raspbian clang version 11.0.1-2+rpi1") C linker for the host machine: clang ld.bfd 2.35.2 Using 'CC' from environment with value: 'clang' Host machine cpu family: arm Host machine cpu: armv7l Found pkg-config: /usr/bin/pkg-config (0.29.2) Run-time dependency libavformat found: YES 58.45.100 Run-time dependency libavcodec found: YES 58.91.100 Run-time dependency libavutil found: YES 56.51.100 Run-time dependency sdl2 found: YES 2.0.14 Run-time dependency libavdevice found: YES 58.10.100 Run-time dependency libusb-1.0 found: YES 1.0.24 Checking for function "strdup" : YES Checking for function "asprintf" : YES Checking for function "vasprintf" : YES Header <sys/socket.h> has symbol "SOCK_CLOEXEC" : YES Configuring config.h using configuration Build targets in project: 14 meson.build:18: WARNING: Trying to use address sanitizer on Clang with b_lundef. This will probably not work. Try setting b_lundef to false instead. Found ninja-1.10.1 at /usr/bin/ninja
pi@raspberrypi:~/scrcpy $ ninja -Cd ninja: Entering directory `d' [94/94] Linking target app/test_vector
pi@raspberrypi:~/scrcpy $ ./run d scrcpy 1.23 https://github.com/Genymobile/scrcpy
pi@raspberrypi:~/scrcpy $ export SCRCPY_SERVER_PATH=d/server/scrcpy-server
pi@raspberrypi:~/scrcpy $ gdb -q d/app/scrcpy Reading symbols from d/app/scrcpy... (gdb) r Starting program: /home/pi/scrcpy/d/app/scrcpy [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". scrcpy 1.23 https://github.com/Genymobile/scrcpy [New Thread 0xa75fea40 (LWP 2908)] [Detaching after fork from child process 2909] [Detaching after fork from child process 2910] DEBUG: ADB device found: DEBUG: --> (usb) 103a8504 device M2102J2SC DEBUG: Device serial: 103a8504 DEBUG: Using SCRCPY_SERVER_PATH: d/server/scrcpy-server [Detaching after fork from child process 2911] d/server/scrcpy-server: 1 file pushed. 1.0 MB/s (41123 bytes in 0.038s) [Detaching after fork from child process 2912] [Detaching after fork from child process 2913] [New Thread 0xa61fea40 (LWP 2914)] [server] INFO: Device: Xiaomi M2102J2SC (Android 12) [Detaching after fork from child process 2916] [server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc' [New Thread 0x9d7fea40 (LWP 2917)] [New Thread 0x9cffda40 (LWP 2918)] [New Thread 0x9c7fca40 (LWP 2919)] [New Thread 0x9bffba40 (LWP 2920)] [New Thread 0x9b7faa40 (LWP 2921)] [New Thread 0x9aff9a40 (LWP 2922)] [New Thread 0x9a7f8a40 (LWP 2923)] [New Thread 0x99ff7a40 (LWP 2924)] [New Thread 0x996b5a40 (LWP 2925)] [New Thread 0x98eb4a40 (LWP 2926)] [New Thread 0x986b3a40 (LWP 2927)] [New Thread 0x97eb2a40 (LWP 2928)] DEBUG: Server connected DEBUG: Starting controller thread [New Thread 0x936fea40 (LWP 2929)] DEBUG: Starting receiver thread [New Thread 0x92efda40 (LWP 2930)] INFO: Renderer: opengl INFO: OpenGL version: 3.1 Mesa 20.3.5 INFO: Trilinear filtering enabled DEBUG: Using icon: /usr/local/share/icons/hicolor/256x256/apps/scrcpy.png ERROR: Could not open image codec: /usr/local/share/icons/hicolor/256x256/apps/scrcpy.png WARN: Could not load icon INFO: Initial texture: 1080x2336 DEBUG: Starting demuxer thread [New Thread 0x8e0f6a40 (LWP 2931)]
Thread 18 "scrcpy-demuxer" received signal SIGILL, Illegal instruction. [Switching to Thread 0x8e0f6a40 (LWP 2931)] 0xb5cbfe1c in ?? () from /lib/arm-linux-gnueabihf/neon/vfp/libavcodec.so.58 (gdb) bt
(gdb)
The above is the specific test situation. Please help me to see if it can be solved. Thank you!
0xb5cbfe1c in ?? () from /lib/arm-linux-gnueabihf/neon/vfp/libavcodec.so.58
Looks like an issue in your ffmpeg build (libavcodec).
Is there any solution? Those library files are installed through apt.
Or guide me to compile those ffmpeg library files on my own machine.
Environment
Describe the bug I installed raspbian Linux on Microsoft's surfacert Then I want to use surfacert as a touch screen Surfacert is an arm-32-bit NVIDIA processor Connect my Xiaomi 10s mobile phone (Android 12) Illegal command error while executing command After reading the FAQ and other issues, they failed to solve the problem I tried scrcpy - m1024, -m800, -m600, but all failed But it's strange that this mobile phone can work normally on windows 10-64 bit system through scrcpy-1.23 The problem should be located on the surfacert device. It seems that it should be the problem of the encoder I don't know if it can be solved. I hereby ask a question.
Terminal outputs