On Sat, Jul 7, 2018 at 11:27 AM Matthew Miller <mattdm@xxxxxxxxxxxxxxxxx> wrote:
On Tue, Jul 03, 2018 at 10:21:42AM +0200, Jan Kurik wrote:
> The use of the "--as-needed" flag allows the linker to avoid linking
> extra libraries in a binary. This not only improves startup times (as
> the loader does not have to load all the libraries for every step) but
> might avoid the full initialization of big frameworks.
This might reduce auto-generated dependencies, too, right? Generally
that's a good thing, but of course there's always the off chance that
something that someone expects to be there because it was always pulled
into an install by a dep now won't be....
Yes, RPM generates dependencies based on what binary is linked against.
With spec below, change produces this result:
⋊> ~/r/SPECS rpm -qpR /home/brain/rpmbuild/RPMS/x86_64/hello-1-1.fc29.no_as_needed.x86_64.rpm
libatk-1.0.so.0()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libcairo-gobject.so.2()(64bit)
libcairo.so.2()(64bit)
libfribidi.so.0()(64bit)
libgdk-3.so.0()(64bit)
libgdk_pixbuf-2.0.so.0()(64bit)
libgio-2.0.so.0()(64bit)
libglib-2.0.so.0()(64bit)
libgobject-2.0.so.0()(64bit)
libgtk-3.so.0()(64bit)
libpango-1.0.so.0()(64bit)
libpangocairo-1.0.so.0()(64bit)
libpthread.so.0()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
libatk-1.0.so.0()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libcairo-gobject.so.2()(64bit)
libcairo.so.2()(64bit)
libfribidi.so.0()(64bit)
libgdk-3.so.0()(64bit)
libgdk_pixbuf-2.0.so.0()(64bit)
libgio-2.0.so.0()(64bit)
libglib-2.0.so.0()(64bit)
libgobject-2.0.so.0()(64bit)
libgtk-3.so.0()(64bit)
libpango-1.0.so.0()(64bit)
libpangocairo-1.0.so.0()(64bit)
libpthread.so.0()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
⋊> ~/r/SPECS rpm -qpR /home/brain/rpmbuild/RPMS/x86_64/hello-1-1.fc29.as_needed.x86_64.rpm
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libgtk-3.so.0()(64bit)
libpthread.so.0()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libgtk-3.so.0()(64bit)
libpthread.so.0()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
And here is the spec:
Name: hello
Version: 1
Release: 1%{?dist}
Summary: Hello
License: Public Domain
URL: https://fedoraproject.org
BuildRequires: gcc
BuildRequires: pkgconfig(gtk+-3.0)
%description
%{summary}.
%prep
%setup -c -T
cat > hello.c << EOF
#include <stdio.h>
#include <gtk/gtk.h>
int
main (int argc,
char *argv[])
{
gtk_init(&argc, &argv);
printf("Hello!\n");
return 0;
}
EOF
%build
gcc %{build_cflags} $(pkg-config --cflags gtk+-3.0) hello.c -o hello %{build_ldflags} $(pkg-config --libs gtk+-3.0)
%install
install -Dpm0755 -t %{buildroot}%{_bindir} hello
%files
%{_bindir}/hello
%changelog
Version: 1
Release: 1%{?dist}
Summary: Hello
License: Public Domain
URL: https://fedoraproject.org
BuildRequires: gcc
BuildRequires: pkgconfig(gtk+-3.0)
%description
%{summary}.
%prep
%setup -c -T
cat > hello.c << EOF
#include <stdio.h>
#include <gtk/gtk.h>
int
main (int argc,
char *argv[])
{
gtk_init(&argc, &argv);
printf("Hello!\n");
return 0;
}
EOF
%build
gcc %{build_cflags} $(pkg-config --cflags gtk+-3.0) hello.c -o hello %{build_ldflags} $(pkg-config --libs gtk+-3.0)
%install
install -Dpm0755 -t %{buildroot}%{_bindir} hello
%files
%{_bindir}/hello
%changelog
--
Matthew Miller
<mattdm@xxxxxxxxxxxxxxxxx>
Fedora Project Leader
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/message/2YS4DBHOHVWN4IUPQ3VLXYNAUOYAJ2FR/
-Igor Gnatenko
_______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/message/IFCPR574TD4DKJNRMPKUOVS6ZYRBMVXL/