New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #22557 (new defect)

Opened 4 years ago

Last modified 6 weeks ago

MacPorts base should verify build_arch has a sensible value

Reported by: ryandesign@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts Future
Component: base Version: 1.8.1
Keywords: Cc: snc@…, rogerdpack@…
Port:

Description

build_arch is meant to contain a single architecture value only. If the user sets build_arch to a nonsense value like "i386 x86_64" or "green", ports quite understandably fail to compile. (See #22534 for an example.) MacPorts base should prevent user confusion by verifying that build_arch contains a valid value. Attempting to cross-compile using build_arch is probably also a bad idea, so the valid values should probably be "i386" or "x86_64" on Intel Macs and "ppc" or "ppc64" on PowerPC Macs. We could consider allowing "ppc" on Intel Macs as well due to Rosetta.

Attachments

macports.tcl.diff (522 bytes) - added by snc@… 4 years ago.
test for space in build_arch
macports.tcl.2.diff (556 bytes) - added by snc@… 4 years ago.
test for arch in list

Change History

comment:1 Changed 4 years ago by snc@…

  • Cc snc@… added

From the aspect of future architectures (atom, arm, etc) why not just make sure there are no spaces?

Changed 4 years ago by snc@…

test for space in build_arch

comment:2 Changed 4 years ago by ryandesign@…

That wouldn't catch typos. I'd rather check for the four specific architectures Mac OS X currently supports. If Mac OS X supports additional architectures later, we can update the check.

Changed 4 years ago by snc@…

test for arch in list

comment:3 Changed 4 years ago by snc@…

Attached is testing for the buildarch in a list of the four sensible architectures.

comment:4 Changed 3 years ago by snc@…

I'm thinking we shouldn't check what architecture we're on -- as you indicated there is a blur of ppc on intel hardware through Rosetta. This will only go away in the future (and who knows, we might pick up doing ARM).

Why not simply check that they're trying to build a legit Mac architecture and leave it at that?

comment:5 Changed 6 weeks ago by rogerdpack@…

I believe this has been resolved now. If I enter a "garbage" build_arch I get this (slightly unhelpful) error message, at least, these days:

Error: Unable to open port: can't read "my_targets(garbage)": no such element in array
Last edited 6 weeks ago by ryandesign@… (previous) (diff)

comment:6 Changed 6 weeks ago by ryandesign@…

  • Cc rogerdpack@… added

No, this hasn't been resolved. The message about my_targets is specific to the libvpx and XviD ports, which define an array called my_targets, fill it with values for all the known OS X architectures, and then, at build time, expect build_arch to be a member of that array, thus creating the error you saw when it isn't.

Note: See TracTickets for help on using tickets.