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

ninja error #2862

Closed
illa-illa opened this issue Dec 6, 2021 · 17 comments
Closed

ninja error #2862

illa-illa opened this issue Dec 6, 2021 · 17 comments

Comments

@illa-illa
Copy link

  • [yes ] I have read the FAQ.
  • [ yes] I have searched in existing issues.

Environment

  • OS: [e.g. Debian, Windows, macOS...] ubuntu 16.04
  • scrcpy version: [e.g. 1.12.1] 1.12.1
  • installation method: [e.g. manual build, apt, snap, brew, Windows release...] manual build
  • device model:huawei p40
  • Android version: [e.g. 10] 11

Describe the bug
A clear and concise description of what the bug is.
ninja error
On errors, please provide the output of the console (and adb logcat if relevant).
build error

Please paste terminal output in a code block.

dell@softdell:/home/Data/scrcpy/x$ ninja
[0/3] Generating server/scrcpy-server with a custom command

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 463ms
35 actionable tasks: 35 up-to-date
[1/3] Compiling C object app/scrcpy.p/src_icon.c.o
FAILED: app/scrcpy.p/src_icon.c.o
ccache cc -Iapp/scrcpy.p -Iapp -I../app -I../app/src -I/usr/include/x86_64-linux-gnu -I/usr/include/SDL2 -I/usr/include/libusb-1.0 -flto=16 -fdiagnostics-color=always -DNDEBUG -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: In function ‘to_sdl_pixel_format’:
../app/src/icon.c:172:38: error: ‘SDL_PIXELFORMAT_ARGB32’ undeclared (first use in this function)
case AV_PIX_FMT_ARGB: return SDL_PIXELFORMAT_ARGB32;
^
../app/src/icon.c:172:38: note: each undeclared identifier is reported only once for each function it appears in
../app/src/icon.c:173:38: error: ‘SDL_PIXELFORMAT_RGBA32’ undeclared (first use in this function)
case AV_PIX_FMT_RGBA: return SDL_PIXELFORMAT_RGBA32;
^
../app/src/icon.c:174:38: error: ‘SDL_PIXELFORMAT_ABGR32’ undeclared (first use in this function)
case AV_PIX_FMT_ABGR: return SDL_PIXELFORMAT_ABGR32;
^
../app/src/icon.c:175:38: error: ‘SDL_PIXELFORMAT_BGRA32’ undeclared (first use in this function)
case AV_PIX_FMT_BGRA: return SDL_PIXELFORMAT_BGRA32;
^
../app/src/icon.c: In function ‘load_from_path’:
../app/src/icon.c:217:9: warning: implicit declaration of function ‘SDL_CreateRGBSurfaceWithFormatFrom’ [-Wimplicit-function-declaration]
SDL_CreateRGBSurfaceWithFormatFrom(frame->data[0],
^
../app/src/icon.c:217:9: warning: initialization makes pointer from integer without a cast [-Wint-conversion]

Please do not post screenshots of your terminal, just post the content as text instead.

@rom1v
Copy link
Collaborator

rom1v commented Dec 6, 2021

Does it still happen on current master? (see #2781) (I guess this still happens)

What is your SDL version?

@illa-illa
Copy link
Author

sudo apt install ffmpeg libsdl2-2.0.0

client build dependencies

sudo apt install make gcc pkg-config meson
libavcodec-dev libavformat-dev libavutil-dev
libsdl2-dev
I installed it with the above command

@illa-illa
Copy link
Author

thank you for your reply

@illa-illa
Copy link
Author

Is this version wrong?

@rom1v
Copy link
Collaborator

rom1v commented Dec 6, 2021

The problem is that Ubuntu 16.04 is very very old (16.04 is not even supported anymore by Ubuntu I think), and packages a very old version of SDL.

Since recent changes, scrcpy uses SDL functions which were not available back then. It might be possible to fix compilation issues, either by disabling some features or rewriting them differently with old APIs (will check later).

In any case (and independently of scrcpy), you should really consider to upgrade your distribution.

@illa-illa
Copy link
Author

ok,this is my work pc,Upgrading the system is a difficult thing,do you have time to fix this problem?

@oldclock
Copy link

oldclock commented Dec 6, 2021

I have similar situation on Ubuntu 16.04
I can build scrcpy success before version 1.17, and there are errors since 1.18.
@illa-illa if you do not need recent scrcpy features, maybe you could rollback and build scrcpy 1.17 for Ubuntu 16.04 PC.

@illa-illa
Copy link
Author

new error,Is this a problem with the ffmpeg version?

@illa-illa
Copy link
Author

@oldclock

@illa-illa
Copy link
Author

25/26] Linking target app/scrcpy
FAILED: app/scrcpy
cc -o app/scrcpy app/scrcpy.p/src_main.co app/scrcpy.p/src_cli.co app/scrcpy.p/src_command.co app/scrcpy.p/src_control_msg.co app/scrcpy.p/src_controller. co app/scrcpy.p/src_decoder.co app/scrcpy.p/src_device.co app/scrcpy.p/src_device_msg.co app/scrcpy.p/src_event_converter.co app/scrcpy.p/src_file_handler.co app/scrcpy. p/src_fps_counter.co app/scrcpy.p/src_input_manager.co app/scrcpy.p/src_opengl.co app/scrcpy.p/src_receiver.co app/scrcpy.p/src_recorder.co app/scrcpy.p/src_scrcpy.co app/scrcpy.p/src_screen.co app/scrcpy.p/src_server.co app/scrcpy.p/src_stream.co app/scrcpy.p/src_tiny_xpm.co app/scrcpy.p/src_video_buffer.co app/scrcpy.p /src_util_net.co app/scrcpy.p/src_util_str_util.co app/scrcpy.p/src_sys_unix_command.co -flto -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,-- start-group /usr/lib/x86_64-linux-gnu/libavformat-ffmpeg.so /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so /usr/lib/x86_64-linux-gnu/libavutil-ffmpeg. so /usr/lib/x86_64-linux-gnu/libSDL2. so -Wl,--end-group
/tmp/cceajUAg.ltrans2.ltrans.o: In the function ‘run_stream.lto_priv.97’:
:(.text+0xd7): Undefined reference to ‘av_muxer_iterate’
:(.text+0x497): undefined reference to ‘avcodec_send_packet’
:(.text+0x4af): Undefined reference to ‘avcodec_receive_frame’
collect2: error: ld returned 1 exit status
FAILED: server/scrcpy-server
/home/Data/scrcpy/server/./scripts/build-wrapper.sh /home/Data/scrcpy/server server/scrcpy-server release
ninja: build stopped: subcommand failed.

@rom1v
Copy link
Collaborator

rom1v commented Dec 6, 2021

For these FFmpeg errors, you must use a version prior to: 5d9e96d (v1.17 should work I guess, I'm on phone so it's not easy to check).

@illa-illa
Copy link
Author

Can't solve,i guess FFmpeg maybe misconfigured,

rom1v added a commit that referenced this issue Dec 6, 2021
Icon loading uses SDL_CreateRGBSurfaceWithFormatFrom(), available since
SDL 2.0.5 (in 2016).

Refs #2862 <#2862>
rom1v added a commit that referenced this issue Dec 6, 2021
In ffmpeg/doc/APIchanges:

> 2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h
>   Add AVStream.codecpar, deprecate AVStream.codec.

Refs 5d9e96d

Refs #2862 <#2862>
rom1v added a commit that referenced this issue Dec 6, 2021
In ffmpeg/doc/APIchanges:

> 2016-04-21 - 7fc329e - lavc 57.37.100 - avcodec.h
>   Add a new audio/video encoding and decoding API with decoupled input
>   and output -- avcodec_send_packet(), avcodec_receive_frame(),
>   avcodec_send_frame() and avcodec_receive_packet().

Refs de9b79e

Refs #2862 <#2862>
@illa-illa
Copy link
Author

I tried to check to dev.wip, but there are still errors

@illa-illa
Copy link
Author

Run-time dependency libavformat found: YES 58.76.100
Run-time dependency libavcodec found: YES 58.134.100
Dependency libavutil found: YES 54.31.100 (cached)
Dependency sdl2 found: NO found 2.0.4 but need: '>= 2.0.5'
sdl2-config found: NO found '2.0.4' but need ['>= 2.0.5']
Run-time dependency sdl2 found: NO (tried config-tool)

../app/meson.build:86:4: ERROR: Invalid version of dependency, need 'sdl2' ['>= 2.0.5'] found '2.0.4'.

A full log can be found at /home/Data/scrcpy/x/meson-logs/meson-log.txt
FAILED: build.ninja
/home/dell/.local/bin/meson --internal regenerate /home/Data/scrcpy /home/Data/scrcpy/x --backend ninja
ninja: error: rebuilding 'build.ninja': subcommand failed

@illa-illa
Copy link
Author

It looks like you set some restrictions on the version

@illa-illa
Copy link
Author

I successfully ran scrcpy
I did the following steps
clone a new sdl code
make
install
Can now build successfully

@illa-illa
Copy link
Author

thank you for your support

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