Skip to content

Commit 630b1cd

Browse files
committed
Update docs to point out LDFLAGS=--static for making fully statically linked binaries
1 parent e76eae6 commit 630b1cd

File tree

6 files changed

+225
-164
lines changed

6 files changed

+225
-164
lines changed

README

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,18 @@ library. They are also documented in the pcre2build man page.
157157
--disable-shared
158158
--disable-static
159159

160-
(See also "Shared libraries on Unix-like systems" below.)
160+
Setting --disable-shared ensures that PCRE2 libraries are built as static
161+
libraries. The binaries that are then created as part of the build process
162+
(for example, pcre2test and pcre2grep) are linked statically with one or more
163+
PCRE2 libraries, but may also be dynamically linked with other libraries such
164+
as libc. If you want these binaries to be fully statically linked, you can
165+
set LDFLAGS like this:
166+
167+
LDFLAGS=--static ./configure --disable-shared
168+
169+
Note the two hyphens in --static. Of course, this works only if static
170+
versions of all the relevant libraries are available for linking. See also
171+
"Shared libraries" below.
161172

162173
. By default, only the 8-bit library is built. If you add --enable-pcre2-16 to
163174
the "configure" command, the 16-bit library is also built. If you add
@@ -560,7 +571,10 @@ configuring it. For example:
560571
./configure --prefix=/usr/gnu --disable-shared
561572

562573
Then run "make" in the usual way. Similarly, you can use --disable-static to
563-
build only shared libraries.
574+
build only shared libraries. Note, however, that when you build only static
575+
libraries, binary programs such as pcre2test and pcre2grep may still be
576+
dynamically linked with other libraries (for example, libc) unless you set
577+
LDFLAGS to --static when running "configure".
564578

565579

566580
Cross-compiling using autotools
@@ -933,4 +947,4 @@ The distribution should contain the files listed below.
933947
Philip Hazel
934948
Email local part: Philip.Hazel
935949
Email domain: gmail.com
936-
Last updated: 11 August 2023
950+
Last updated: 24 November 2023

doc/html/README.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,18 @@ library. They are also documented in the pcre2build man page.
157157
--disable-shared
158158
--disable-static
159159

160-
(See also "Shared libraries on Unix-like systems" below.)
160+
Setting --disable-shared ensures that PCRE2 libraries are built as static
161+
libraries. The binaries that are then created as part of the build process
162+
(for example, pcre2test and pcre2grep) are linked statically with one or more
163+
PCRE2 libraries, but may also be dynamically linked with other libraries such
164+
as libc. If you want these binaries to be fully statically linked, you can
165+
set LDFLAGS like this:
166+
167+
LDFLAGS=--static ./configure --disable-shared
168+
169+
Note the two hyphens in --static. Of course, this works only if static
170+
versions of all the relevant libraries are available for linking. See also
171+
"Shared libraries" below.
161172

162173
. By default, only the 8-bit library is built. If you add --enable-pcre2-16 to
163174
the "configure" command, the 16-bit library is also built. If you add
@@ -560,7 +571,10 @@ configuring it. For example:
560571
./configure --prefix=/usr/gnu --disable-shared
561572

562573
Then run "make" in the usual way. Similarly, you can use --disable-static to
563-
build only shared libraries.
574+
build only shared libraries. Note, however, that when you build only static
575+
libraries, binary programs such as pcre2test and pcre2grep may still be
576+
dynamically linked with other libraries (for example, libc) unless you set
577+
LDFLAGS to --static when running "configure".
564578

565579

566580
Cross-compiling using autotools
@@ -933,4 +947,4 @@ The distribution should contain the files listed below.
933947
Philip Hazel
934948
Email local part: Philip.Hazel
935949
Email domain: gmail.com
936-
Last updated: 11 August 2023
950+
Last updated: 24 November 2023

doc/html/pcre2build.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,19 @@ <h1>pcre2build man page</h1>
119119
--disable-shared
120120
--disable-static
121121
</pre>
122-
to the <b>configure</b> command.
122+
to the <b>configure</b> command. Setting --disable-shared ensures that PCRE2
123+
libraries are built as static libraries. The binaries that are then created as
124+
part of the build process (for example, <b>pcre2test</b> and <b>pcre2grep</b>)
125+
are linked statically with one or more PCRE2 libraries, but may also be
126+
dynamically linked with other libraries such as <b>libc</b>. If you want these
127+
binaries to be fully statically linked, you can set LDFLAGS like this:
128+
<br>
129+
<br>
130+
LDFLAGS=--static ./configure --disable-shared
131+
<br>
132+
<br>
133+
Note the two hyphens in --static. Of course, this works only if static versions
134+
of all the relevant libraries are available for linking.
123135
</P>
124136
<br><a name="SEC5" href="#TOC1">UNICODE AND UTF SUPPORT</a><br>
125137
<P>
@@ -630,7 +642,7 @@ <h1>pcre2build man page</h1>
630642
</P>
631643
<br><a name="SEC27" href="#TOC1">REVISION</a><br>
632644
<P>
633-
Last updated: 09 August 2023
645+
Last updated: 24 November 2023
634646
<br>
635647
Copyright &copy; 1997-2023 University of Cambridge.
636648
<br>

0 commit comments

Comments
 (0)