Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.61k stars 10.69k forks source link

no libasan when using release.sh #4736

Open tingfengwanxiao opened 8 months ago

tingfengwanxiao commented 8 months ago
[68/118] Compiling C object app/test_cli.exe.p/tests_test_cli.c.obj
<command-line>: warning: no previous prototype for 'SDL_main' [-Wmissing-prototypes]
../app/tests/test_cli.c:164:5: note: in expansion of macro 'main'
  164 | int main(int argc, char *argv[]) {
      |     ^~~~
[69/118] Linking target app/test_binary.exe
FAILED: app/test_binary.exe
"cc"  -o app/test_binary.exe app/test_binary.exe.p/tests_test_binary.c.obj app/test_binary.exe.p/src
_compat.c.obj "-fsanitize=address" "-Wl,--allow-shlib-undefined" "-Wl,--start-group" "D:/msys64/ming
w64/lib/libavformat.dll.a" "D:/msys64/mingw64/lib/libavcodec.dll.a" "D:/msys64/mingw64/lib/libavutil
.dll.a" "D:/msys64/mingw64/lib/libswresample.dll.a" "D:/msys64/mingw64/lib/libmingw32.a" "-mwindows"
 "D:/msys64/mingw64/lib/libSDL2main.a" "D:/msys64/mingw64/lib/libSDL2.dll.a" "D:/msys64/mingw64/lib/
libusb-1.0.dll.a" "-lmingw32" "-lws2_32" "-Wl,--subsystem,console" "-lkernel32" "-luser32" "-lgdi32"
 "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group
"
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe
: cannot find -lasan: No such file or directory
collect2.exe: error: ld returned 1 exit status
[72/118] Linking target app/test_bytebuf.exe
FAILED: app/test_bytebuf.exe
"cc"  -o app/test_bytebuf.exe app/test_bytebuf.exe.p/tests_test_bytebuf.c.obj app/test_bytebuf.exe.p
/src_util_bytebuf.c.obj app/test_bytebuf.exe.p/src_compat.c.obj "-fsanitize=address" "-Wl,--allow-sh
lib-undefined" "-Wl,--start-group" "D:/msys64/mingw64/lib/libavformat.dll.a" "D:/msys64/mingw64/lib/
libavcodec.dll.a" "D:/msys64/mingw64/lib/libavutil.dll.a" "D:/msys64/mingw64/lib/libswresample.dll.a
" "D:/msys64/mingw64/lib/libmingw32.a" "-mwindows" "D:/msys64/mingw64/lib/libSDL2main.a" "D:/msys64/
mingw64/lib/libSDL2.dll.a" "D:/msys64/mingw64/lib/libusb-1.0.dll.a" "-lmingw32" "-lws2_32" "-Wl,--su
bsystem,console" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "
-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group"
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe
: cannot find -lasan: No such file or directory
collect2.exe: error: ld returned 1 exit status
[77/118] Compiling C object app/test_control_msg...ize.exe.p/tests_test_control_msg_serialize.c.obj
<command-line>: warning: no previous prototype for 'SDL_main' [-Wmissing-prototypes]
../app/tests/test_control_msg_serialize.c:325:5: note: in expansion of macro 'main'
  325 | int main(int argc, char *argv[]) {
      |     ^~~~

D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe
: cannot find -lasan: No such file or directory
collect2.exe: error: ld returned 1 exit status

I meet this error when I use release.sh in windows,It seems lack libasan.a file,do you have this file or it is caused by other problem?

rom1v commented 8 months ago

When releasing, tests are compiled with ASAN enabled and run locally (so that they detect memory corruption).

If your compiler/linker do not support it, you can probably just disable ASAN for tests:

diff --git a/release.mk b/release.mk
index 89f3da215..1ac045728 100644
--- a/release.mk
+++ b/release.mk
@@ -53,7 +53,7 @@ clean:

 test:
        [ -d "$(TEST_BUILD_DIR)" ] || ( mkdir "$(TEST_BUILD_DIR)" && \
-               meson setup "$(TEST_BUILD_DIR)" -Db_sanitize=address )
+               meson setup "$(TEST_BUILD_DIR)" )
        ninja -C "$(TEST_BUILD_DIR)"
        $(GRADLE) -p server check

Refs https://github.com/msys2/MINGW-packages/issues/3163