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

build fails after Nov 13 2021 #2777

Closed
mgrouch opened this issue Nov 14, 2021 · 5 comments
Closed

build fails after Nov 13 2021 #2777

mgrouch opened this issue Nov 14, 2021 · 5 comments

Comments

@mgrouch
Copy link

mgrouch commented Nov 14, 2021

Found ninja-1.10.1 at /usr/bin/ninja
[11/45] Compiling C object app/scrcpy.p/src_icon.c.oter.c.o
FAILED: app/scrcpy.p/src_icon.c.o 
cc -Iapp/scrcpy.p -Iapp -I../app -I../app/src -I/usr/include/arm-linux-gnueabihf -I/usr/include/SDL2 -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/usr/include/libusb-1.0 -flto -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -D_REENTRANT -MD -MQ app/scrcpy.p/src_icon.c.o -MF app/scrcpy.p/src_icon.c.o.d -o app/scrcpy.p/src_icon.c.o -c ../app/src/icon.c
../app/src/icon.c:161:8: error: unknown type name 'SDL_PixelFormatEnum'
 static SDL_PixelFormatEnum
        ^~~~~~~~~~~~~~~~~~~
../app/src/icon.c: In function 'to_sdl_pixel_format':
../app/src/icon.c:175:42: error: 'SDL_PIXELFORMAT_BGR444' undeclared (first use in this function); did you mean 'SDL_PIXELFORMAT_BGR24'?
         case AV_PIX_FMT_BGR444BE: return SDL_PIXELFORMAT_BGR444;
                                          ^~~~~~~~~~~~~~~~~~~~~~
                                          SDL_PIXELFORMAT_BGR24
../app/src/icon.c:175:42: note: each undeclared identifier is reported only once for each function it appears in
../app/src/icon.c: In function 'load_from_path':
../app/src/icon.c:200:5: error: unknown type name 'SDL_PixelFormatEnum'; did you mean 'SDL_PixelFormat'?
     SDL_PixelFormatEnum format = to_sdl_pixel_format(frame->format);
     ^~~~~~~~~~~~~~~~~~~
     SDL_PixelFormat
[13/45] Compiling C object app/scrcpy.p/src_fps_counter.c.oo
ninja: build stopped: subcommand failed.

Exited with code exit status 1

CircleCI received exit code 1
mgrouch added a commit to bareboat-necessities/lysmarine_gen that referenced this issue Nov 14, 2021
@npes87184
Copy link
Contributor

npes87184 commented Nov 14, 2021

Same problem

dpkg -l | grep sdl 
  
ii  libsdl1.2debian:amd64                      1.2.15+dfsg2-0.1ubuntu0.1                       amd64        Simple DirectMedia Layer
ii  libsdl2-2.0-0:amd64                        2.0.8+dfsg1-1ubuntu1.18.04.4                    amd64        Simple DirectMedia Layer
ii  libsdl2-dev:amd64                          2.0.8+dfsg1-1ubuntu1.18.04.4                    amd64        Simple DirectMedia Layer development files

Manual build and install libsdl by this method which then produces version 2.0.17 works for me.

@rom1v
Copy link
Collaborator

rom1v commented Nov 14, 2021

Thank you for the report 👍

SDL_PIXELFORMAT_BGR444 has been introduced in SDL 1.0.12 by libsdl-org/SDL@a1c1185.

We need to ifdef the version:

scrcpy/app/src/compat.h

Lines 37 to 54 in 65b023a

#if SDL_VERSION_ATLEAST(2, 0, 5)
// <https://wiki.libsdl.org/SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH>
# define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH
// <https://wiki.libsdl.org/SDL_GetDisplayUsableBounds>
# define SCRCPY_SDL_HAS_GET_DISPLAY_USABLE_BOUNDS
// <https://wiki.libsdl.org/SDL_WindowFlags>
# define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP
#endif
#if SDL_VERSION_ATLEAST(2, 0, 6)
// <https://github.com/libsdl-org/SDL/commit/d7a318de563125e5bb465b1000d6bc9576fbc6fc>
# define SCRCPY_SDL_HAS_HINT_TOUCH_MOUSE_EVENTS
#endif
#if SDL_VERSION_ATLEAST(2, 0, 8)
// <https://hg.libsdl.org/SDL/rev/dfde5d3f9781>
# define SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
#endif

or even just remove the lines containing SDL_PIXELFORMAT_BGR444 (we don't care about this format in practice):

scrcpy/app/src/icon.c

Lines 174 to 175 in 65b023a

case AV_PIX_FMT_RGB444BE: return SDL_PIXELFORMAT_RGB444;
case AV_PIX_FMT_BGR444BE: return SDL_PIXELFORMAT_BGR444;

Will do it soon.

@rom1v
Copy link
Collaborator

rom1v commented Nov 14, 2021

Manual build and install libsdl by this method which then produces version 2.0.17 works for me.

Could you please uninstall your SDL 2.0.17, confirm that build fails, then apply this patch:

diff --git a/app/src/icon.c b/app/src/icon.c
index a3efbb01..e50c5bb2 100644
--- a/app/src/icon.c
+++ b/app/src/icon.c
@@ -172,7 +172,9 @@ to_sdl_pixel_format(enum AVPixelFormat fmt) {
         case AV_PIX_FMT_BGR565BE: return SDL_PIXELFORMAT_BGR565;
         case AV_PIX_FMT_BGR555BE: return SDL_PIXELFORMAT_BGR555;
         case AV_PIX_FMT_RGB444BE: return SDL_PIXELFORMAT_RGB444;
+#if SDL_VERSION_ATLEAST(2, 0, 12)
         case AV_PIX_FMT_BGR444BE: return SDL_PIXELFORMAT_BGR444;
+#endif
         case AV_PIX_FMT_PAL8: return SDL_PIXELFORMAT_INDEX8;
         default: return SDL_PIXELFORMAT_UNKNOWN;
     }

And confirm that it works?

Thank you

@npes87184
Copy link
Contributor

npes87184 commented Nov 14, 2021

Manual build and install libsdl by this method which then produces version 2.0.17 works for me.

Could you please uninstall your SDL 2.0.17, confirm that build fails, then apply this patch:

diff --git a/app/src/icon.c b/app/src/icon.c
index a3efbb01..e50c5bb2 100644
--- a/app/src/icon.c
+++ b/app/src/icon.c
@@ -172,7 +172,9 @@ to_sdl_pixel_format(enum AVPixelFormat fmt) {
         case AV_PIX_FMT_BGR565BE: return SDL_PIXELFORMAT_BGR565;
         case AV_PIX_FMT_BGR555BE: return SDL_PIXELFORMAT_BGR555;
         case AV_PIX_FMT_RGB444BE: return SDL_PIXELFORMAT_RGB444;
+#if SDL_VERSION_ATLEAST(2, 0, 12)
         case AV_PIX_FMT_BGR444BE: return SDL_PIXELFORMAT_BGR444;
+#endif
         case AV_PIX_FMT_PAL8: return SDL_PIXELFORMAT_INDEX8;
         default: return SDL_PIXELFORMAT_UNKNOWN;
     }

And confirm that it works?

Thank you

FAILED: app/scrcpy.p/src_icon.c.o 
cc -Iapp/scrcpy.p -Iapp -I../app -I../app/src -I/usr/include/x86_64-linux-gnu -I/usr/local/include/SDL2 -I/usr/include/libusb-1.0 -flto -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O3 -D_REENTRANT -MD -MQ app/scrcpy.p/src_icon.c.o -MF app/scrcpy.p/src_icon.c.o.d -o app/scrcpy.p/src_icon.c.o -c ../app/src/icon.c
../app/src/icon.c:161:8: error: unknown type name ‘SDL_PixelFormatEnum’
 static SDL_PixelFormatEnum
        ^~~~~~~~~~~~~~~~~~~
../app/src/icon.c: In function ‘load_from_path’:
../app/src/icon.c:202:5: error: unknown type name ‘SDL_PixelFormatEnum’; did you mean ‘SDL_PixelFormat’?
     SDL_PixelFormatEnum format = to_sdl_pixel_format(frame->format);
     ^~~~~~~~~~~~~~~~~~~
     SDL_PixelFormat
ninja: build stopped: subcommand failed.

I can confirm this patch fixes the problem about SDL_PIXELFORMAT_BGR444. However, there is another problem need to be solved, SDL_PixelFormatEnum.

Maybe simply define it as int?

rom1v added a commit that referenced this issue Nov 14, 2021
SDL_PixelFormatEnum has been introduced in SDL 2.0.10:
<libsdl-org/SDL@cc6a8ac>

SDL_PIXELFORMAT_BGR444 has been introduced in SDL 2.0.12:
<libsdl-org/SDL@a1c1185>

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

rom1v commented Nov 14, 2021

@npes87184 👍 I opened PR #2781.

@rom1v rom1v closed this as completed in 739ff9d Nov 14, 2021
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

Successfully merging a pull request may close this issue.

3 participants