Bug 181502 - /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32
Summary: /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: powerpc (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ppc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-24 14:20 UTC by Keve Nagy
Modified: 2017-10-12 19:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keve Nagy 2013-08-24 14:20:00 UTC
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.
Comment 1 white.heron 2013-08-24 23:30:54 UTC
--633453505-313681463-1377383454=:46947
Content-Type: text/plain; charset=us-ascii

Hye. I am having problem to read iphone 5 64gb storage via lightning cable to PowerBook g4 ubuntu oneiric .. Any advice ? The iPhone 5 run on top of arm processor while PowerBook g4 run PowerPC processor.<br/><br/><br/><br/>my.linkedin.com/pub/yb-tan-sri-dato-ir-adli-a-k-a-dell/44/64b/464/<br/>Sent from Yahoo! Mail for iPhone
--633453505-313681463-1377383454=:46947
Content-Type: text/html; charset=us-ascii

<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">Hye. I am having problem to read iphone 5 64gb storage via lightning cable to PowerBook g4 ubuntu oneiric .. Any advice ? The iPhone 5 run on top of arm processor while PowerBook g4 run PowerPC processor.<br/><br/><br/><br/>my.linkedin.com/pub/yb-tan-sri-dato-ir-adli-a-k-a-dell/44/64b/464/<br/>Sent from Yahoo! Mail for iPhone</td></tr></table>            <div id="_origMsg_">
                <div>
                    <br />
                    <div>
                        <div style="font-size:0.9em">
                            <hr size="1">
                            <b>
                                <span style="font-weight:bold">From:</span>
                            </b>
                            Keve Nagy &lt;keve@safe-mail.net&gt;;                            <br>
                            <b>
                                <span style="font-weight:bold">To:</span>
                            </b>
                             &lt;freebsd-gnats-submit@FreeBSD.org&gt;;                                                                                                     <br>
                            <b>
                                <span style="font-weight:bold">Subject:</span>
                            </b>
                            powerpc/181502: /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32                            <br>
                            <b>
                                <span style="font-weight:bold">Sent:</span>
                            </b>
                            Sat, Aug 24, 2013 1:15:13 PM                            <br>
                        </div>
                            <br>
                            <table cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr>
                                        <td valign="top"><BR>&gt;Number:&nbsp; &nbsp; &nbsp; &nbsp;  181502<BR>&gt;Category:&nbsp; &nbsp; &nbsp;  powerpc<BR>&gt;Synopsis:&nbsp; &nbsp; &nbsp;  /usr/include/stdint.h 9.2-RC1/powerpc does not compile on powerpc32<BR>&gt;Confidential:&nbsp;  no<BR>&gt;Severity:&nbsp; &nbsp; &nbsp;  non-critical<BR>&gt;Priority:&nbsp; &nbsp; &nbsp;  low<BR>&gt;Responsible:&nbsp; &nbsp; freebsd-ppc<BR>&gt;State:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; open<BR>&gt;Quarter:&nbsp; &nbsp;  &nbsp; &nbsp; <BR>&gt;Keywords:&nbsp; &nbsp; &nbsp;  <BR>&gt;Date-Required:<BR>&gt;Class:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw-bug<BR>&gt;Submitter-Id:&nbsp;  current-users<BR>&gt;Arrival-Date:&nbsp;  Sat Aug 24 13:20:00 UTC 2013<BR>&gt;Closed-Date:<BR>&gt;Last-Modified:<BR>&gt;Originator:&nbsp; &nbsp;  Keve Nagy<BR>&gt;Release:&nbsp; &nbsp; &nbsp; &nbsp; FreeBSD 9.2-RC1/powerpc<BR>&gt;Organization:<BR>N/A<BR>&gt;Environment:<BR>FreeBSD
 g4mini.homeoffice.internal 9.2-RC1 FreeBSD 9.2-RC1 #0 r253912: Sat Aug&nbsp; 3 18:51:06 UTC 2013&nbsp; &nbsp;  <a ymailto="mailto:root@snap.freebsd.org" href="javascript:return">root@snap.freebsd.org</a>:/usr/obj/powerpc.powerpc/usr/src/sys/GENERIC&nbsp; powerpc<BR>&gt;Description:<BR>I thought you might want to know that icu-50.1.2 does not build on FreeBSD-9.2-RC1/powerpc.<BR>I believe this is a PowerPC ONLY issue, as the same code appears to build fine on i386 and amd64.<BR>I attempted to build x11/gno me2-lite from the ports, which failed building icu as a dependency.<BR><BR>I tracked the origin of the problem back to /usr/include/stdint.h, line 68.<BR>#if defined(UINTPTR_MAX) &amp;&amp; defined(UINT64_MAX) &amp;&amp; (UINTPTR_MAX == UINT64_MAX)<BR><BR>For reference, that line sits at the top of the block:<BR>/* GNU and Darwin define this and people seem to think it's portable */<BR>#if defined(UINTPTR_MAX) &amp;&amp; defined(UINT64_MAX) &amp;&amp;
 (UINTPTR_MAX == UINT64_MAX)<BR>#define __WORDSIZE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 64<BR>#else<BR>#define __WORDSIZE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 32<BR>#endif<BR><BR>Compilation of icu stops with the error:<BR>/usr/include/stdint.h:68:68 error: missing binary operator before token "("<BR><BR>The particular source the compiler complains about looks perfectly correct. This is not a typo issue.<BR>I did some very basic testing to identify what is wrong.<BR>It looks that refe rring to the value of UINT64_MAX is what makes the compiler choke.<BR>At the time of compilation, both UINTPTR_MAX and UINT64_MAX appears to be in the "defined" state.<BR><BR>A line of:<BR>#if defined(UINT64_MAX)<BR>or a line of:<BR>#ifndef UINT64_MAX<BR>does not trigger an error.<BR>Neither does reassigning the value of UINT64_MAX to another variable/macro, like:<BR>#define __KEVE&nbsp; UINT64_MAX<BR><BR>However, testing against the value of
 UINT64_MAX<BR>#if (UINT64_MAX == 1)<BR> raises the above mentioned error.<BR>So does<BR>#if (UINT64_MAX != 2)<BR>and after assigning the value of UINT64_MAX to __KEVE as I showed above, testing against the value of __KEVE<BR>#if (__KEVE == 123)<BR>&nbsp; or<BR>#if (__KEVE != 6)<BR>also raises the same error.<BR><BR>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 stop s before getting to the (UINTPTR_MAX == UINT64_MAX) portion at the end of the line.<BR><BR>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.<BR>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:<BR>#define
 __WORDSIZE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 32<BR><BR><BR>***WORKAROUND***<BR><BR>/usr/include/stdint.h, lines 67-72 as comes with FreeBSD-9.2-RC2/powerpc:<BR><BR>/* GNU and Darwin define this and people seem to think it's portable */<BR
Comment 2 white.heron 2013-08-24 23:33:52 UTC
Hye. I am having problem to read iphone 5 64gb storage via lightning cable to PowerBook g4 ubuntu oneiric .. Any advice ? The iPhone 5 run on top of arm processor while PowerBook g4 run PowerPC processor.<br/><br/><br/><br/>my.linkedin.com/pub/yb-tan-sri-dato-ir-adli-a-k-a-dell/44/64b/464/<br/>Sent from Yahoo! Mail for iPhone
Comment 3 Andreas Tobler freebsd_committer freebsd_triage 2014-06-05 20:25:34 UTC
Should be fixed with:

http://svnweb.freebsd.org/base?view=revision&revision=259617
Comment 4 Justin Hibbits freebsd_committer freebsd_triage 2017-10-12 19:03:36 UTC
No new updates in 3 years, so closing as fixed by Andreas.