Opened 9 years ago

Closed 9 years ago

#4075 closed defect (fixed)

libavutil time_interal gmtime_r, localtime_3 fail compiling on Windows

Reported by: Selur Owned by:
Priority: important Component: avutil
Version: git-master Keywords: win regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Compiling the latest version with https://github.com/jb-alvarado/media-autobuild_suite I get the following:

In file included from ./libavutil/time_internal.h:22:0,
                 from libavformat/matroskadec.c:49:
./libavutil/time_internal.h:26:26: error: expected identifier or '(' before '{' token
 static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
                          ^
./libavutil/time_internal.h:37:26: error: expected identifier or '(' before '{' token
 static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
                          ^
CC      libavformat/mms.o
CC      libavformat/mmsh.o
common.mak:49: recipe for target 'libavformat/matroskadec.o' failed
make: *** [libavformat/matroskadec.o] Error 1
make: *** Waiting for unfinished jobs....
CC      libavformat/mmst.o
CC      ffmpeg.o
ffmpeg.c: In function 'write_frame':
ffmpeg.c:629:9: warning: 'destruct' is deprecated (declared at ./libavcodec/avcodec.h:1170)                                                                                                                                                                                    [-Wdeprecated-declarations]
         if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {
         ^
ffmpeg.c: In function 'decode_video':
ffmpeg.c:1899:13: warning: 'av_log_ask_for_sample' is deprecated (declared at ./libavcodec/a                                                                                                                                                                                   vcodec.h:5144) [-Wdeprecated-declarations]
             av_log_ask_for_sample(
             ^
ffmpeg.c: At top level:
ffmpeg.c:158:13: warning: 'free_input_threads' declared 'static' but never defined [-Wunused                                                                                                                                                                                   -function]
 static void free_input_threads(void);
             ^
AR      libavdevice/libavdevice.a
AR      libavfilter/libavfilter.a
CC      libavformat/matroskadec.o
In file included from ./libavutil/time_internal.h:22:0,
                 from libavformat/matroskadec.c:49:
./libavutil/time_internal.h:26:26: error: expected identifier or '(' before '{' token
 static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
                          ^
./libavutil/time_internal.h:37:26: error: expected identifier or '(' before '{' token
 static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
                          ^
common.mak:49: recipe for target 'libavformat/matroskadec.o' failed
make: *** [libavformat/matroskadec.o] Error 1

problem seems to happen since yesterday

Attachments (1)

config-log.zip (57.3 KB ) - added by jb_alvarado 9 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Carl Eugen Hoyos, 9 years ago

Keywords: win regression added; gmtime localtime windows compile removed
Priority: normalimportant

Please confirm that this happens with ./configure && make and please run make V=1 twice and provide the output if the second run.

comment:2 by jb_alvarado, 9 years ago

Hi, I will answer because Selur it not there at the moment. The V=1 Output is;

rm -f libavdevice/libavdevice.a
ar rc libavdevice/libavdevice.a libavdevice/alldevices.o libavdevice/avdevice.o libavdevice/caca.o libavdevice/dshow.o libavdevice/dshow_common.o libavdevice/dshow_enummediatypes.o libavdevice/dshow_enumpins.o libavdevice/dshow_filter.o libavdevice/dshow_pin.o libavdevice/gdigrab.o libavdevice/lavfi.o libavdevice/openal-dec.o libavdevice/sdl.o libavdevice/vfwcap.o
: libavdevice/libavdevice.a
rm -f libavfilter/libavfilter.a
ar rc libavfilter/libavfilter.a libavfilter/aeval.o libavfilter/af_adelay.o libavfilter/af_aecho.o libavfilter/af_afade.o libavfilter/af_aformat.o libavfilter/af_amerge.o libavfilter/af_amix.o libavfilter/af_anull.o libavfilter/af_apad.o libavfilter/af_aphaser.o libavfilter/af_aresample.o libavfilter/af_asetnsamples.o libavfilter/af_asetrate.o libavfilter/af_ashowinfo.o libavfilter/af_astats.o libavfilter/af_astreamsync.o libavfilter/af_atempo.o libavfilter/af_biquads.o libavfilter/af_channelmap.o libavfilter/af_channelsplit.o libavfilter/af_compand.o libavfilter/af_earwax.o libavfilter/af_flanger.o libavfilter/af_join.o libavfilter/af_pan.o libavfilter/af_replaygain.o libavfilter/af_silencedetect.o libavfilter/af_silenceremove.o libavfilter/af_volume.o libavfilter/af_volumedetect.o libavfilter/allfilters.o libavfilter/asink_anullsink.o libavfilter/asrc_anullsrc.o libavfilter/asrc_sine.o libavfilter/audio.o libavfilter/avcodec.o libavfilter/avf_avectorscope.o libavfilter/avf_concat.o libavfilter/avf_showcqt.o libavfilter/avf_showspectrum.o libavfilter/avf_showwaves.o libavfilter/avfilter.o libavfilter/avfiltergraph.o libavfilter/bbox.o libavfilter/buffer.o libavfilter/buffersink.o libavfilter/buffersrc.o libavfilter/drawutils.o libavfilter/dualinput.o libavfilter/f_ebur128.o libavfilter/f_interleave.o libavfilter/f_perms.o libavfilter/f_select.o libavfilter/f_sendcmd.o libavfilter/fifo.o libavfilter/formats.o libavfilter/framesync.o libavfilter/generate_wave_table.o libavfilter/graphdump.o libavfilter/graphparser.o libavfilter/lavfutils.o libavfilter/libmpcodecs/img_format.o libavfilter/libmpcodecs/mp_image.o libavfilter/libmpcodecs/vf_eq.o libavfilter/libmpcodecs/vf_eq2.o libavfilter/libmpcodecs/vf_fspp.o libavfilter/libmpcodecs/vf_ilpack.o libavfilter/libmpcodecs/vf_pp7.o libavfilter/libmpcodecs/vf_softpulldown.o libavfilter/libmpcodecs/vf_uspp.o libavfilter/lswsutils.o libavfilter/opencl_allkernels.o libavfilter/pthread.o libavfilter/setpts.o libavfilter/settb.o libavfilter/split.o libavfilter/src_movie.o libavfilter/transform.o libavfilter/trim.o libavfilter/vf_alphamerge.o libavfilter/vf_aspect.o libavfilter/vf_bbox.o libavfilter/vf_blackdetect.o libavfilter/vf_blackframe.o libavfilter/vf_blend.o libavfilter/vf_boxblur.o libavfilter/vf_codecview.o libavfilter/vf_colorbalance.o libavfilter/vf_colorchannelmixer.o libavfilter/vf_colormatrix.o libavfilter/vf_copy.o libavfilter/vf_crop.o libavfilter/vf_cropdetect.o libavfilter/vf_curves.o libavfilter/vf_dctdnoiz.o libavfilter/vf_decimate.o libavfilter/vf_dejudder.o libavfilter/vf_delogo.o libavfilter/vf_deshake.o libavfilter/vf_drawbox.o libavfilter/vf_drawtext.o libavfilter/vf_edgedetect.o libavfilter/vf_elbg.o libavfilter/vf_extractplanes.o libavfilter/vf_fade.o libavfilter/vf_field.o libavfilter/vf_fieldmatch.o libavfilter/vf_fieldorder.o libavfilter/vf_format.o libavfilter/vf_fps.o libavfilter/vf_framepack.o libavfilter/vf_framestep.o libavfilter/vf_frei0r.o libavfilter/vf_geq.o libavfilter/vf_gradfun.o libavfilter/vf_hflip.o libavfilter/vf_histeq.o libavfilter/vf_histogram.o libavfilter/vf_hqdn3d.o libavfilter/vf_hqx.o libavfilter/vf_hue.o libavfilter/vf_idet.o libavfilter/vf_il.o libavfilter/vf_interlace.o libavfilter/vf_kerndeint.o libavfilter/vf_lenscorrection.o libavfilter/vf_lut.o libavfilter/vf_lut3d.o libavfilter/vf_mcdeint.o libavfilter/vf_mergeplanes.o libavfilter/vf_mp.o libavfilter/vf_mpdecimate.o libavfilter/vf_noise.o libavfilter/vf_null.o libavfilter/vf_overlay.o libavfilter/vf_owdenoise.o libavfilter/vf_pad.o libavfilter/vf_perspective.o libavfilter/vf_phase.o libavfilter/vf_pixdesctest.o libavfilter/vf_pp.o libavfilter/vf_psnr.o libavfilter/vf_pullup.o libavfilter/vf_removelogo.o libavfilter/vf_rotate.o libavfilter/vf_sab.o libavfilter/vf_scale.o libavfilter/vf_separatefields.o libavfilter/vf_setfield.o libavfilter/vf_showinfo.o libavfilter/vf_shuffleplanes.o libavfilter/vf_signalstats.o libavfilter/vf_smartblur.o libavfilter/vf_spp.o libavfilter/vf_stereo3d.o libavfilter/vf_subtitles.o libavfilter/vf_super2xsai.o libavfilter/vf_swapuv.o libavfilter/vf_telecine.o libavfilter/vf_thumbnail.o libavfilter/vf_tile.o libavfilter/vf_tinterlace.o libavfilter/vf_transpose.o libavfilter/vf_unsharp.o libavfilter/vf_vflip.o libavfilter/vf_vidstabdetect.o libavfilter/vf_vidstabtransform.o libavfilter/vf_vignette.o libavfilter/vf_w3fdif.o libavfilter/vf_yadif.o libavfilter/vf_zoompan.o libavfilter/video.o libavfilter/vidstabutils.o libavfilter/vsink_nullsink.o libavfilter/vsrc_cellauto.o libavfilter/vsrc_life.o libavfilter/vsrc_mandelbrot.o libavfilter/vsrc_mptestsrc.o libavfilter/vsrc_testsrc.o libavfilter/x86/af_volume.o libavfilter/x86/af_volume_init.o libavfilter/x86/vf_gradfun.o libavfilter/x86/vf_gradfun_init.o libavfilter/x86/vf_hqdn3d.o libavfilter/x86/vf_hqdn3d_init.o libavfilter/x86/vf_idet.o libavfilter/x86/vf_idet_init.o libavfilter/x86/vf_noise.o libavfilter/x86/vf_pullup.o libavfilter/x86/vf_pullup_init.o libavfilter/x86/vf_spp.o libavfilter/x86/vf_yadif.o libavfilter/x86/vf_yadif_init.o libavfilter/x86/yadif-10.o libavfilter/x86/yadif-16.o
: libavfilter/libavfilter.a
gcc -I. -I./ -DFRIBIDI_ENTRY=""  -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__ -DZLIB_CONST -DHAVE_AV_CONFIG_H -I/local32/include -I/mingw32/include -mms-bitfields -mthreads -mtune=generic -pipe  -DPTW32_STATIC_LIB -DLIBTWOLAME_STATIC -DCACA_STATIC -std=c99 -fomit-frame-pointer -I/local32/include -I/mingw32/include -I/local32/include -I/mingw32/include -I/local32/include/freetype2 -I/mingw32/include -I/mingw32/include/libpng16 -I/local32/include/fribidi -I/local32/include/freetype2 -I/mingw32/include -I/mingw32/include/libpng16 -I/local32/include -I/local32/include -I/local32/include -I/mingw32/include -I/local32/include/freetype2 -I/mingw32/include -I/mingw32/include/libpng16 -I/local32/include/freetype2 -I/mingw32/include -I/mingw32/include/libpng16 -I/local32/include/freetype2 -I/mingw32/include -I/mingw32/include/libpng16 -I/local32/include -I/local32/include/opus -I/local32/include -I/mingw32/include -I/local32/include/schroedinger-1.0 -I/local32/include/orc-0.4 -I/local32/include -ID:/_System/mingw64_Oktober2014/local32/include -I/local32/include -ID:/_System/mingw64_Oktober2014/local32/include -D_GNU_SOURCE=1 -Dmain=SDL_main -I/local32/include/SDL -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized  -MMD -MF libavformat/matroskadec.d -MT libavformat/matroskadec.o -c -o libavformat/matroskadec.o libavformat/matroskadec.c
In file included from ./libavutil/time_internal.h:22:0,
                 from libavformat/matroskadec.c:49:
./libavutil/time_internal.h:26:26: error: expected identifier or '(' before '{' token
 static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
                          ^
./libavutil/time_internal.h:37:26: error: expected identifier or '(' before '{' token
 static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
                          ^
common.mak:49: die Regel für Ziel „libavformat/matroskadec.o“ scheiterte
make: *** [libavformat/matroskadec.o] Fehler 1

Regard

jb_

comment:3 by jb_alvarado, 9 years ago

I was not follow your instruction fully. Here is the output when I only configure ffmpeg without any external libs.

rm -f libavdevice/libavdevice.a
ar rc libavdevice/libavdevice.a libavdevice/alldevices.o libavdevice/avdevice.o libavdevice/dshow.o libavdevice/dshow_common.o libavdevice/dshow_enummediatypes.o libavdevice/dshow_enumpins.o libavdevice/dshow_filter.o libavdevice/dshow_pin.o libavdevice/gdigrab.o libavdevice/lavfi.o libavdevice/sdl.o libavdevice/vfwcap.o
: libavdevice/libavdevice.a
rm -f libavfilter/libavfilter.a
ar rc libavfilter/libavfilter.a libavfilter/aeval.o libavfilter/af_adelay.o libavfilter/af_aecho.o libavfilter/af_afade.o libavfilter/af_aformat.o libavfilter/af_amerge.o libavfilter/af_amix.o libavfilter/af_anull.o libavfilter/af_apad.o libavfilter/af_aphaser.o libavfilter/af_aresample.o libavfilter/af_asetnsamples.o libavfilter/af_asetrate.o libavfilter/af_ashowinfo.o libavfilter/af_astats.o libavfilter/af_astreamsync.o libavfilter/af_atempo.o libavfilter/af_biquads.o libavfilter/af_channelmap.o libavfilter/af_channelsplit.o libavfilter/af_compand.o libavfilter/af_earwax.o libavfilter/af_flanger.o libavfilter/af_join.o libavfilter/af_pan.o libavfilter/af_replaygain.o libavfilter/af_silencedetect.o libavfilter/af_silenceremove.o libavfilter/af_volume.o libavfilter/af_volumedetect.o libavfilter/allfilters.o libavfilter/asink_anullsink.o libavfilter/asrc_anullsrc.o libavfilter/asrc_sine.o libavfilter/audio.o libavfilter/avcodec.o libavfilter/avf_avectorscope.o libavfilter/avf_concat.o libavfilter/avf_showcqt.o libavfilter/avf_showspectrum.o libavfilter/avf_showwaves.o libavfilter/avfilter.o libavfilter/avfiltergraph.o libavfilter/bbox.o libavfilter/buffer.o libavfilter/buffersink.o libavfilter/buffersrc.o libavfilter/drawutils.o libavfilter/dualinput.o libavfilter/f_interleave.o libavfilter/f_perms.o libavfilter/f_select.o libavfilter/f_sendcmd.o libavfilter/fifo.o libavfilter/formats.o libavfilter/framesync.o libavfilter/generate_wave_table.o libavfilter/graphdump.o libavfilter/graphparser.o libavfilter/lavfutils.o libavfilter/lswsutils.o libavfilter/opencl_allkernels.o libavfilter/pthread.o libavfilter/setpts.o libavfilter/settb.o libavfilter/split.o libavfilter/src_movie.o libavfilter/transform.o libavfilter/trim.o libavfilter/vf_alphamerge.o libavfilter/vf_aspect.o libavfilter/vf_bbox.o libavfilter/vf_blackdetect.o libavfilter/vf_blend.o libavfilter/vf_codecview.o libavfilter/vf_colorbalance.o libavfilter/vf_colorchannelmixer.o libavfilter/vf_copy.o libavfilter/vf_crop.o libavfilter/vf_curves.o libavfilter/vf_dctdnoiz.o libavfilter/vf_decimate.o libavfilter/vf_dejudder.o libavfilter/vf_deshake.o libavfilter/vf_drawbox.o libavfilter/vf_edgedetect.o libavfilter/vf_elbg.o libavfilter/vf_extractplanes.o libavfilter/vf_fade.o libavfilter/vf_field.o libavfilter/vf_fieldmatch.o libavfilter/vf_fieldorder.o libavfilter/vf_format.o libavfilter/vf_fps.o libavfilter/vf_framepack.o libavfilter/vf_framestep.o libavfilter/vf_gradfun.o libavfilter/vf_hflip.o libavfilter/vf_histogram.o libavfilter/vf_hqx.o libavfilter/vf_hue.o libavfilter/vf_idet.o libavfilter/vf_il.o libavfilter/vf_lenscorrection.o libavfilter/vf_lut.o libavfilter/vf_lut3d.o libavfilter/vf_mergeplanes.o libavfilter/vf_noise.o libavfilter/vf_null.o libavfilter/vf_overlay.o libavfilter/vf_pad.o libavfilter/vf_pixdesctest.o libavfilter/vf_psnr.o libavfilter/vf_removelogo.o libavfilter/vf_rotate.o libavfilter/vf_scale.o libavfilter/vf_separatefields.o libavfilter/vf_setfield.o libavfilter/vf_showinfo.o libavfilter/vf_shuffleplanes.o libavfilter/vf_signalstats.o libavfilter/vf_swapuv.o libavfilter/vf_telecine.o libavfilter/vf_thumbnail.o libavfilter/vf_tile.o libavfilter/vf_transpose.o libavfilter/vf_unsharp.o libavfilter/vf_vflip.o libavfilter/vf_vignette.o libavfilter/vf_w3fdif.o libavfilter/vf_yadif.o libavfilter/vf_zoompan.o libavfilter/video.o libavfilter/vsink_nullsink.o libavfilter/vsrc_cellauto.o libavfilter/vsrc_life.o libavfilter/vsrc_mandelbrot.o libavfilter/vsrc_testsrc.o libavfilter/x86/af_volume.o libavfilter/x86/af_volume_init.o libavfilter/x86/vf_gradfun.o libavfilter/x86/vf_gradfun_init.o libavfilter/x86/vf_idet.o libavfilter/x86/vf_idet_init.o libavfilter/x86/vf_noise.o libavfilter/x86/vf_yadif.o libavfilter/x86/vf_yadif_init.o libavfilter/x86/yadif-10.o libavfilter/x86/yadif-16.o
: libavfilter/libavfilter.a
gcc -I. -I./ -I/local32/include -I/mingw32/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__ -DZLIB_CONST -DHAVE_AV_CONFIG_H -I/local32/include -I/mingw32/include -mms-bitfields -mthreads -mtune=generic -pipe   -std=c99 -fomit-frame-pointer -D_GNU_SOURCE=1 -Dmain=SDL_main -I/local32/include/SDL -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized  -MMD -MF libavformat/matroskadec.d -MT libavformat/matroskadec.o -c -o libavformat/matroskadec.o libavformat/matroskadec.c
In file included from ./libavutil/time_internal.h:22:0,
                 from libavformat/matroskadec.c:49:
./libavutil/time_internal.h:26:26: error: expected identifier or '(' before '{' token
 static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
                          ^
./libavutil/time_internal.h:37:26: error: expected identifier or '(' before '{' token
 static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
                          ^
common.mak:49: die Regel für Ziel „libavformat/matroskadec.o“ scheiterte
make: *** [libavformat/matroskadec.o] Fehler 1

comment:4 by Michael Niedermayer, 9 years ago

please attach config.log, config.h
also which mingw version is that exactly?

by jb_alvarado, 9 years ago

Attachment: config-log.zip added

comment:5 by jb_alvarado, 9 years ago

Hi, in the attachment you found the log and the config.h file. I use the newest mingw-w64 (32 bit) Version in MSYS2, gcc 4.9.2

comment:6 by jb_alvarado, 9 years ago

I also get this answer from the msys2 dev team:

We moved gmtime_r and localtime_r from pthead.h to time.h as that's closer to posix specs. Define _POSIX and/or include <time.h> in the relevant stuff.

I don't know that this helps.

Edit: And here a other answer from msys2 users:

This error occurs because *time_r are implemented as macros in mingw-w64, and FFmpeg configure cannot detect that systems using mingw-w64 have gmtime_r/localtime_r.
I work around this issue by modifying FFmpeg configure so that it can detect gmtime_r/localtime_r and adding -D_POSIX to cppflags.
Honestly, I want mingw-w64 to reimplement them as functions.

Last edited 9 years ago by jb_alvarado (previous) (diff)

comment:7 by Hendrik, 9 years ago

It builds fine here on mingw-w64 3.1.0 / gcc 4.9.1

comment:8 by Michael Niedermayer, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.