1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
.\" $OpenBSD: check-lib-depends.1,v 1.2 2019/03/04 14:10:33 espie Exp $
.\"
.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: March 4 2019 $
.Dt CHECK-LIB-DEPENDS 1
.Os
.Sh NAME
.Nm check-lib-depends
.Nd scan port for shared libraries
.Sh SYNOPSIS
.Nm check-lib-depends
.Op Fl fimoqx
.Op Fl B Ar destdir
.Op Fl d Ar pkgrepo
.Op Fl D Ar directory
.Op Fl F Ar missing
.Op Fl O Ar dest
.Op Fl S Ar VAR Ns = Ns Ar value
.Op Fl s Ar source
.Op Ar package ...
.Sh DESCRIPTION
.Nm
scans a port or package for shared libraries, and verify that all of them
are properly recorded.
.Pp
.Nm
can either scan files from a built port after the
.Ar fake stage
from the
.Ev WRKINST
directory, or look directly inside a
.Ar package .
.Pp
Likewise, it can also verify dependencies off installed packages,
or figure them out directly from the port directory.
.Pp
.Nm
actually consists of two distinct stages:
.Bl -bullet
.It
scan all binaries inside a package to extract libraries and rpaths,
using
.Xr objdump 1
or
.Xr ldd 1 .
.It
compare those libraries against the port's registered dependencies
and report problems.
.El
.Pp
The options are as follows:
.Bl -tag -width keyword
.It Fl B Ar destdir
Scan files under
.Ar destdir .
.It Fl d Ar pkgrepo
Look for all needed packages under directory
.Ar pkgrepo .
.It Fl D Ar directory
Create debug log files under
.Ar directory
that show in more details the run of
.Xr objdump 1 .
.It Fl f
Give full reports of every file that requires a missing library.
.It Fl F Ar missing
Works in tandem with
.Fl S .
Allow backsubstituting even if the
.Ar missing
library
is actually not part of the actual
.Ev WANTLIB
of the package.
Mostly used to waive the presence of
.Ar pthread ,
a mandatory dependency of C++ libraries on some architectures.
.It Fl i
Read packing-list from standard input.
.It Fl m
Always show progress-meter, even if not run from terminal.
.It Fl o
Scan binaries using
.Xr ldd 1 ,
which also works for old a.out binaries, instead of
.Xr objdump 1 ,
which only works for
.Xr elf 5
binaries.
.It Fl O Ar dest
Save result of first stage in file
.Ar dest .
.It Fl q
Be quiet, do not emit
.Sq Extra:
wantlibs unless there's also an actual problem.
.It Fl S Ar var Ns = Ns Ar value
recognize list of libraries listed in a variable, and replace said list
with variable value.
For instance,
.Fl S Ar COMPILER_LIBCXX Ns = Ns Ar stdc++
will replace
.Sq stdc++
with
.Sq ${COMPILER_LIBCXX}
in
.Ev WANTLIB
lists for compatibility with both clang and gcc.
Order matters.
The first
.Fl S
option will be handled first.
.It Fl s Ar src
Don't scan, directly read result of first stage from file
.Ar src .
.It Fl x
Don't show progress-meter, even if run from terminal.
.El
.Pp
If no
.Ar package
is given, and the
.Fl i
option is used,
.Nm
will retrieve the packing-list from stdin, and scan the package according
to other options.
.Sh BUGS
Currently,
.Nm
doesn't handle libraries living in subdirectories of
.Sq ${LOCALBASE}
correctly.
.Sh SEE ALSO
.Xr ldd 1 ,
.Xr objdump 1 ,
.Xr bsd.port.mk 5 ,
.Xr elf 5
|