Opened 15 years ago

Closed 14 months ago

#22557 closed defect (fixed)

MacPorts base should verify build_arch has a sensible value

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.7.0
Component: base Version: 1.8.1
Keywords: Cc: nerdling (Jeremy Lavergne), 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 (2)

macports.tcl.diff (522 bytes) - added by nerdling (Jeremy Lavergne) 15 years ago.
test for space in build_arch
macports.tcl.2.diff (556 bytes) - added by nerdling (Jeremy Lavergne) 15 years ago.
test for arch in list

Download all attachments as: .zip

Change History (9)

comment:1 Changed 15 years ago by nerdling (Jeremy Lavergne)

Cc: snc@… added

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

Changed 15 years ago by nerdling (Jeremy Lavergne)

Attachment: macports.tcl.diff added

test for space in build_arch

comment:2 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

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 15 years ago by nerdling (Jeremy Lavergne)

Attachment: macports.tcl.2.diff added

test for arch in list

comment:3 Changed 15 years ago by nerdling (Jeremy Lavergne)

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

comment:4 Changed 15 years ago by nerdling (Jeremy Lavergne)

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 12 years 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 12 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

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.

comment:7 Changed 14 months ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.7.0
Resolution: fixed
Status: newclosed

We're basically doing this as of [c91081d2ffab6e1cd8ce2f3033c0fe7be831171f/macports-base].

% sudo port build testport2 build_arch=x87_64   
Password:
Error: testport2 cannot be installed for the configured build_arch 'x87_64' because it is not supported.
Note: See TracTickets for help on using tickets.