This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Wrong powerpc define in Python/ceval.c
Type: Stage: resolved
Components: Build Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: dmalcolm Nosy List: adrian, dmalcolm, pitrou
Priority: normal Keywords:

Created on 2010-12-08 21:50 by adrian, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)
msg123652 - (view) Author: Adrian Reber (adrian) Date: 2010-12-08 21:50
In Python/ceval.c is following line:

#if defined(__ppc__) /* <- Don't know if this is the correct symbol; this
                           section should work for GCC on any PowerPC
                           platform, irrespective of OS.
                           POWER?  Who knows :-) */

which seems wrong and aborts the build on powerpc. Changing it to __powerpc__ fixes it for me.

The following output of gcc confirms it:

$ gcc -dM -E -x c /tmp/foo.c  | grep powerpc
#define __powerpc__ 1
#define __powerpc 1
#define powerpc 1

Whereas there are no defines containing "ppc"
msg123653 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-08 21:57
How about accepting either of these symbols? Do you want to provide a patch?
msg123656 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-12-08 22:13
What version of the compiler was this with?

(For reference, I see that you also filed this downstream in Fedora's bug tracker as:
 https://bugzilla.redhat.com/show_bug.cgi?id=661510 )
msg123660 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-12-08 23:06
One of RH's gcc gurus told me in IRC that:
  __ppc__ is not a standard powerpc*-linux macro
  __PPC__ or __powerpc__ is
msg123661 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-08 23:23
Le mercredi 08 décembre 2010 à 23:06 +0000, Dave Malcolm a écrit :
> Dave Malcolm <dmalcolm@redhat.com> added the comment:
> 
> One of RH's gcc gurus told me in IRC that:
>   __ppc__ is not a standard powerpc*-linux macro
>   __PPC__ or __powerpc__ is

Keep in mind that we have currently working PPC buildbots (under OS X).
msg123679 - (view) Author: Adrian Reber (adrian) Date: 2010-12-09 12:48
Here is a patch that I had to include in my Linux PowerPC build of 2.7 and 3.2

--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -31,10 +31,12 @@
 
 typedef unsigned long long uint64;
 
-#if defined(__ppc__) /* <- Don't know if this is the correct symbol; this
+#if defined(__ppc__) || defined (__powerpc__) /* <- Don't know if 
+                           this is the correct symbol; this
                            section should work for GCC on any PowerPC
                            platform, irrespective of OS.
-                           POWER?  Who knows :-) */
+                           POWER?  Who knows :-) 
+                           __powerpc__ is necessary for Linux */
 
 #define READ_TIMESTAMP(var) ppc_getcounter(&var)
msg125479 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2011-01-05 23:40
FWIW, I just added this patch downstream to Fedora's python 3 builds:
http://pkgs.fedoraproject.org/gitweb/?p=python3.git;a=blob_plain;f=python-3.2b2-fix-ppc-debug-build.patch;hb=5659c63442be2e91eb42e60284d7a9a9ab0b80dd
msg125480 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-01-05 23:41
> FWIW, I just added this patch downstream to Fedora's python 3 builds:
> http://pkgs.fedoraproject.org/gitweb/?p=python3.git;a=blob_plain;f=python-3.2b2-fix-ppc-debug-build.patch;hb=5659c63442be2e91eb42e60284d7a9a9ab0b80dd

Any reason not to commit it here?
msg125565 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-01-06 16:49
Issue5369 is a duplicate with the same patch. Dave, can you apply?
msg125567 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2011-01-06 17:04
Adrian verified in the downstream bug tracker that this fixed the build for him (and the logs show it successfully ran the test suite), so I committed my patch to py3k as r87796.
msg125572 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2011-01-06 17:39
Merged back to 3.1 as r87800 and to 2.7-maint as r87801
History
Date User Action Args
2022-04-11 14:57:10adminsetgithub: 54864
2011-01-06 17:39:58dmalcolmsetstatus: open -> closed
nosy: pitrou, dmalcolm, adrian
messages: + msg125572

resolution: fixed
stage: resolved
2011-01-06 17:04:09dmalcolmsetnosy: pitrou, dmalcolm, adrian
messages: + msg125567
2011-01-06 16:49:23pitrousetassignee: dmalcolm
messages: + msg125565
nosy: pitrou, dmalcolm, adrian
2011-01-06 16:48:34pitroulinkissue5369 superseder
2011-01-05 23:41:22pitrousetnosy: pitrou, dmalcolm, adrian
messages: + msg125480
2011-01-05 23:40:25dmalcolmsetnosy: pitrou, dmalcolm, adrian
messages: + msg125479
2010-12-09 12:48:33adriansetmessages: + msg123679
2010-12-08 23:23:54pitrousetmessages: + msg123661
2010-12-08 23:06:55dmalcolmsetmessages: + msg123660
2010-12-08 22:13:22dmalcolmsetnosy: + dmalcolm
messages: + msg123656
2010-12-08 21:57:41pitrousetnosy: + pitrou

messages: + msg123653
versions: + Python 2.7, Python 3.2
2010-12-08 21:50:25adriancreate