Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 671666 - media-plugins/gst-plugins-libav-1.14.2[libav] fails to build: src/libavutil/libm.h:54:32: error: static declaration of ‘cbrt’ follows non-static declaration
Summary: media-plugins/gst-plugins-libav-1.14.2[libav] fails to build: src/libavutil/l...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: GStreamer package maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-22 01:58 UTC by Thomas Capricelli
Modified: 2018-11-24 01:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,68.94 KB, text/plain)
2018-11-22 01:58 UTC, Thomas Capricelli
Details
build.log (build.log,42.56 KB, text/plain)
2018-11-23 17:34 UTC, Thomas Capricelli
Details
ffmpeg config.log (libav-ffbuild-config.log,456.66 KB, text/plain)
2018-11-24 00:30 UTC, Thomas Capricelli
Details
emerge --info (emergeinfo.txt,17.38 KB, text/plain)
2018-11-24 00:31 UTC, Thomas Capricelli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Capricelli 2018-11-22 01:58:45 UTC
Created attachment 555918 [details]
build.log

I'm trying to compile media-plugins/gst-plugins-libav with USE=libav to fix another problem (#654628) which prevent ANY update on my system.

Compilation fails with errors such as

In file included from src/libavutil/internal.h:169:0,
                 from src/libavutil/common.h:467,
                 from src/libavutil/avutil.h:296,
                 from src/libavutil/samplefmt.h:24,
                 from src/libavcodec/avcodec.h:31,
                 from src/libavformat/avformat.h:319,
                 from src/libavformat/amr.c:30:
src/libavutil/libm.h:458:41: error: static declaration of ‘trunc’ follows non-static declaration
 static av_always_inline av_const double trunc(double x)
                                         ^~~~~
In file included from /usr/include/features.h:428:0,
                 from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdint.h:9,
                 from src/libavutil/channel_layout.h:25,
                 from src/libavformat/amr.c:29:
/usr/include/bits/mathcalls.h:302:1: note: previous declaration of ‘trunc’ was here
 __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
 ^
In file included from src/libavutil/internal.h:169:0,
                 from src/libavutil/common.h:467,
                 from src/libavutil/avutil.h:296,
                 from src/libavutil/samplefmt.h:24,
                 from src/libavcodec/avcodec.h:31,
                 from src/libavformat/avformat.h:319,
                 from src/libavformat/amr.c:30:
src/libavutil/libm.h:465:40: error: static declaration of ‘truncf’ follows non-static declaration
 static av_always_inline av_const float truncf(float x)
                                        ^~~~~~
In file included from src/libavutil/common.h:36:0,
                 from src/libavutil/avutil.h:296,
                 from src/libavutil/samplefmt.h:24,
                 from src/libavcodec/avcodec.h:31,
                 from src/libavformat/avformat.h:319,
                 from src/libavformat/amr.c:30:
/usr/include/bits/mathcalls.h:302:1: note: previous declaration of ‘truncf’ was here
 __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
Comment 1 Arfrever Frehtes Taifersar Arahesis 2018-11-22 09:35:49 UTC
Please show 'emerge --info'.

gst-libs/ext/libav/libavutil/libm.h declares the relevant functions conditionally based on HAVE_* macros. Example:

#if !HAVE_TRUNC
static av_always_inline av_const double trunc(double x)
{
    return (x > 0) ? floor(x) : ceil(x);
}
#endif /* HAVE_TRUNC */


HAVE_* macros which are set in gst-libs/ext/libav/configure.
You need to find why they were not detected for you.
Comment 2 Arfrever Frehtes Taifersar Arahesis 2018-11-22 09:40:12 UTC
You might also check media-plugins/gst-plugins-libav-1.14.4.3.4.5 which requires patch from bug #666674.
Comment 3 Thomas Capricelli 2018-11-23 17:33:16 UTC
I'm kinda lost. It seems HAVE_TRUNC is not defined (though it really seems that 
my sys-libs/glibc-2.27-r6 provides it). :


berlioz /tmp/portage/media-plugins/gst-plugins-libav-1.14.2 # ack HAVE_TRUNC -w 
work/gst-libav-1.14.2-abi_x86_64.amd64/gst-libs/ext/libav/config.asm
261:%define HAVE_TRUNC 0

work/gst-libav-1.14.2-abi_x86_64.amd64/gst-libs/ext/libav/config.h
277:#define HAVE_TRUNC 0

work/gst-libav-1.14.2-abi_x86_64.amd64/gst-libs/ext/libav/ffbuild/config.mak
409:!HAVE_TRUNC=yes

work/gst-libav-1.14.2/gst-libs/ext/libav/libavutil/libm.h
457:#if !HAVE_TRUNC
462:#endif /* HAVE_TRUNC */


It took me some time to understand that libav config log is not in the usual /tmp/portage/media-plugins/gst-plugins-libav-1.14.2/temp but rather in 
/tmp/portage/media-plugins/gst-plugins-libav-1.14.2/work/gst-libav-1.14.2-abi_x86_64.amd64/gst-libs/ext/libav/ffbuild/config.log


But i dont understand why HAVE_TRUNC is set to false. I have a pretty boring/common x86_64-pc-linux-gnu-7.3.0.
Comment 4 Thomas Capricelli 2018-11-23 17:34:29 UTC
Created attachment 556024 [details]
build.log
Comment 5 Arfrever Frehtes Taifersar Arahesis 2018-11-23 21:09:18 UTC
You have again attached a build log, not config.log.
Please try media-plugins/gst-plugins-libav-1.14.4.3.4.5 which is now in the tree.
Also please show full 'emerge --info'.
Comment 6 Thomas Capricelli 2018-11-24 00:28:36 UTC
Oops, sorry for the build.log, indeed. I've just tried media-plugins/gst-plugins-libav-1.14.4.3.4.5:1.0/1.0::gentoo, which fails with the same errors.
Comment 7 Thomas Capricelli 2018-11-24 00:30:28 UTC
Created attachment 556086 [details]
ffmpeg config.log
Comment 8 Thomas Capricelli 2018-11-24 00:31:18 UTC
Created attachment 556088 [details]
emerge --info
Comment 9 Arfrever Frehtes Taifersar Arahesis 2018-11-24 01:21:11 UTC
The problem starts here:

"""
check_apple_framework AppKit
check_header_objcc AppKit/AppKit.h
check_objcc
BEGIN /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.m
    1   #include <AppKit/AppKit.h>
    2   int main(void) { return 0; }
END /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.m
x86_64-pc-linux-gnu-gcc -Werror=missing-prototypes -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=native -pipe -O2 -std=c11 -fomit-frame-pointer -fPIC -c -o /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.o /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.m
check_stat /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.o
  File: /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.o
  Size: 13552           Blocks: 32         IO Block: 4096   regular file
Device: 24h/36d Inode: 11661876    Links: 1
Access: (0644/-rw-r--r--)  Uid: (  250/ portage)   Gid: (  250/ portage)
Access: 2018-11-24 01:26:12.346062385 +0100
Modify: 2018-11-24 01:26:12.346062385 +0100
Change: 2018-11-24 01:26:12.346062385 +0100
 Birth: -
"""

This check for AppKit/AppKit.h header unexpectedly succeeds for you.

check_apple_framework() function is defined as:

check_apple_framework(){
    log check_apple_framework "$@"
    framework="$1"
    name="$(tolower $framework)"
    header="${framework}/${framework}.h"
    disable $name
    check_header_objcc $header && enable $name && add_extralibs "-framework $framework"
}

So this function adds "-framework AppKit" to list of used libraries.
Next, all checks fail at linking stage:
Example:

"""
check_mathfunc trunc 1
check_ld cc
check_cc
BEGIN /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.c
    1   #include <math.h>
    2   float foo(float f, float g) { return trunc(f); }
    3   int main(void){ return (int) foo; }
END /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.c
x86_64-pc-linux-gnu-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=native -pipe -O2 -std=c11 -fomit-frame-pointer -fPIC -c -o /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.o /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.c
/var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.c: In function 'main':
/var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.c:3:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 int main(void){ return (int) foo; }
                        ^
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -Wl,-z,noexecstack -o /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test /var/tmp/portage/media-plugins/gst-plugins-libav-1.14.4.3.4.5/temp/ffconf.d4fUZY3k/test.o -framework AppKit
x86_64-pc-linux-gnu-gcc: error: AppKit: No such file or directory
x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-framework'
"""


Do you have AppKit/AppKit.h in /usr/include (or /usr/local/include or somewhere else)?
Has a Gentoo package installed it?