From owner-freebsd-ppc@FreeBSD.ORG Sat Aug 24 13:20:02 2013 Return-Path: Delivered-To: freebsd-ppc@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E1064E70 for ; Sat, 24 Aug 2013 13:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BDBE22DFB for ; Sat, 24 Aug 2013 13:20:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r7ODK2Pe078057 for ; Sat, 24 Aug 2013 13:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r7ODK2Ip078056; Sat, 24 Aug 2013 13:20:02 GMT (envelope-from gnats) Resent-Date: Sat, 24 Aug 2013 13:20:02 GMT Resent-Message-Id: <201308241320.r7ODK2Ip078056@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ppc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Keve Nagy Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 411ECCF0 for ; Sat, 24 Aug 2013 13:15:17 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E3982DE4 for ; Sat, 24 Aug 2013 13:15:17 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7ODFD3j093188 for ; Sat, 24 Aug 2013 13:15:13 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7ODFDvN093186; Sat, 24 Aug 2013 13:15:13 GMT (envelope-from nobody) Message-Id: <201308241315.r7ODFDvN093186@oldred.freebsd.org> Date: Sat, 24 Aug 2013 13:15:13 GMT From: Keve Nagy To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: powerpc/181502: /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32 X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2013 13:20:02 -0000 >Number: 181502 >Category: powerpc >Synopsis: /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ppc >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 24 13:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Keve Nagy >Release: FreeBSD 9.2-RC1/powerpc >Organization: N/A >Environment: FreeBSD g4mini.homeoffice.internal 9.2-RC1 FreeBSD 9.2-RC1 #0 r253912: Sat Aug 3 18:51:06 UTC 2013 root@snap.freebsd.org:/usr/obj/powerpc.powerpc/usr/src/sys/GENERIC powerpc >Description: I thought you might want to know that icu-50.1.2 does not build on FreeBSD-9.2-RC1/powerpc. I believe this is a PowerPC ONLY issue, as the same code appears to build fine on i386 and amd64. I attempted to build x11/gnome2-lite from the ports, which failed building icu as a dependency. I tracked the origin of the problem back to /usr/include/stdint.h, line 68. #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) For reference, that line sits at the top of the block: /* GNU and Darwin define this and people seem to think it's portable */ #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #define __WORDSIZE 64 #else #define __WORDSIZE 32 #endif Compilation of icu stops with the error: /usr/include/stdint.h:68:68 error: missing binary operator before token "(" The particular source the compiler complains about looks perfectly correct. This is not a typo issue. I did some very basic testing to identify what is wrong. It looks that referring to the value of UINT64_MAX is what makes the compiler choke. At the time of compilation, both UINTPTR_MAX and UINT64_MAX appears to be in the "defined" state. A line of: #if defined(UINT64_MAX) or a line of: #ifndef UINT64_MAX does not trigger an error. Neither does reassigning the value of UINT64_MAX to another variable/macro, like: #define __KEVE UINT64_MAX However, testing against the value of UINT64_MAX #if (UINT64_MAX == 1) raises the above mentioned error. So does #if (UINT64_MAX != 2) and after assigning the value of UINT64_MAX to __KEVE as I showed above, testing against the value of __KEVE #if (__KEVE == 123) or #if (__KEVE != 6) also raises the same error. I believe that on i386 and amd64 the code compiles fine because that block of code is ignored, probably due to the fact of UINT64_MAX or UINTPTR_MAX not being defined, hence the evaluation stops before getting to the (UINTPTR_MAX == UINT64_MAX) portion at the end of the line. This is how deep my capabilities allowed me to go. Someone smarter needs to take this over to identify the real origin of the error and fix it. Until then, the workaround I used is to comment-out the troublesome block and simply define __WORDSIZE. In my particular case, as I was building on powerpc32 on a G4 Mac mini, I just added this line: #define __WORDSIZE 32 ***WORKAROUND*** /usr/include/stdint.h, lines 67-72 as comes with FreeBSD-9.2-RC2/powerpc: /* GNU and Darwin define this and people seem to think it's portable */ #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #define __WORDSIZE 64 #else #define __WORDSIZE 32 #endif /usr/include/stdint.h, lines 67-75 after workaround applied: /* GNU and Darwin define this and people seem to think it's portable */ /*** commented out as it does not build on powerpc G4 Mac mini *** #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #define __WORDSIZE 64 #else #define __WORDSIZE 32 #endif ***/ #define __WORDSIZE 32 *** For reference *** I was attempting to build x11/gnome2-lite on a G4 Mac mini with 512MB memory. >How-To-Repeat: Get a G4 Mac mini, iMac, iBook or PowerBook machine and try to build devel/icu from ports. cd /usr/ports/devel/icu make Should apply to everything else that tries to include /usr/include/stdint.h, but devel/icu is the only thing I came accross. >Fix: >Release-Note: >Audit-Trail: >Unformatted: