[LLVMdev] Build issues on Solaris

Nathan Keynes Nathan.Keynes at Sun.COM
Tue Aug 25 02:33:21 PDT 2009


On 20/08/2009, at 1:02 AM, Kenneth Boyd wrote:

> Duncan Sands wrote:
>> Hi Nathan,
>>
>>
>>> The latter being what GenLibDeps.pl expects to see. All else  
>>> being  equal though, it might be better to change GenLibDeps.pl to  
>>> recognize  the first version:
>>> --- GenLibDeps.pl       (revision 78653)
>>> +++ GenLibDeps.pl       (working copy)
>>> @@ -100,7 +100,7 @@
>>>     print "  <dt><b>$lib</b</dt><dd><ul>\n";
>>>   }
>>>   open UNDEFS,
>>> -    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort  
>>> |  uniq |";
>>> +    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' -e 's/^  
>>> *//'  | sort | uniq |";
>>>   my %DepLibs;
>>>   while (<UNDEFS>) {
>>>     chomp;
>>>
>>
>> starting at line 123 there seems to be a by-hand version of the
>> sed command.  I guess this needs to be adjusted too.  Probably
>> sed can be used nowadays.
>>
> I'd adjust it to be able to run in the first place (attaching patch).
>
> It's intended to run exactly when nm fails to find dependencies, so  
> die'ing out is pointless before it runs.  If allowed to run, this  
> supports Perls whose native C system command shell is cmd.exe:  
> Strawberry Perl, ActivePerl, and any Perl built for Windows *other*  
> than the MingW32 pre-built binaries.  (cmd.exe chokes on the pipe  
> into sed, causing the whole construct to fail.)
>
> If the first nm finds any dependencies at all, the by-hand version  
> won't run.  It's currently optimized for MingW32 nm.

You know, now that you mention it why _are_ there two versions of this  
bit? If there's a concern about sed possibly being broken, we could  
just remove sed altogether and let perl handle it:

Index: GenLibDeps.pl
===================================================================
--- GenLibDeps.pl	(revision 79390)
+++ GenLibDeps.pl	(working copy)
@@ -99,11 +99,11 @@
   } else {
     print "  <dt><b>$lib</b</dt><dd><ul>\n";
   }
-  open UNDEFS,
-    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort |  
uniq |";
   my %DepLibs;
+  open UNDEFS, "$nmPath -u $Directory/$lib |";
   while (<UNDEFS>) {
     chomp;
+    s/^[ 0]* *U? //;
     my $lib_printed = 0;
     if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) {
       $DepLibs{$libdefs{$_}} = [] unless exists $DepLibs{$libdefs{$_}};
@@ -118,33 +118,7 @@
     }
   }
   close UNDEFS or die "nm failed";
-  unless(keys %DepLibs) {
-    # above failed
-    open UNDEFS, "$nmPath -u $Directory/$lib |";
-    while (<UNDEFS>) {
-      # to bypass non-working sed
-      if ('  ' eq substr($_,0,2) and index($_,'U ')) {
-        $_ = substr($_,index($_,'U ')+2)
-      };
-      $_ = substr($_,index($_,'  *U ')+5) if -1!=index($_,'  *U ');

-      chomp;
-      my $lib_printed = 0;
-      if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) {
-        $DepLibs{$libdefs{$_}} = [] unless exists  
$DepLibs{$libdefs{$_}};
-        push(@{$DepLibs{$libdefs{$_}}}, $_);
-      } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) {
-        my $libroot = $lib;
-        $libroot =~ s/lib(.*).a/$1/;
-        if ($objdefs{$_} ne "$libroot.o") {
-          $DepLibs{$objdefs{$_}} = [] unless exists  
$DepLibs{$objdefs{$_}};
-          push(@{$DepLibs{$objdefs{$_}}}, $_);
-        }
-      }
-    }
-    close UNDEFS or die "nm failed";
-  }
-
   for my $key (sort keys %DepLibs) {
     if ($FLAT) {
       print " $key";

Cheers,
Nathan



More information about the llvm-dev mailing list