Opened 7 years ago

Closed 7 years ago

#6049 closed defect (fixed)

ICC 14: identifier "ATOMIC_VAR_INIT" is undefined

Reported by: barsnick Owned by:
Priority: normal Component: avutil
Version: git-master Keywords: icc atomics
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
ffmpeg fails to compile with ICC14, due to missing definition of ATOMIC_VAR_INIT.

How to reproduce:
Configure ffmpeg with ICC-14.0.3. Compile

barsnick@sunshine:/usr/new/tools/video/ffmpeg > (cd ffmpeg-build-2016-12-27/ && hilite make V=1)
icc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DOPJ_STATIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -std=c99 -fomit-frame-pointer -pthread  -I/usr/include/fribidi -I/usr/include/freetype2  -I/usr/include/freetype2 -I/usr/kerberos/include  -I/usr/include/tesseract -I/usr/include/leptonica       -I/usr/new/tools/video/install/x264/20160703/include  -D_REENTRANT -I/usr/include/SDL2  -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 -Wno-unused-const-variable -O3 -fno-math-errno -fno-signed-zeros -w1 -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203 -falign-stack=maintain-16-byte  -MMD -c -o libavutil/cpu.o libavutil/cpu.c
libavutil/cpu.c(48): error: identifier "ATOMIC_VAR_INIT" is undefined
  static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
                                ^

libavutil/cpu.c(48): error: function call is not allowed in a constant expression
  static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
                                ^

compilation aborted for libavutil/cpu.c (code 2)
make: *** [libavutil/cpu.o] Error 2
barsnick@sunshine:/usr/new/tools/video/ffmpeg > icc --version
icc (ICC) 14.0.3 20140422
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

barsnick@sunshine:/usr/new/tools/video/ffmpeg > 

At quick glance, I believe this is because configuration with ICC passes the "stdatomic_h" test, but ICC fails to provide the said macro, which is assumed by ffmpeg to be present.

check_builtin stdatomic_h stdatomic.h atomic_int foo; atomic_store(&foo, 0)
check_code ld stdatomic.h atomic_int foo; atomic_store(&foo, 0) cc
check_ld cc
check_cc
BEGIN /tmp/ffconf.IcsNTRsq.c
    1   #include <stdatomic.h>
    2   int main(void) { atomic_int foo; atomic_store(&foo, 0); return 0; }
END /tmp/ffconf.IcsNTRsq.c
icc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.R48HrWHU.o /tmp/ffconf.IcsNTRsq.c
icc -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.9NysBQnz /tmp/ffconf.R48HrWHU.o -lrt

The issue was probably exposed with the first actual use of ATOMIC_VAR_INIT with commit fed50c4304eecb352e29ce789cdb96ea84d6162f. I'm too lazy/sleepy to bisect, but it seems obvious to me.

fate.ffmpeg.org seems to expose the same error, though I can only find one ICC build there, and don't know how to find older attempts.

http://fate.ffmpeg.org/report.cgi?time=20161227220741&slot=x86_64-archlinux-icc-2013

Change History (1)

comment:1 by James, 7 years ago

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