Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 608586

Summary: dev-lang/python-3.6 - blake2 module build failure due to mis-detection of CPU instructions
Product: Gentoo Linux Reporter: Oleh <moonlapse81>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: dschridde+gentoobugs, jason.mours, johannes.hirte, kkrizka, moonlapse81, n.andrew.walsh, n.sevchenco, nelo, oleg.hoefling, steven, vityokster
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugs.python.org/issue29504
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
remove nested comments in blake2s-load-xop.h

Description Oleh 2017-02-08 07:20:02 UTC
As in summary build failure with blake2 module with certain -march set:
System uname: Linux-4.9.6-1-ARCH-x86_64-AMD_FX-tm-9370_Eight-Core_Processor-with-gentoo-2.3
CFLAGS="-march=bdver2 -O2 -pipe"

when using moderate CFLAGS, build passed:
CFLAGS="-mtune=generic -O2 -pipe"


Reproducible: Always

Actual Results:  
lang/python-3.6.0/work/Python-3.6.0/Modules/_sqlite/microprotocols.o
In file included from [01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s-round.h:70:0[m[K,
                 from [01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:40[m[K,
                 from [01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/blake2s_impl.c:32[m[K:
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s-load-xop.h:29:4:[m[K [01;31m[Kerror: [m[Kexpected identifier or '[01m[K([m[K' before '[01m[Kreturn[m[K'
    return _mm_blendv_epi8(t0, s1, mask);
[01;32m[K    ^[m[K
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s-load-xop.h:30:1:[m[K [01;31m[Kerror: [m[Kexpected identifier or '[01m[K([m[K' before '[01m[K}[m[K' token
 }*/
[01;32m[K ^[m[K
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s-load-xop.h:30:3:[m[K [01;31m[Kerror: [m[Kexpected identifier or '[01m[K([m[K' before '[01m[K/[m[K' token
 }*/
[01;32m[K   ^[m[K
In file included from [01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/blake2s_impl.c:32:0[m[K:
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:[m[K In function '[01m[Kblake2s_init0[m[K':
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:167:38:[m[K [01;31m[Kerror: [m[K'[01m[Kblake2s_IV[m[K' undeclared (first use in this function)
   for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
[01;32m[K                                      ^[m[K
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:167:38:[m[K [01;36m[Knote: [m[Keach undeclared identifier is reported only once for each function it appears in
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:[m[K In function '[01m[KPyBlake2_blake2s_init_param[m[K':
[01m[K/var/tmp/portage/dev-lang/python-3.6.0/work/Python-3.6.0/Modules/_blake2/impl/blake2s.c:176:44:[m[K [01;31m[Kerror: [m[K'[01m[Kblake2s_IV[m[K' undeclared (first use in this function)
   const uint8_t * v = ( const uint8_t * )( blake2s_IV );
[01;32m[K                                            ^[m[K
Comment 1 Oleh 2017-02-08 07:20:30 UTC
Created attachment 462840 [details]
build.log
Comment 2 Mike Gilbert gentoo-dev 2017-02-08 17:30:19 UTC
Reported upstream.
Comment 3 Johannes Hirte 2017-02-27 07:53:06 UTC
Created attachment 465354 [details, diff]
remove nested comments in blake2s-load-xop.h

simple patch that removes the nested comments and make python-3.6.0 compile on my system with -march=bdver4
Comment 4 Alessandro 2017-03-04 11:09:19 UTC
here the same:
System: Linux-4.9.4 x86_64 AMD A8-7600 Radeon R7
CFLAGS="-march=native -mno-tbm -O2 -pipe"
gcc --version
gcc (Gentoo 5.4.0-r3 p1.3, pie-0.6.5) 5.4.0

and compile with the patch provided by johannes as well.
Comment 5 Mike Gilbert gentoo-dev 2017-03-04 19:39:44 UTC
*** Bug 611730 has been marked as a duplicate of this bug. ***
Comment 6 Neil Bothwick 2017-03-28 08:32:59 UTC
Same problem with python-3.6.1. The patch fixes it there too.
Comment 7 Mike Gilbert gentoo-dev 2017-05-31 20:56:29 UTC
*** Bug 620296 has been marked as a duplicate of this bug. ***
Comment 8 Dennis Schridde 2017-07-30 12:26:24 UTC
I confirm that the patch attached here as attachment #465354 [details, diff] works to get dev-lang/python-3.6.1 to compile. I would suggest to p-mask dev-lang/python:3.6 until this is resolved.
Comment 9 Mike Gilbert gentoo-dev 2017-07-30 15:11:57 UTC
(In reply to Dennis Schridde from comment #8)

A build failure that is easy to work around does not warrant an entry in package.mask.
Comment 10 Mike Gilbert gentoo-dev 2017-07-30 15:27:15 UTC
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61958b88555c08f099c70d0b1989b86bcd3f2465

commit 61958b88555c08f099c70d0b1989b86bcd3f2465
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Sun Jul 30 11:23:27 2017 -0400

    dev-lang/python: fix build failure in blake2 module
    
    Thanks to Johannes Hirte for the simple solution.
    
    Bug: https://bugs.gentoo.org/608586
    Package-Manager: Portage-2.3.6_p23, Repoman-2.3.3_p1

 dev-lang/python/files/3.6-blake2.patch | 37 ++++++++++++++++++++++++++++++++++
 dev-lang/python/python-3.6.1-r1.ebuild |  1 +
 2 files changed, 38 insertions(+)