[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: unstripped-static-library



Hi Herbert,

I am not a mentor. I think the static library striping is done by
dh_strip, the detection code looks like this:
    # Is it a static library, and not a debug library?
    if (m/lib.*\.a$/ && ! m/.*_g\.a$/) {
        # Is it a binary file, or something else (maybe a linker
        # script on Hurd, for example? I don't use file, because
        # file returns a variety of things on static libraries.
        if (-B $_) {
            push @static_libs, $fn;
            return;
        }
    }

While the lintian warnings look like this:
    X: libgphoto2-dev: unstripped-static-library
usr/lib/x86_64-linux-gnu/libgphoto2/2.5.8/adc65.a(adc65.o)

It seems the static libraries built does not have the prefix ``lib'',
so dh_strip does not detect it as a static library. I am not sure if
this is intended.

I think the solution for now will be to add the following to ``rule'':
override_dh_strip:
	dh_strip
	find . -name '*.a' \( \! -name '*_g.a' \) \
	-exec strip --strip-debug \
	--remove-section=.comment \
	--remove-section=.note {} \;

This is according to the striping code in dh_strip:
    if (@static_libs) {
        my $strip_help = qx{$strip 2>&1};
	my @opts = ('--strip-debug', '--remove-section=.comment',
            '--remove-section=.note');
        if (index($strip_help, '--enable-deterministic-archives') > -1) {
            # NB: The short variant (-D) is broken in Jessie
            # (binutils/2.25-3)
            push(@opts, '--enable-deterministic-archives');
        }
        foreach (@static_libs) {
            doit($strip, @opts, $_);
        }
    }

Feel free to discuss.

Cheers,
Alex

On 03/10/2015, Herbert Parentes Fortes Neto <hpfn@ig.com.br> wrote:
> Hi mentors,
>
> I've already checked with my mentor, but he
> said he isn't a expert in libraries. And
> here I can improve my english.
>
> I maintain libgphoto2 and lintian now says
> that the package has "unstripped-static-library"
> (.a files). We (me and my mentor) believe that
> this message can be ignored.
>
> Can someone take a look and confirm this ? I alert:
> this is an experimental tag. Just in case you don't
> waste time with this kind of tag.
>
> The package is at mentors:
> https://mentors.debian.net/package/libgphoto2
> http://mentors.debian.net/debian/pool/main/libg/libgphoto2/libgphoto2_2.5.8-2.dsc
>
>
> regards,
> --
> Herbert Parentes Fortes Neto (hpfn)
>
>


Reply to: