GNOME Bugzilla – Bug 797127
Build Error on linux: gstfilesink: format '%u' exprects argument of type 'unsigned int', but argument 10 has type 'guint64'
Last modified: 2018-09-12 02:03:44 UTC
Created attachment 373610 [details] Screen shot of build error. Dear all. When I downloaded GStreamer source code and tried to build, this error occued on gstfilesink.c like below: 1) GST_DEBUG_OBJECT (sink, "Queueing buffer list of %u bytes (%u buffers) at offset" G_GSIZE_FORMAT, size, num_buffers, sink->current_pos + sink->current_buffer_size); 2) GST_DEBUG_OBJECT (filesink, "Queueing buffer of %" G_GSIZE_FORMAT " bytes at offset" G_GSIZE_FORMAT, gst_buffer_get_size (buffer), filesink->current_pos + filesink->current_buffer_size); In these 2 cases, G_GSIZE_FORMAT is defined as "%u" while sink->current_pos is guint64, so this error occurs. So I think these 2 line should be fixed like 1) GST_DEBUG_OBJECT (sink, "Queueing buffer list of %u bytes (%u buffers) at offset %llu", size, num_buffers, sink->current_pos + sink->current_buffer_size); 2) GST_DEBUG_OBJECT (filesink, "Queueing buffer of %" G_GSIZE_FORMAT " bytes at offset %llu", gst_buffer_get_size (buffer), filesink->current_pos + filesink->current_buffer_size); Would you please check this??
Looks like this is a built for 32bit linux. gsize would be 32bit, where doing uint64 + uint == uint64. Clearly the compiler is right, and we need to use G_GUINT64_FORMAT here.
Created attachment 373611 [details] [review] filesink: Fix wrong printf format We add a guint64 and a guint, the result is a guint64. On 64bit architecture, this is the same, but on 32bit architecture, it's not.
This regression was added this summer, and went unnoticed since. commit b324e4b802cf15f6f0688df5552ba762b1774844 Author: Sebastian Dröge <sebastian@centricular.com> Date: Tue Aug 28 14:22:16 2018 +0300 filesink: Flush buffers before directly writing out buffers with the SYNC_AFTER flag Otherwise we write out the SYNC_AFTER buffer immediately, and the previously queued up buffers afterwards which then breaks the order of data. Also add various debug output.
Review of attachment 373611 [details] [review]: I think this modification can solve this build error on 32bit machine.
Review of attachment 373611 [details] [review]: I tested with this modification and gstreamer is built well on 32 bit machine.
Attachment 373611 [details] pushed as c81b2f6 - filesink: Fix wrong printf format