Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 702554 - media-gfx/gimp-2.10.8-r1 - In file included from gimpoperationlayermode-composite-sse2.c:25: /usr/lib/gcc/i686-pc-linux-gnu/9.2.0/include/emmintrin.h:1432:1: error: inlining failed in call to always_inline ‘_mm_shuffle_epi32’: target specific option misma
Summary: media-gfx/gimp-2.10.8-r1 - In file included from gimpoperationlayermode-compo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Sergey Torokhov
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2019-12-11 16:22 UTC by Ted Marston
Modified: 2021-03-09 20:08 UTC (History)
2 users (show)

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


Attachments
failed emerge log.gz for gimp-2.10.8-r1 on Athlon i686 (with-sse-failed.gz,47.23 KB, application/gzip)
2019-12-11 16:26 UTC, Ted Marston
Details
emerge gimp --info (info.gimp,7.85 KB, text/plain)
2019-12-11 16:33 UTC, Ted Marston
Details
/proc/cpuinfo (file_702554.txt,756 bytes, text/plain)
2019-12-11 16:36 UTC, Ted Marston
Details
Output from gcc -march=native -Q --help=target, using gcc-9.2.0-r2 (baobabs-gcc-arch,9.84 KB, text/plain)
2019-12-12 17:14 UTC, Ted Marston
Details
/var/tmp/portage/media-gfx/gimp-2.10.8-r1/work/gimp-2.10.8/config.log (gimp-2.10.8-r1-short-cflags-config.log,199.15 KB, text/x-log)
2019-12-12 19:12 UTC, Ted Marston
Details
gimp-2.10.8-r1.ebuid (gimp-2.10.8-r1.ebuild,6.33 KB, text/plain)
2019-12-13 13:39 UTC, Sergey Torokhov
Details
result of ebuild /.../gimp-2.10.8-r1.ebuild configure, using new ebuild (gimp-new-config.log,199.15 KB, text/x-log)
2019-12-13 17:32 UTC, Ted Marston
Details
This is looking promising! (gimp-new-long-config.log,204.93 KB, text/x-log)
2019-12-13 19:02 UTC, Ted Marston
Details
Successful emerge log using new ebuild (gimp-new-ebuild.log.gz,276.85 KB, application/gzip)
2019-12-14 02:53 UTC, Ted Marston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ted Marston 2019-12-11 16:22:11 UTC
merge -atuvADU --unordered-display --changed-use world
fails to re-emerge media-gfx/gimp-2.10.8-r1 although it was successfully
emerged on 14th May 2019.

The error message states:
/usr/lib/gcc/i686-pc-linux-gnu/9.2.0/include/emmintrin.h:1432:1: error: inlining failed in call to always_inline _mm_shuffle_epi32: target specific option mismatch

I tried setting USE="-cpu_flags_x86_sse -cpu_flags_x86_sse2" for gimp to no avail, the failure was the same.
Comment 1 Ted Marston 2019-12-11 16:26:54 UTC
Created attachment 599132 [details]
failed emerge log.gz for gimp-2.10.8-r1 on Athlon i686
Comment 2 Ted Marston 2019-12-11 16:33:56 UTC
Created attachment 599134 [details]
emerge gimp --info

Note: CPU_FLAGS_X86="mmx sse", sse2 is not available on this cpu.
Comment 3 Ted Marston 2019-12-11 16:36:50 UTC
Created attachment 599136 [details]
/proc/cpuinfo
Comment 4 Sergey Torokhov 2019-12-11 21:11:15 UTC
> fails to re-emerge media-gfx/gimp-2.10.8-r1 although it was successfully
emerged on 14th May 2019.

Does it mean before update to gcc-9.2.0-r2  you used gcc-8.3.0-r1? 

Could you check if gimp-2.10.8-r1 is compiled or not after you switch back to gcc-8.3.0-r1 if it was that gcc version this time?
Comment 5 Ted Marston 2019-12-11 22:20:30 UTC
According to my backups, I had gcc-7.3.0-r3 and gcc-8.3.0-r1 available on 14th May 2019. I think I used gcc-8.3.0-r1. I only have gcc-9.2.0-r2 available now.

I have just re-emerged gimp-2.10.8-r1 with CFLAGS set to "-march=native -O2 -pipe" instead
of "-march=native -mno-aes -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-avx -O2 -pipe". which I had set to help with emerging qt5 apps such as qtgui.

This built but the build log shows that it was assuming my processor had SSE2 and SSE4.1.

checking whether i686-pc-linux-gnu-gcc understands -mfpmath=sse... yes
checking whether i686-pc-linux-gnu-gcc understands -msse2... yes
checking whether we can compile SSE2 intrinsics... yes
checking whether i686-pc-linux-gnu-gcc understands -msse4.1... yes
checking whether we can compile SSE4.1 intrinsics... yes
checking whether i686-pc-linux-gnu-gcc understands -mmmx... yes
checking whether we can compile MMX code... yes
checking whether i686-pc-linux-gnu-gcc understands -msse... yes
checking whether we can compile SSE code... yes

Doesn't this mean I will have bad opcodes in my build?
Comment 6 Sergey Torokhov 2019-12-12 12:06:47 UTC
I suspect that gcc-9 and gcc-8 (it also fail to compile gimp if I set -mno-sse or -mno-sse4.1) assume that your -march=native supports sse2 or/and sse4.1.

Could you provide the output of command:

> gcc -match=native -Q --help=target
and also the file 
> /var/tmp/gimp-2.10.8-r1/work/2.8.10/config.log
Also if your CPU is Athlon XP please try compile gimp for -march=athlon-xp.
Maybe it resolve the problem too.

As other solution: it seems the problem could be resolved by the moving substring $intrinsics_save_CFLAGS to position after $SSE2_EXTRA_FLAGS or $SSE4_1_EXTRA_FLAGS in strings 1116, 1131 of configure.ac file. Sorry I can provide patched ebuild later.
Comment 7 Ted Marston 2019-12-12 17:14:13 UTC
Created attachment 599258 [details]
Output from gcc -march=native -Q --help=target, using gcc-9.2.0-r2
Comment 8 Sergey Torokhov 2019-12-12 17:39:22 UTC
Thank you.

It seems that test for sse2 is successfully passed for you cpu just because "-msse2" is passed after defined by you option "-mno-sse2"

AC_MSG_CHECKING(whether we can compile SSE2 intrinsics)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <emmintrin.h>]],[[__m128i one = _mm_set1_epi32 (1);]])],
  AC_DEFINE(COMPILE_SSE2_INTRINISICS, 1, [Define to 1 if SSE2 intrinsics are available.])
  AC_SUBST(SSE2_EXTRA_CFLAGS)
  AC_MSG_RESULT(yes)
,
  AC_MSG_RESULT(no)
  AC_MSG_WARN([SSE2 intrinsics not available.])
)

while actually cpu doesn't support sse2.

The full output results of such test is in
var/tmp/gimp-2.10.8-r1/work/2.8.10/config.log

Could you provide it please?
Comment 9 Ted Marston 2019-12-12 19:12:52 UTC
Created attachment 599262 [details]
/var/tmp/portage/media-gfx/gimp-2.10.8-r1/work/gimp-2.10.8/config.log

This was generated using gcc-9.2.0-r2 and CFLAGS="-march=native -O2 -pipe". 
Adding "-mno-sse2" etc. to CFLAGS made no significant difference.
Comment 10 Sergey Torokhov 2019-12-13 03:21:31 UTC
> This was generated using gcc-9.2.0-r2 and CFLAGS="-march=native -O2 -pipe". 
Adding "-mno-sse2" etc. to CFLAGS made no significant difference.

Yes, it's because configure.ac insert -msse2 after system defined CFLAGS. It could be workarounded for your case of -mno-sse2 as I describe above (swap variables inside reassigned CFLAGS but it doesn't resolve problem if CPU doesn't support sse2 and sse4.1 feature of there isn't -mno-sse etc. The see2 feature test in your case seems to be passed because test variable "one" isn't used and droped while optimization by compiller. To resolve issue I shall try to add "volatile" at begining of initialization to prevent optimization this place.
Comment 11 Sergey Torokhov 2019-12-13 13:39:05 UTC
Created attachment 599340 [details]
gimp-2.10.8-r1.ebuid

I currently have no idea why on Athlon 4 (xp, mp) sse2 test successfully passed after addition of -msse2 to CFLAGS.

Could you try build gimp with attached 
"gimp-2.8.10-r1.ebuild"? It should result in failure of sse2 configuration test if system env CFLAGS contains -mno-sse2.
Comment 12 Ted Marston 2019-12-13 16:57:33 UTC
I tried your modified ebuild,
 with CFLAGS="-march=native -O2 -pipe" in /etc/portage/make.conf,
 and ran ebuild /.../gimp-2.10.8-r1.ebuild configure

The CFLAGS were re-ordered in the configure tests for SSE2 and SSE4.1,
 but otherwise it made no difference. The configure tests still "passed".

I haven't tried to change configure.ac, I am struggling to understand 
its language.
Comment 13 Ted Marston 2019-12-13 17:32:33 UTC
Created attachment 599354 [details]
result of ebuild /.../gimp-2.10.8-r1.ebuild configure, using new ebuild
Comment 14 Sergey Torokhov 2019-12-13 17:55:42 UTC
(In reply to Ted Marston from comment #12)
> I tried your modified ebuild,
>  with CFLAGS="-march=native -O2 -pipe" in /etc/portage/make.conf,
>  and ran ebuild /.../gimp-2.10.8-r1.ebuild configure
> 
> The CFLAGS were re-ordered in the configure tests for SSE2 and SSE4.1,
>  but otherwise it made no difference. The configure tests still "passed".
> 
> I haven't tried to change configure.ac, I am struggling to understand 
> its language.

Could you return at least with -mno-sse2 and -mno-sse4.1 flags?
Comment 15 Ted Marston 2019-12-13 19:02:51 UTC
Created attachment 599460 [details]
This is looking promising!
Comment 16 Ted Marston 2019-12-13 19:07:53 UTC
I will let the emerge continue with CFLAGS="-march=native -mno-sse2 -mno-sse4.1" in /etc/portage/make.conf, using your new ebuild. It will take nearly 2hrs. :(
Comment 17 Sergey Torokhov 2019-12-13 19:52:03 UTC
What was the usual merge time? 

Please try initial value of CFLAGS (it's in your attached file emerge --info):
CFLAGS="-march=native -mno-aes -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-avx -O2 -pipe"

"-pipe" could speedup compilation but requires more memory. Especially it useful with slow hdd.

I have hardware "amd athlon xp 1800+" but it's currently far away from me. So I dont know when I reach it.
Comment 18 Sergey Torokhov 2019-12-13 20:00:06 UTC
(In reply to Ted Marston from comment #16)
> I will let the emerge continue with CFLAGS="-march=native -mno-sse2
> -mno-sse4.1" in /etc/portage/make.conf, using your new ebuild. It will take
> nearly 2hrs. :(

By the way, your initially attached "emerge gimp --info" said that gimp previously was built with CFLAGS="-march=native -O2 -pipe" while common system CFLAGS differs from this value. Maybe with this personal options it will compile again even if sse2 and sse4.1 test passes.
Comment 19 Ted Marston 2019-12-14 02:33:53 UTC
Yes! Thankyou Sergey Torokhov. Your modified ebuild in comment #11 has fixed it.
Sorry for my delay, social life distracted me. (priorities ;-) )

I have now successfully built gimp-2.10.8-r1 with
CFLAGS="-march=native -mno-aes -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-avx -O2 -pipe"

It took 1 hour, 37 minutes and 59 seconds. Yes, its a slow machine. :(

The emerge log showed
checking whether i686-pc-linux-gnu-gcc understands -mfpmath=sse... yes
checking whether i686-pc-linux-gnu-gcc understands -msse2... yes
checking whether we can compile SSE2 intrinsics... no
configure: WARNING: SSE2 intrinsics not available.
checking whether i686-pc-linux-gnu-gcc understands -msse4.1... yes
checking whether we can compile SSE4.1 intrinsics... no
configure: WARNING: SSE4.1 intrinsics not available.
checking whether i686-pc-linux-gnu-gcc understands -mmmx... yes
checking whether we can compile MMX code... yes
checking whether i686-pc-linux-gnu-gcc understands -msse... yes
checking whether we can compile SSE code... yes

That looks good to me!

> By the way, your initially attached "emerge gimp --info" said that gimp
> previously was built with CFLAGS="-march=native -O2 -pipe" while common 
> system CFLAGS differs from this value.

That's FCFLAGS not CFLAGS.

Thankyou so much for fixing this.:)
Comment 20 Ted Marston 2019-12-14 02:53:41 UTC
Created attachment 599470 [details]
Successful emerge log using new ebuild
Comment 21 Sergey Torokhov 2019-12-14 05:40:20 UTC
> 
> > By the way, your initially attached "emerge gimp --info" said that gimp
> > previously was built with CFLAGS="-march=native -O2 -pipe" while common 
> > system CFLAGS differs from this value.
> 
> That's FCFLAGS not CFLAGS.


I mean the last section of "emerge gimp --info" file where 

media-gfx/gimp-2.10.8-r1::gentoo was built with the following:
USE="alsa jpeg2k mng postscript python udev wmf xpm -aalib (-altivec) (-aqua) -debug -doc -gnome -heif -openexr -test -unwind -vector-icons -webp" CPU_FLAGS_X86="mmx sse" PYTHON_TARGETS="python2_7"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="-march=native -O2 -pipe"

Maybe if it's pass the configuration test then it also successfully compile (don't know how if it's really athlon xp cpu series)?
Comment 22 Ted Marston 2019-12-14 13:21:35 UTC
I am sorry, you are right, I think the "emerge gimp --info" must have been for the installation of gimp on 14th May 2019, I cannot reproduce it now. According to my build log on 14th May, the tests did not work, the file gimpoperationlayermode-composite-sse2.c was compiled, and there was no error message. I added the extra CFLAGS="-no-sse2" etc after that, when I had problems building qt5 software.

I use gimp when printing out photographs, but cannot remember using it since then, so I do not know whether it actually worked.
Comment 23 Sergey Torokhov 2019-12-14 14:04:37 UTC
https://gitlab.gnome.org/GNOME/gimp/issues/4363
Comment 24 Larry the Git Cow gentoo-dev 2020-01-07 06:20:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9813ac11df007d7bc9f8b09ef667d02d5c52fdd

commit c9813ac11df007d7bc9f8b09ef667d02d5c52fdd
Author:     Sergey Torokhov <torokhov-s-a@yandex.ru>
AuthorDate: 2019-12-15 22:38:29 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2020-01-07 06:20:00 +0000

    media-gfx/gimp: Fix suppressing system CFLAGS on configuration tests
    
    During configuration tests CPU support of SSE2 and SSE4.1 in configure.ac file
    the system env variable CFLAGS parameters are suppressed by addition of -msse2
    and -msse4.1 that results in the GIMP will be compiled with their support
    but the compilation will fail if system CFLAGS has SSE2 and SSE4.1 disabled
    (i.e. -mno-sse2 and -mno-sse4.1 is used).
    
    Closes: https://bugs.gentoo.org/702554
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
    Closes: https://github.com/gentoo/gentoo/pull/13992
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 media-gfx/gimp/gimp-2.10.10-r1.ebuild | 6 +++++-
 media-gfx/gimp/gimp-2.10.12.ebuild    | 6 +++++-
 media-gfx/gimp/gimp-2.10.14.ebuild    | 6 +++++-
 media-gfx/gimp/gimp-2.9.8-r1.ebuild   | 8 +++++++-
 4 files changed, 22 insertions(+), 4 deletions(-)