Bug 785750

Summary: llvm-3.0 fails to build on PPC (32bit)
Product: [Fedora] Fedora Reporter: Karsten Hopp <karsten>
Component: llvmAssignee: Michel Lind <michel>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: rawhideCC: bos, dmalcolm, jakub, michel
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-23 16:36:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karsten Hopp 2012-01-30 14:33:57 UTC
Description of problem:
llvm fails to build on PPC with some header errors:
llvm[3]: Compiling PPCAsmPrinter.cpp for Release build
In file included from MCTargetDesc/PPCMCTargetDesc.h:41:0,
                 from MCTargetDesc/PPCBaseInfo.h:20,
                 from PPC.h:18,
                 from PPCAsmPrinter.cpp:20:
/builddir/build/BUILD/llvm-3.0.src/lib/Target/PowerPC/PPCGenRegisterInfo.inc:17:11: error: expected identifier before numeric constant
/builddir/build/BUILD/llvm-3.0.src/lib/Target/PowerPC/PPCGenRegisterInfo.inc:17:11: error: expected unqualified-id before numeric constant
In file included from /usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/new:42:0,
                 from /usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/ext/new_allocator.h:34,
                 from /usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/ppc64-redhat-linux/bits/c++allocator.h:34,
                 from /usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/allocator.h:48,
                 from /usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/string:43,
                 from /builddir/build/BUILD/llvm-3.0.src/include/llvm/ADT/StringRef.h:16,
                 from /builddir/build/BUILD/llvm-3.0.src/include/llvm/Support/ErrorHandling.h:19,
                 from MCTargetDesc/PPCBaseInfo.h:21,
                 from PPC.h:18,
                 from PPCAsmPrinter.cpp:20:
/usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/exception:37:37: error: expected '}' before end of line
/usr/lib/gcc/ppc64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/exception:37:37: error: expected declaration before end of line
make[3]: *** [/builddir/build/BUILD/llvm-3.0.src/lib/Target/PowerPC/Release/PPCAsmPrinter.o] Error 1



I'm not sure if this a gcc bug or llvm's fault, added the gcc maintainer for comments.
PPC64 builds fine, btw,

Version-Release number of selected component (if applicable):
llvm-3.0-1.fc17
gcc-4.7.0-0.10.fc17.ppc


Steps to Reproduce:
1. ppc-koji build --scratch --arch-override=ppc llvm-3.0-1.fc17.src.rpm
  
Actual results:
http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=364100


Additional info:
marked as 'urgent' as this is blocking >150 packages from being rebuilt for the F17-mass rebuild,

Comment 1 Michel Lind 2012-02-02 01:40:54 UTC
I can't rebuild LLVM on x86_64 either, ever since gcc 4.7 landed -- Jakub reported this back in December:

  https://lists.fedoraproject.org/pipermail/devel/2011-December/160723.html

Jakub, any idea? A bit worrying that the error messages are different in both cases.

In file included from Allocator.cpp:14:
In file included from /home/michel/rpmbuild/BUILD/llvm-3.0.src/include/llvm/Support/Allocator.h:18:
In file included from /home/michel/rpmbuild/BUILD/llvm-3.0.src/include/llvm/Support/MathExtras.h:17:
In file included from /home/michel/rpmbuild/BUILD/llvm-3.0.src/include/llvm/Support/SwapByteOrder.h:20:
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/limits:1404:27: error: use of undeclared identifier '__int128'; did you mean '__int128_t'?
    struct numeric_limits<__int128>
                          ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/limits:1478:36: error: expected '>'
    struct numeric_limits<unsigned __int128>

                                   ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/limits:1478:5: error: cannot combine with previous '(error)' declaration specifier
    struct numeric_limits<unsigned __int128>
    ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/limits:1478:44: error: expected unqualified-id
    struct numeric_limits<unsigned __int128>
                                           ^
4 errors generated.
make[1]: *** [/home/michel/rpmbuild/BUILD/llvm-3.0.src/lib/Support/Release/Allocator.o] Error 1
make[1]: *** Waiting for unfinished jobs....

Comment 2 Karsten Hopp 2012-02-02 17:23:17 UTC
The PPC failure seems to be caused by the preprocessor which replaces PPC with a '1' so that we end up with something like this:

class MCRegisterClass;
extern MCRegisterClass PPCMCRegisterClasses[];

namespace 1 {
enum {
  NoRegister,
  CARRY = 1,
.........


instead of


class MCRegisterClass;
extern MCRegisterClass PPCMCRegisterClasses[];

namespace PPC {
enum {
  NoRegister,
  CARRY = 1,
.........

Comment 3 Karsten Hopp 2012-04-23 16:36:20 UTC

*** This bug has been marked as a duplicate of bug 769803 ***