Opened 13 years ago

Last modified 8 years ago

#31310 new defect

py-numpy: +atlas +gcc44 +universal fixes, tested with py27-numpy 1.6.1_0 on ppc/ppc64

Reported by: ccorn@… Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: haspatch Cc: Veence (Vincent), ob+macport@…, petrrr
Port: py-numpy

Description

Platform: PowerMac G5 running MacOS X 10.5.8 (powerpc-apple-darwin9.8.0)

universal_archs = ppc64 ppc

Portfile: python/py-numpy (-r83853)

Problem: I have successfully built atlas +gcc44 +universal. The subsequent build of py27-numpy +atlas +gcc44 +universal succeeded, but in arch -ppc64 python2.7, import numpy failed. Reason: multiarray.so had been built for architecture ppc only.

Cause: Python's installation procedure rebuilds in the destroot phase, therefore all essential configuration settings in the environment must be reproduced then. The Portfile has done so in most places, but missed one branch conditioned for universal builds, and even got the condition slightly wrong.

Proposed solution: The patch attached as Portfile.required.diff is definitely required to fix this. "Fixing" means that I can run arch -ppc64 python2.7 as well as arch -ppc python2.7 and in both cases successfully import numpy.

Further issues, fortunately uncritical: While working on the Portfile, I found the expression variant universal used instead of if {[variant_isset universal]} . I am not sure whether these two are the same, but it seems that the latter is meant. Therefore I have changed that. See the patch attached as Portfile.stylistic.diff.

I also took a look at files/wrapper-template and found that it has some errors and some weaknesses, which (for me) might turn out to be inconsequential. However, I wanted to make things sure, so I changed a lot of things:

  • Uses -E flag for grep and sed because the C++ suffix pattern is -E style
  • Returns compiler error codes instead of 1
  • Also checks lipo's exit status
  • Checks for unknown or conflicting -arch options
  • Removes directory components when guessing implicit output filenames
  • Corrects default linker output name (a.out)
  • Changes "if `COMMAND`; then" into "if COMMAND; then" (the original version would execute not just COMMAND but also its output, if any.)
  • Uses set -f and quotes around $VARs where this makes sense, to reduce damage from weird args, leaving vulnerable only the compiler commands where word splitting is needed
  • Replaces special += syntax with a portable form
  • Simplifies heavily nested ifs

I have also run across a python26-specific tweak in files/wrapper-template:

# For some reason, -dynamiclib and -lpython2.6 are missing when linking
# .so files. Add them, except if -bundle is set (incompatible switches)

I have rewritten that part to be more robust, but I have not generalized its functionality to other python versions. This does not seem to be an omission: py27-numpy built ok without python26 installed (probably because python27 uses -bundle).

The patches to files/wrapper-template are attached as wrapper-template.diff. I consider these changes optional, but I recommend them unconditionally. Note that you have to chmod +x files/wrapper-template.

Applicability: I suppose that the proposed patches are not specific to PowerPC. I also suppose that they are not specific to py27-numpy. But that remains to be verified.

Attachments (3)

Portfile.required.diff (652 bytes) - added by ccorn@… 13 years ago.
Required patches to make +universal work
Portfile.stylistic.diff (363 bytes) - added by ccorn@… 13 years ago.
Might be meaningless, but I understand it better this way.
wrapper-template.diff (4.8 KB) - added by ccorn@… 13 years ago.
Robustness patches to files/wrapper-template

Download all attachments as: .zip

Change History (12)

Changed 13 years ago by ccorn@…

Attachment: Portfile.required.diff added

Required patches to make +universal work

Changed 13 years ago by ccorn@…

Attachment: Portfile.stylistic.diff added

Might be meaningless, but I understand it better this way.

Changed 13 years ago by ccorn@…

Attachment: wrapper-template.diff added

Robustness patches to files/wrapper-template

comment:1 Changed 13 years ago by mf2k (Frank Schima)

Cc: dh@… ram@… added; dh ram removed
Keywords: ppc64 powerpc LP64 universal removed

Trac requires complete email addresses.

comment:2 Changed 13 years ago by skymoo (Adam Mercer)

Cc: ram@… vince@… added; ram@… removed

Vince: As you originally added the universal support to numpy could you take a look at this?

comment:3 Changed 13 years ago by skymoo (Adam Mercer)

Cc: ram@… added; ram@… removed

comment:4 Changed 12 years ago by ob+macport@…

Cc: ob+macport@… added

Cc Me!

comment:5 Changed 11 years ago by skymoo (Adam Mercer)

Cc: ram@… removed

comment:6 Changed 10 years ago by petrrr

Cc: petr@… added

Cc Me!

comment:7 Changed 9 years ago by petrrr

Cc: michaelld@… added; dh@… removed
Owner: changed from macports-tickets@… to dh@…

Assigning (CC-ing) maintainers to review this ticket.

comment:8 Changed 8 years ago by mf2k (Frank Schima)

Port: py-numpy added; py27-numpy removed

comment:9 Changed 8 years ago by mf2k (Frank Schima)

Cc: michaelld@… removed
Owner: changed from dh@… to michaelld@…

dh has retired. See #51239.

Note: See TracTickets for help on using tickets.