Alan Hargreaves' Blog

The ramblings of a former Australian SaND TSC* Principal Field Technologist

Surprises in building non-debug encumbered binaries on SPARC

As many of you know, amongst other things I’ve been working on

6368986 support for OpenSolaris non-debug builds

A little more progress on the SPARC side of things this week, and the uncovery of some nasty surprises.

First off, the list of binaries that must be in the minimal set of encumbered binaries in order to find out what binaries an opensolaris build (without the closed bits) will deliver has slightly changed. On the good side I don’t need to do libprtdiag.so anymore. On the interesting side it looks like while the x86/x64 disassembly stuff is open, the SPARC disassembly stuff isn’t so I need it in there. The full lists are:

x86/x64 SPARC
lib/libc_i18n.a
lib/amd64/libc_i18n.a
lib/libc_i18n.a
lib/sparcv9/libc_i18n.a
usr/lib/libdisasm.so.1
usr/lib/libdisadm.so
usr/lib/sparcv9/libdisasm.so.1
usr/lib/sparcv9/libdisadm.so
usr/lib/sparcv9/libstanddisasm.so
usr/lib/mdb/disasm

Now the one that had me going for a bit could be summarised as saying

The perl Makefile construction code is on way too friendly terms with the ON build system, and has more intamate knowledge than it probably should.

My full builds were dieing because the build of Kstat.xs in both perls (5.6.1 and 5.8.4) was unable to find a few include files that would have been in ${ROOT}/usr/platform/sun4u/include and ${ROOT}/usr/platform/sun4v/include. Th ereally strange thing was that if I looked at the Makefile that was generated for Kstat.xs, the include directories were listed in a comment, but not in the actual variable assignment, meaning that the perl Makefile generation code was being passed the two include directories it needed, but it wasn’t inserting them correctly into the Makefile.

After much banging my head against a walland digging through code, I found teh following code fragment (it’s the same in usr/src/cmd/perl/5.6.1/utils/lib/ExtUtils/MM_Solaris_ON.pm and usr/src/cmd/perl/5.8.4/utils/lib/ExtUtils/MM_Solaris_ON.pm.

49 sub constants
50 {
51 	my ($self) = @_;
52
53 	# Find all the ENVCPPFLAGS[1-n] environment variables
54 	my (%inc_seen, @newincs, %proto_seen, @protos);
55 	foreach my $ip (map({ /^ENVCPPFLAGS\d+$/ ? split(' ', $ENV{$_}) : () }
56 	    keys(%ENV))) {
57 		# Ignore everything except '-I' flags
58 		next unless ($ip =~ s!^-I(.*)$!$1!);
59
60 		# Add to newincs if not seen before
61 		push(@newincs, "-I$ip") unless ($inc_seen{$ip}++);
62
63 		#
64 		# If the path points to somewhere under a proto area,
65 		# figure out the top of the proto area & save for later
66 		#
67 		next unless ($ip =~ s!^(.*/proto/root_[^/]+)/.*$!$1!);
68 		push(@protos, $ip) unless ($proto_seen{$ip}++);
69 	}

So this code knows that if a path to a directory includes the regular expression .*/proto/root_[^/]+, then it needs to do something special a bit further down to make sure we add it correctly to the list of includes.

All well and good, but this completely neglects ${ROOT}. In my case ${ROOT} was defined to be ${CODEMGR_WS}/closed/root_sparc, so it did not get dealt with in that bit of code. Sigh.

Left with the options of logging a bug to make MM_Solaris_ON.pm pay attention to ${ROOT} and kludgins my code to work completely under ${CODEMGR_WS}/proto/root_*, I went for the latter, as I’m probably the only idiot who tried playing around with ${ROOT} to use a directory that was not under proto.

This definitely got interesting, as during different stages of the build I need two different trees to be root_sparc.

My /opt/onbld/bin/encumbered-bins script now handles the directory renaming (and hopefully restating) during the build.

I am encouraged to see that the numebr of actual files included matches what Steve produces. For those interested, The production of these binaries requires two full builds and anothe make install over one of them again and took about four hours on a 24 way f4800 (this is why testing is such a pain). Unfortunately I needed this machine for another escalation today so I couldn’t test the results. Another day.

Technorati Tags:
,
,
SPARC,

Advertisements

Written by Alan

August 30, 2006 at 12:59 am

Posted in OpenSolaris

%d bloggers like this: