Skip to content

Commit 473c5ba

Browse files
laanwjMunkybooty
authored andcommitted
Partial Merge bitcoin#15844: depends: Purge libtool archives
8541cbe depends: libX*: --disable-malloc0returnsnull in conf (Carl Dong) 0e75263 depends: libXext: Bump to 1.3.3 to fix _XEatDataWords (Carl Dong) 683b7d7 depends: Purge libtool archives (Carl Dong) 1420928 depends: Build secondary deps statically. (Carl Dong) Pull request description: ``` We use pkg-config where we can, which generally replaces libtool at a higher level and does not have the same downsides as libtool. These archives sit in our depends tree with no purpose and pollute the final bitcoin build with massive overlinking. ``` See [here](https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives) for an explanation of the various problems libtool archives can cause. Unrelated in every way except in spirit: `-D__LIBTOOL_IS_A_FOOL__`!! ----- This PR is based on bitcoin#16041, and therefore should be merged after bitcoin#16041. ACKs for commit 8541cb: Tree-SHA512: 76030cf32361f0b1cfe14e3827a0cbec99994e7da00a56194ca40cf6cf7d87f78552f49d03d41ce9cf9b642992b90d993578ed1f0ad6bae15cd3f1c88dfaa4b0
1 parent 26144df commit 473c5ba

File tree

11 files changed

+66
-5
lines changed

11 files changed

+66
-5
lines changed

depends/packages.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The package "mylib" will be used here as an example
55

66
General tips:
77
- mylib_foo is written as $(package)_foo in order to make recipes more similar.
8+
- Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
9+
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
10+
need to be shared and should be built statically whenever possible. See
11+
[below](#secondary-dependencies) for more details.
812

913
## Identifiers
1014
Each package is required to define at least these variables:
@@ -146,3 +150,34 @@ $($(package)_config_opts) will be appended.
146150
Most autotools projects can be properly staged using:
147151

148152
$(MAKE) DESTDIR=$($(package)_staging_dir) install
153+
154+
## Build outputs:
155+
156+
In general, the output of a depends package should not contain any libtool
157+
archives. Instead, the package should output `.pc` (`pkg-config`) files where
158+
possible.
159+
160+
From the [Gentoo Wiki entry](https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Handling_Libtool_Archives):
161+
162+
> Libtool pulls in all direct and indirect dependencies into the .la files it
163+
> creates. This leads to massive overlinking, which is toxic to the Gentoo
164+
> ecosystem, as it leads to a massive number of unnecessary rebuilds.
165+
166+
## Secondary dependencies:
167+
168+
Secondary dependency packages relative to the bitcoin binaries/libraries (i.e.
169+
those not in `ALLOWED_LIBRARIES` in `contrib/devtools/symbol-check.py`) don't
170+
need to be shared and should be built statically whenever possible. This
171+
improves general build reliability as illustrated by the following example:
172+
173+
When linking an executable against a shared library `libprimary` that has its
174+
own shared dependency `libsecondary`, we may need to specify the path to
175+
`libsecondary` on the link command using the `-rpath/-rpath-link` options, it is
176+
not sufficient to just say `libprimary`.
177+
178+
For us, it's much easier to just link a static `libsecondary` into a shared
179+
`libprimary`. Especially because in our case, we are linking against a dummy
180+
`libprimary` anyway that we'll throw away. We don't care if the end-user has a
181+
static or dynamic `libseconday`, that's not our concern. With a static
182+
`libseconday`, when we need to link `libprimary` into our executable, there's no
183+
dependency chain to worry about as `libprimary` has all the symbols.

depends/packages/dbus.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(package)_sha256_hash=6049ddd5f3f3e2618f615f1faeda0a115104423a7996b7aa73e2f36e3
66
$(package)_dependencies=expat
77

88
define $(package)_set_vars
9-
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-static --without-x
9+
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-shared --without-x
1010
endef
1111

1212
define $(package)_config_cmds
@@ -21,3 +21,7 @@ define $(package)_stage_cmds
2121
$(MAKE) -C dbus DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-dbusincludeHEADERS install-nodist_dbusarchincludeHEADERS && \
2222
$(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA
2323
endef
24+
25+
define $(package)_postprocess_cmds
26+
rm lib/*.la
27+
endef

depends/packages/expat.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ $(package)_file_name=$(package)-$($(package)_version).tar.bz2
55
$(package)_sha256_hash=cbc9102f4a31a8dafd42d642e9a3aa31e79a0aedaa1f6efd2795ebc83174ec18
66

77
define $(package)_set_vars
8-
$(package)_config_opts=--disable-static --without-docbook --without-tests --without-examples
8+
$(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples
9+
$(package)_config_opts_linux=--with-pic
910
endef
1011

1112
define $(package)_config_cmds
@@ -19,3 +20,7 @@ endef
1920
define $(package)_stage_cmds
2021
$(MAKE) DESTDIR=$($(package)_staging_dir) install
2122
endef
23+
24+
define $(package)_postprocess_cmds
25+
rm lib/*.la
26+
endef

depends/packages/fontconfig.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ endef
2626
define $(package)_stage_cmds
2727
$(MAKE) DESTDIR=$($(package)_staging_dir) install
2828
endef
29+
30+
define $(package)_postprocess_cmds
31+
rm lib/*.la
32+
endef

depends/packages/freetype.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ endef
2020
define $(package)_stage_cmds
2121
$(MAKE) DESTDIR=$($(package)_staging_dir) install
2222
endef
23+
24+
define $(package)_postprocess_cmds
25+
rm lib/*.la
26+
endef

depends/packages/libXau.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ endef
2727
define $(package)_stage_cmds
2828
$(MAKE) DESTDIR=$($(package)_staging_dir) install
2929
endef
30+
31+
define $(package)_postprocess_cmds
32+
rm lib/*.la
33+
endef

depends/packages/libevent.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ define $(package)_stage_cmds
3535
endef
3636

3737
define $(package)_postprocess_cmds
38+
rm lib/*.la
3839
endef

depends/packages/libxcb.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ define $(package)_stage_cmds
4444
endef
4545

4646
define $(package)_postprocess_cmds
47-
rm -rf share/man share/doc
47+
rm -rf share/man share/doc lib/*.la
4848
endef

depends/packages/protobuf.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ define $(package)_stage_cmds
2525
endef
2626

2727
define $(package)_postprocess_cmds
28-
rm lib/libprotoc.a
28+
rm lib/libprotoc.a lib/*.la
2929
endef

depends/packages/qrencode.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ endef
2626
define $(package)_stage_cmds
2727
$(MAKE) DESTDIR=$($(package)_staging_dir) install
2828
endef
29+
30+
define $(package)_postprocess_cmds
31+
rm lib/*.la
32+
endef

0 commit comments

Comments
 (0)