kidrigger / godot-videodecoder

GDNative Video Decoder libraries for Godot Game Engine, using FFmpeg library for codecs. A Google Summer of Code Project, 2018
MIT License
84 stars 22 forks source link

Crash when building against system-provided ffmpeg 4.1 on Mageia 7 #5

Closed akien-mga closed 3 years ago

akien-mga commented 5 years ago

While building ffmpeg's release/4.1 from source following the README instructions work fine, I get a segfault when I try to build against the ffmpeg 4.1.1 libraries provided by my Linux distro, Mageia 7.

$ godot-git -e
OpenGL ES 3.0 Renderer: GeForce GTX 670MX/PCIe/SSE2
ctor()
set_audio_track()
open_file()
QuickTime / MOV
Channel count: 0
[IMGUTILS @ 0x7ffda9b82990] Picture size 32547x0 is invalid
ERROR: alloc_static: Condition ' !mem ' is true. returned: __null
   At: core/os/memory.cpp:87.
[IMGUTILS @ 0x7ffda9b82990] Picture size 32547x0 is invalid
WARNING: godot_videodecoder_open_file(): Frame fill.
   At: src/gdnative_videodecoder.c:549.
get_channels()
get_mix_rate()
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6() [0x388d43cc00] (??:0)
[2] /home/akien/tmp/godot/test/godot-videodecoder/test/addons/bin/x11/libgdnative_videodecoder.so(godot_videodecoder_get_texture_size+0x2d) [0x7f236f47e3ac] (??:0)
[3] VideoStreamPlaybackGDNative::open_file(String const&) (/home/akien/Projects/godot/godot.git/modules/gdnative/videodecoder/video_stream_gdnative.cpp:123 (discriminator 2))
[4] VideoStreamGDNative::instance_playback() (/home/akien/Projects/godot/godot.git/modules/gdnative/videodecoder/video_stream_gdnative.cpp:322)
[5] VideoPlayer::set_stream(Ref<VideoStream> const&) (/home/akien/Projects/godot/godot.git/scene/gui/video_player.cpp:209)
[6] MethodBind1<Ref<VideoStream> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/./core/method_bind.gen.inc:729 (discriminator 12))
[7] ClassDB::set_property(Object*, StringName const&, Variant const&, bool*) (/home/akien/Projects/godot/godot.git/core/class_db.cpp:1020)
[8] Object::set(StringName const&, Variant const&, bool*) (/home/akien/Projects/godot/godot.git/core/object.cpp:422)
[9] SceneState::instance(SceneState::GenEditState) const (/home/akien/Projects/godot/godot.git/scene/resources/packed_scene.cpp:216 (discriminator 22))
[10] PackedScene::instance(PackedScene::GenEditState) const (/home/akien/Projects/godot/godot.git/scene/resources/packed_scene.cpp:1697)
[11] EditorNode::load_scene(String const&, bool, bool, bool, bool) (/home/akien/Projects/godot/godot.git/editor/editor_node.cpp:3016)
[12] EditorNode::_sources_changed(bool) (/home/akien/Projects/godot/godot.git/editor/editor_node.cpp:542)
[13] MethodBind1<bool>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/./core/method_bind.gen.inc:729 (discriminator 12))
[14] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/object.cpp:943 (discriminator 1))
[15] Object::emit_signal(StringName const&, Variant const**, int) (/home/akien/Projects/godot/godot.git/core/object.cpp:1229 (discriminator 1))
[16] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/akien/Projects/godot/godot.git/core/object.cpp:1285)
[17] EditorFileSystem::_notification(int) (/home/akien/Projects/godot/godot.git/editor/editor_file_system.cpp:1159 (discriminator 4))
[18] EditorFileSystem::_notificationv(int, bool) (/home/akien/Projects/godot/godot.git/editor/editor_file_system.h:107 (discriminator 14))
[19] Object::notification(int, bool) (/home/akien/Projects/godot/godot.git/core/object.cpp:955)
[20] SceneTree::_notify_group_pause(StringName const&, int) (/home/akien/Projects/godot/godot.git/scene/main/scene_tree.cpp:969)
[21] SceneTree::idle(float) (/home/akien/Projects/godot/godot.git/scene/main/scene_tree.cpp:518 (discriminator 3))
[22] Main::iteration() (/home/akien/Projects/godot/godot.git/main/main.cpp:1885)
[23] OS_X11::run() (/home/akien/Projects/godot/godot.git/platform/x11/os_x11.cpp:3004)
[24] godot-git(main+0xbb) [0x11b56dd] (/home/akien/Projects/godot/godot.git/platform/x11/godot_x11.cpp:56)
[25] /lib64/libc.so.6(__libc_start_main+0xeb) [0x388d426b0b] (??:0)
[26] godot-git(_start+0x2a) [0x11b557a] (/home/iurt/rpmbuild/BUILD/glibc-2.29/csu/../sysdeps/x86_64/start.S:122)
-- END OF BACKTRACE --
Abandon (core dumped)

I installed the relevant ffmpeg libs and includes in test/addons/bin/x11 as expected, and it built and linked fine. The crash happens when running the engine.

It's probably due to a config difference between Mageia's ffmpeg and the one built from source with this repo's instructions, but it would be good to find out which to be able to document it.

akien-mga commented 5 years ago

Here are the build instructions used for Mageia's ffmpeg: http://svnweb.mageia.org/packages/cauldron/ffmpeg/current/SPECS/ffmpeg.spec?view=markup&pathrev=1365069

I notice that a packager disabled opencv support there a while ago with the bootstrap variable, and forgot to reenable it, so that's probably why it fails. It would be good to error out properly instead of crashing in such situation though.

jamie-pate commented 4 years ago

The new instructions to build using ffmpeg-static should be more portable

jamie-pate commented 4 years ago

And now it runs inside a Docker container and the Linux build is actually portable