Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Michael 'veremitz' Everitt <gentoo@×××××××.xyz>
Subject: Re: [gentoo-portage-dev] [PATCH] Add QA check for unresolved soname dependencies (bug 704320)
Date: Mon, 06 Jan 2020 09:28:25
Message-Id: 11d44cb9-09e4-bb39-b6dd-251c24163b3d@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Add QA check for unresolved soname dependencies (bug 704320) by Michael 'veremitz' Everitt
1 On 1/5/20 10:48 PM, Michael 'veremitz' Everitt wrote:
2 > On 06/01/20 06:38, Zac Medico wrote:
3 >> Example output for maven-bin-3.6.2 (bug 704618):
4 >>
5 >> * QA Notice: Unresolved soname dependencies:
6 >> *
7 >> * /usr/share/maven-bin-3.6/lib/jansi-native/freebsd32/libjansi.so: libc.so.7 libutil.so.9
8 >> * /usr/share/maven-bin-3.6/lib/jansi-native/freebsd64/libjansi.so: libc.so.7 libutil.so.9
9 >> *
10 >>
11 >> This warning comes up when a library or executable has one or
12 >> more soname dependencies (found in its NEEDED.ELF.2 metadata)
13 >> that could not be resolved by usual means. If you run ldd
14 >> on files like these then it will report a "not found" error
15 >> for each unresolved soname dependency. In order to correct
16 >> problems with soname dependency resolution, use one or more
17 >> of the approaches described in the following sections.
18 >>
19 >> Content of the NEEDED.ELF.2 metadata file may be useful
20 >> for debugging purposes. Find the NEEDED.ELF.2 file in the
21 >> ${D}/../build-info/ directory after the ebuild src_install
22 >> phase completes, or in the /var/db/pkg/*/*/ directory for an
23 >> installed package. Each line of the NEEDED.ELF.2 file contains
24 >> semicolon separated values for a single ELF file. The soname
25 >> dependencies are found in the DT_NEEDED column:
26 >>
27 >> E_MACHINE;path;DT_SONAME;DT_RUNPATH;DT_NEEDED;multilib category
28 >>
29 >> External dependencies
30 >>
31 >> For packages that install pre-built binaries, it may be possible
32 >> to resolve soname dependencies simply by adding dependencies
33 >> for one or more other packages that are known to provide the
34 >> needed sonames.
35 >>
36 >> Removal of unecessary files
37 >>
38 >> For packages that install pre-built binaries, it may be possible
39 >> to resolve soname dependencies simply by removing unnecessary
40 >> files which have unresolved soname dependencies. For example,
41 >> some pre-built binary packages include binaries intended for
42 >> irrelevant architectures or operating systems, and these files
43 >> can simply be removed because they are unnecessary.
44 >>
45 >> Addition of DT_RUNPATH entries
46 >>
47 >> If the relevant dependencies are installed in a location that
48 >> is not included in the dynamic linker search path, then it's
49 >> necessary for files to include a DT_RUNPATH entry which refers
50 >> to the appropriate directory. The special $ORIGIN value can
51 >> be used to create a relative path reference in DT_RUNPATH,
52 >> where $ORIGIN is a placeholder for the directory where the
53 >> file having the DT_RUNPATH entry is located.
54 >>
55 >> For pre-built binaries, it may be necessary to fix up
56 >> DT_RUNPATH using patchelf --set-rpath. For example, use
57 >> patchelf --set-rpath '$ORIGIN' if a given binary should link
58 >> to libraries found in the same directory as the binary itself,
59 >> or use patchelf --set-rpath '$ORIGIN/libs' if a given binary
60 >> should link to libraries found in a subdirectory named libs
61 >> found in the same directory as the binary itself.
62 >>
63 >> For binaries built from source, a flag like
64 >> -Wl,-rpath,/path/of/directory/containing/libs will create
65 >> binaries with the desired DT_RUNPATH entry.
66 >>
67 >> Bug: https://bugs.gentoo.org/704320
68 >> Signed-off-by: Zac Medico <zmedico@g.o>
69 >> ---
70 > <snip>
71 >
72 > Looks awesome!
73 >
74 > One comment: would it be helpful for developers/maintainers to have some
75 > indication of what's going on here, and what attempts portage is making in
76 > this regard?
77
78 Effectively, it's as though portage runs ldd on all the files installed
79 by the ebuild, and reports any unresolved soname dependencies. If
80 portage doesn't agree with ldd then it's a portage bug. If this happens
81 then I'd expect people to simply file a bug. I would indicate a flaw in
82 the SonameDepsProcessor logic, an it's a fairly small amount of code:
83
84 https://gitweb.gentoo.org/proj/portage.git/tree/lib/portage/util/_dyn_libs/soname_deps.py?h=portage-2.3.84
85
86 > Something like a 'verbose' option that would spit out some
87 > debugging info so that /if/ something goes wrong, or the outcome wasn't
88 > what was intended, then this can be picked up and corrected somehow else?
89
90 Mope, just file a bug and include the exact ebuild that triggered the
91 unexpected results.
92
93 > I think automation is great for picking these issues up, and shining a
94 > light on where/why something goes wrong,
95
96 Yeah, issues like this will go completely unnoticed otherwise (until
97 someone uses emerge --ignore-soname-deps=n or triggers some undesirable
98 preserve-libs behavior like bug 265372 or bug 400979).
99
100 > but sometimes it needs a few
101 > minutes of human intervention to achieve the sane outcome in many
102 > circumstances.
103
104 Well, yeah, the whole point of the QA Notice is to solicit some human
105 intervention in order to resolve the issue. If the issue could be solved
106 without human intervention then we wouldn't need the QA Notice.
107
108 Maybe I should include "file a portage bug" as an approach to take if
109 none of the previously suggested resolution approaches appears to be
110 applicable. After all, the SonameDepsProcessor logic is almost certainly
111 not an entirely perfect model of reality.
112 --
113 Thanks,
114 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature