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

Bug 474486

Summary: dev-libs/libgcrypt-1.5.2-r1: build fails with using clang-3.3 on x86-fbsd
Product: Gentoo/Alt Reporter: Yuta SATOH <nigoro.dev>
Component: FreeBSDAssignee: Gentoo/BSD Team <bsd+disabled>
Status: RESOLVED FIXED    
Severity: normal CC: k_f
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: FreeBSD   
URL: https://bugs.gnupg.org/gnupg/issue1974
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 417789    
Attachments: files/libgcrypt-1.5.2-fbsd-clang.patch

Description Yuta SATOH 2013-06-23 14:04:24 UTC
The following message is displayed and fails to compile.

libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi -I.. -I../src -I/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/src -O2 -march=i686 -pipe -fvisibility=hidden -Wall -c /var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/mpih-div.c  -fPIC -DPIC -o .libs/mpih-div.o
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/mpih-div.c:84:14: error: invalid use of a cast in a inline asm context requiring an l-value:
      remove the cast or build with -fheinous-gnu-extensions
                udiv_qrnnd(divisor_limb_inverted, dummy,
                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/longlong.h:463:23: note: expanded from macro 'udiv_qrnnd'
           : "=a" ((USItype)(q)),                                       \
                             ^
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/mpih-div.c:84:37: error: invalid use of a cast in a inline asm context requiring an l-value:
      remove the cast or build with -fheinous-gnu-extensions
                udiv_qrnnd(divisor_limb_inverted, dummy,
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/longlong.h:464:23: note: expanded from macro 'udiv_qrnnd'
             "=d" ((USItype)(r))                                        \
<snip>
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/mpi/longlong.h:449:23: note: expanded from macro 'sub_ddmmss'
           : "=r" ((USItype)(sh)),                                      \
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake[2]: *** [mpih-div.lo] Error 1
gmake[2]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2_build/mpi'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2_build'
gmake: *** [all] Error 2


and another issue)

libtool: compile:  clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1
/work/libgcrypt-1.5.2/cipher -I.. -I../src -I/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/w
ork/libgcrypt-1.5.2/src -O2 -pipe -fheinous-gnu-extensions -fvisibility=hidden -Wall -c /va
r/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/cipher/rijndael.c  -fPIC -DP
IC -o .libs/rijndael.o
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/cipher/rijndael.c:841:46:
 error:
      ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl',
      or 'cmpq')
                "movdqa 0xa0(%%esi), %%xmm1\n\t"
                                             ^
<inline asm>:24:2: note: instantiated into assembly here
        cmp $10, -24(%ebp)
        ^
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/cipher/rijndael.c:847:46:
 error:
      ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl',
      or 'cmpq')
                "movdqa 0xc0(%%esi), %%xmm1\n\t"
                                             ^
<inline asm>:30:2: note: instantiated into assembly here
        cmp $12, -24(%ebp)
        ^
<snip>
/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2/cipher/rijndael.c:858:39: error:
      ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl',
      or 'cmpq')
                "pxor %%xmm1, %%xmm0\n\t"        /* xmm0 = input ^ IV  */
                                      ^
<inline asm>:40:2: note: instantiated into assembly here
        cmp $1, -16(%ebp)
        ^
10 errors generated.
gmake[2]: *** [rijndael.lo] Error 1
gmake[2]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2_build/cipher'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/var/tmp/portage/dev-libs/libgcrypt-1.5.2-r1/work/libgcrypt-1.5.2_build'
gmake: *** [all] Error 2



Reproducible: Always

Steps to Reproduce:
1. CC=clang CXX="clang++ -stdlib=libc++" emerge dev-libs/libgcrypt
2.
3.
Comment 1 Yuta SATOH 2013-06-23 14:10:46 UTC
Created attachment 351740 [details, diff]
files/libgcrypt-1.5.2-fbsd-clang.patch

Taken from FreeBSD's ports

patch-cipher-rijndael.c
patch-mpi-longlong.h

http://svnweb.freebsd.org/ports/head/security/libgcrypt/files/
Comment 2 Kristian Fiskerstrand (RETIRED) gentoo-dev 2015-09-29 19:59:06 UTC
(In reply to Yuta SATOH from comment #1)
> Created attachment 351740 [details, diff] [details, diff]
> files/libgcrypt-1.5.2-fbsd-clang.patch
> 
> Taken from FreeBSD's ports
> 
> patch-cipher-rijndael.c
> patch-mpi-longlong.h
> 
> http://svnweb.freebsd.org/ports/head/security/libgcrypt/files/

Does this issue still persist with 1.6.4?
Comment 3 Yuta SATOH 2015-10-02 13:53:21 UTC
(In reply to Kristian Fiskerstrand from comment #2)
> (In reply to Yuta SATOH from comment #1)
> > Created attachment 351740 [details, diff] [details, diff] [details, diff]
> > files/libgcrypt-1.5.2-fbsd-clang.patch
> > 
> > Taken from FreeBSD's ports
> > 
> > patch-cipher-rijndael.c
> > patch-mpi-longlong.h
> > 
> > http://svnweb.freebsd.org/ports/head/security/libgcrypt/files/
> 
> Does this issue still persist with 1.6.4?

Thanks for your comment.
I had forgotten an update of this bug.

This bug has been fixed in the upstream (Fixed in 1.6.4).