php mcrypt uiversal

Ryan Schmidt ryandesign at
Sat Jan 16 14:58:49 PST 2010

On Jan 16, 2010, at 16:35, Scott Haneda wrote:

> On Jan 15, 2010, at 6:18 PM, Ryan Schmidt wrote:
>> On Jan 15, 2010, at 19:03, Scott Haneda wrote:
>>> I am trying to get mcrypt universal working, but hit an error:
>> It builds fine universal here. Presumably one of the dependencies is not built universal on your system.
> Can you tell me how to list all the dependencies, not just the ones for mcrypt, but those for the dependencies of the dependencies of mcrypt.  
> I suspect there is no simple way to get that list.

The port-rdeps script provides that list.

Unfortunately nobody has yet created a port for that script, so it must be installed manually.

Here is the output of "port-rdeps -r php5-mcrypt" on my system:

Dependencies of php5-mcrypt:

As of MacPorts 1.8.0, probably the easiest way to install php5-mcrypt universal when some of its dependencies aren't installed universal is as follows:

1. Install php5-mcrypt non-universal:

sudo port install php5-mcrypt

2. Upgrade php5-mcrypt and any necessary dependencies to universal:

sudo port upgrade --enforce-variants php5-mcrypt +universal

> I am a little confused with this:
>    $port dependents php5-mcrypt
>    php5-mcrypt has no dependents!
> But the Portfile shows:
>    depends_lib-append      port:libmcrypt \
>                            port:libtool

Correct: php5-mcrypt has no dependents (ports that depend on php5-mcrypt) but it has dependencies (ports php5-mcrypt depends on). You can see the latter with:

port deps php5-mcrypt

Dependents and dependencies are different (opposite) things.

> Is it a good idea to maybe just adjust my conf file for MacPorts to just built everything as a 4way UB?

There's probably no reason to build 4-way universal, and not all ports will support it; particularly ports using the muniversal portgroup often have trouble cross-compiling. If you're on Intel, there's probably no need to build for PowerPC and vice versa. On Snow Leopard there is a good reason to build 2-way universal for x86_64 and i386 because ports build 64-bit by default but some ports can only be built 32-bit so the only way to use both kinds in the same prefix is to install as many ports as possible 2-way universal. On Leopard which builds 32-bit by default it can still be advantageous to build 2-way x86_64 i386 universal because 64-bit software on Intel can be faster and can address more memory.

> Where can I read more about how to do this? I think I just need to add +universal to all the ports I install, but if there is a way to do so without remembering to add that to every port install command, it would be nice.

Set universal_archs as desired in macports.conf.

Add "+universal" in variants.conf.

> How do I adjust portfiles to be able to support +universal?
>    $port info php5-mcrypt
>    Variants:             debug, universal
> I do not see anything in that Portfile that has debug or universal.  This is confusing to me, as when I compare that to a simple Portfile of my own, memtester:
>    $port info memtester
>    memtester @4.1.2 (sysutils)
>    Description:          A userspace utility for testing the memory subsystem for 
>                          faults.
>    Homepage:   
>    Platforms:            darwin
>    License:              unknown
> I am not sure how you get universal and debug into your Portfile, since there is no explicit code that is offering it.

MacPorts provides a universal variant automatically for all ports that don't request otherwise. It may not work in all ports. Ports in which it does not work should use "universal_variant no" to turn it off, or override the universal variant and make it work. Some portgroups provide their own universal variants, like the cmake and xcode portgroups. Your port memtester uses "use_configure no"; the default universal variant assumes configure-based programs, so if you turn off the configure phase, MacPorts turns off the universal variant automatically; see:

As to why php5-mcrypt has a debug variant, that's added by the php5extension portgroup; for why, see:

More information about the macports-users mailing list