Re: Bug in apgcc when encountering dependencies on non-lib libraries
Scott Pakin <[email protected]> Tue, 10 Mar 2009 11:52:37 -0600
| Newsgroups | gmane.comp.autopackage.devel |
|---|---|
| Organization | Los Alamos National Laboratory |
| Message-ID | <[email protected]> |
On 10MAR2009 Jan Niklas Hasse wrote:
> Thanks for the description and the patch! I committed it in r2550.
> http://trac.autopackage.org/changeset/2550
Cool, thanks!
> While testing your patch I recognized that apgcc only prints a confusing
> error message when libuuid.so doesn't exist:
>
> $ sudo mv /usr/lib/libuuid.so backup.so
> $ env APBUILD_STATIC=uuid apgcc -o whatever whatever.c
> objdump: '': No such file
> $ sudo mv backup.so /usr/lib/libuuid.so
> $ env APBUILD_STATIC=uuid apgcc -o whatever whatever.c
> $
>
> Isn't this a bug we should fix, too? Before your patch, there didn't
> seem to be an error message at all. I don't know what causes this as I'm
> not that familiar with apbuild.
I hadn't seen that error before. Note that nonexistent libraries
don't produce an error message:
$ env APBUILD_STATIC=bogus apgcc -o whatever whatever.c
$
I just stepped through the code, and it looks like the "objdump: '':
No such file" error is output when the .a file exists but the .so file
doesn't. I've attached a patch that outputs a more user-friendly
warning message in that case. The warning is written to standard
output for consistency with the APBUILD_NO_STATIC_X warning right
above it in the code, but, personally, I'd prefer using Perl's warn
statement to write warning messages to standard error.
As a bonus patch, I fixed a bug in GCC.pm that I encountered along the
way. GCC.pm's getSearchPaths subroutine was incorrectly constructing
the library search path. Instead of appending the new path list onto
the old list, it was appending only a _reference_ to the new list.
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected]
For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected]
apgcc-no-so.patch
(text/x-patch, 1.1 KB)
--- share/apbuild/Apbuild/GCC.pm.2550 2009-03-10 11:40:18.743120000 -0600
+++ share/apbuild/Apbuild/GCC.pm 2009-03-10 11:37:49.113971000 -0600
@@ -338,7 +338,7 @@
};
$self->foreach($args, $callback);
- push @{$paths}, $self->{searchPaths};
+ push @{$paths}, @{$self->{searchPaths}};
}
--- bin/apgcc.2550 2009-03-10 11:40:01.693108000 -0600
+++ bin/apgcc 2009-03-10 11:42:17.988242000 -0600
@@ -798,7 +798,12 @@
# find the DT_NEEDED entries that this library-to-be-made-static
# has so that final linking works (the deps need to be added after the static lib so the bogus stripper doesn't remove them)
my ($r, $w);
- my $pid = open2 ($r, $w, 'objdump', '-p', searchLib("lib$lib.so", \@searchPaths));
+ my $abslib = searchLib("lib$lib.so", \@searchPaths);
+ if (!defined $abslib) {
+ print "WARNING: Failed to find lib$lib.so in ", join(":", @searchPaths), ".\n";
+ next;
+ }
+ my $pid = open2 ($r, $w, 'objdump', '-p', $abslib);
close ($w);
foreach (<$r>) {
next unless (/^ NEEDED\s+lib(.+?)\.so/);