Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 585776 - =media-libs/opus-1.1.2[cpu_flags_x86_sse] - automagic optimizations for sse2, sse4.1, avx
Summary: =media-libs/opus-1.1.2[cpu_flags_x86_sse] - automagic optimizations for sse2,...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Sound Team
Depends on:
Reported: 2016-06-13 05:24 UTC by Patrick McMunn
Modified: 2016-06-15 15:51 UTC (History)
1 user (show)

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

build.log (build.log,230.10 KB, text/x-log)
2016-06-14 22:50 UTC, Patrick McMunn
emerge --info opus (emerge-info.txt,16.67 KB, text/plain)
2016-06-14 22:53 UTC, Patrick McMunn

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McMunn 2016-06-13 05:24:14 UTC
I was trying to build the opus library with the sse USE flag enabled on a non-sse2 system, and the build failed. I disabled the sse USE flag, and the build succeeded. Apparently the opus library makes use of at least sse2 when sse is enabled. Therefore the sse USE flag ought to be changed to sse2. Otherwise it will lead to build failures on non-sse2 systems which likely have the sse USE flag enabled globally.

i686-pc-linux-gnu-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2  -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/include -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/silk -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/silk/float -I/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/silk/fixed    -march=athlon-xp -O2 -mno-sse2 -pipe -fvisibility=hidden -W -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes  -c -o celt/tests/test_unit_mathops.o /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/tests/test_unit_mathops.c
In file included from /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/tests/test_unit_mathops.c:48:0:
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/vq.c: In function ‘renormalise_vector’:
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/vq.c:359:4: warning: implicit declaration of function ‘celt_inner_prod_sse’ [-Wimplicit-function-declaration]
    E = EPSILON + celt_inner_prod(X, X, N, arch);
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/vq.c:359:4: warning: nested extern declaration of ‘celt_inner_prod_sse’ [-Wnested-externs]
In file included from /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/tests/test_unit_mathops.c:56:0:
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/x86/pitch_sse.c: At top level:
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/x86/pitch_sse.c:108:12: error: conflicting types for ‘celt_inner_prod_sse’
 opus_val32 celt_inner_prod_sse(const opus_val16 *x, const opus_val16 *y,
In file included from /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/pitch.h:42:0,
                 from /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/bands.c:44,
                 from /var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/tests/test_unit_mathops.c:45:
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/x86/pitch_sse.h:115:15: note: previous implicit declaration of ‘celt_inner_prod_sse’ was here
  ((void)arch, celt_inner_prod_sse(x, y, N))
/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2/celt/vq.c:359:18: note: in expansion of macro ‘celt_inner_prod’
    E = EPSILON + celt_inner_prod(X, X, N, arch);
Makefile:2242: recipe for target 'celt/tests/test_unit_mathops.o' failed
make[2]: *** [celt/tests/test_unit_mathops.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2-abi_x86_32.x86'
Makefile:2350: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-libs/opus-1.1.2/work/opus-1.1.2-abi_x86_32.x86'
Makefile:1382: recipe for target 'all' failed
make: *** [all] Error 2
Comment 1 Coacher 2016-06-13 13:11:36 UTC
Please attach complete build.log and the output of `emerge --info'.
Comment 2 Patrick McMunn 2016-06-14 22:50:38 UTC
Created attachment 437586 [details]

I tried compiling opus both with and without LTO enabled, and I tried using GCC 4.9.3, 5.3.0, and 6.1.0. All failed as long as the sse USE flag was enabled. When I successfully compiled it without the sse USE flag enabled, I was using GCC 6.1.0 and had LTO enabled, so compiler version and flags used appear to not be affecting success or failure of compilation. This failed build log is using GCC 6.1.0 and without LTO -- just basic compiler flags.
Comment 3 Patrick McMunn 2016-06-14 22:53:10 UTC
Created attachment 437588 [details]
emerge --info opus
Comment 4 Patrick McMunn 2016-06-14 23:38:03 UTC
I took some time to look more closely at the ebuild and Opus' build system and try a few things. Apparently Opus utilizes runtime CPU detection, and when configure is passed --enable-intrinsics, it enables optimizations for sse, sse2, sse4.1, and avx whether the CPU actually supports them or not. So I removed the -mno-sse2 compiler flag (which I had been using because of an issue with QT5), and Opus compiled even with the sse USE flag enabled. So, unless there is any reason to implement a filter-flags option in the ebuild (which may be more trouble than it's worth considering how unlikely it is for anyone to run into this issue), it doesn't appear that there is any need to pursue this issue further.
Comment 5 Coacher 2016-06-15 15:51:40 UTC
Sorry, misclicked on status.