+universal help

Ryan Schmidt ryandesign at macports.org
Wed Jan 27 17:16:28 PST 2010


On Jan 27, 2010, at 14:12, Scott Haneda wrote:

> Hello, I am working on adding +universal to memtester, which is a "configure no" style portfile.
> 
> Not using MacPorts, I just figured out how to get this to built out universal.  There are two files in the source
>    conf-cc
>    conf-ld

Yes, sorry, I was going to suggest to you that you modify conf-cc and conf-ld but I hadn't quite gotten everything to work yet.


> If I edit them to this:
> 
>    head -n1 conf-cc
>    /usr/bin/gcc -O2 -DPOSIX -c -arch x86_64 -arch i386
> 
>    head -n1 conf-ld
>    /usr/bin/cc -s -arch x86_64 -arch i386
> 
> Previous pre-edit of the files were lacking the full path, and of course, lacking the string "-arch x86_64 -arch i386"
> 
> Do I need to add ppc and the rest of the -arch's?  What is the full list I should be adding?

You need to add the archs the user has requested via the universal_archs variable in macports.conf, accessible in the portfile via the ${configure.universal_archs} variable. MacPorts has already assembled the string with all the arch flags for you. It's in the variable ${configure.universal_cflags}.

memtester also doesn't support selecting a different build_arch in macports.conf (portfile variable: ${configure.build_arch}). This is to be expected, since that also happens in a way that assumes a configure-based script; ports that don't use the default universal variant don't by default get build_arch support either. The solution is similar, and the pre-made architecture flag is in the variable ${configure.cc_archflags}.


> Just adding those will not get +universal to show up in `port info`, can someone guide me with that part?

Declare a universal variant.

variant universal {
	...
}



> What is the best way to reinplace the data I need to?
> 
> Here is what I get after running `make`:
>    $file memtester
>    memtester: Mach-O universal binary with 2 architectures
>    memtester (for architecture x86_64):	Mach-O 64-bit executable x86_64
>    memtester (for architecture i386):	Mach-O executable i386
> 
> My guess would be to add:
> platform darwin 10 {
>    # Reinplace foo to alter the above two files
> }

This has nothing to do with Snow Leopard specifically so there's no call for a platform darwin 10 section.


> * If I do add -arch ppc and -arch ppc64, I get a bunch of errors, the main one being:
>    ld: symbol(s) not found for architecture ppc64
>    collect2: ld returned 1 exit status
>    lipo: can't open input file: /var/tmp//ccpg8LXX.out (No such file or directory)
>    make: *** [memtester] Error 1
> 
> I just tried to built the current port on a PPC machine, and I get:
>    $sudo port install memtester
>    Password:
>    Warning: Can't open index file for source: file:///Users/me/macports
>    Error: Port memtester not found

Attached is a patch that allows memtester to build universal and for a non-default build_arch. It seems to build fine on Snow Leopard (x86_64 only, i386 only, x86_64/i386 universal) and Leopard on a G4 (ppc only, ppc/i386 universal).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: memtester.diff
Type: application/octet-stream
Size: 730 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20100127/9c8e8bb7/attachment.obj>


More information about the macports-dev mailing list