From dedd1df79e9cbe29e9beee3ebea81169792a43cb Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 18 Dec 2020 17:31:28 +0100 Subject: [PATCH] treewide: drop librt and libpthread packages Since OpenWrt's main libc library, musl, does not provide separate shared object files for libpthread and librt, the existing binary packages for them are empty placeholders which provide no runtime functionality and frequently cause confusion among users who attempt to build software linking -lrt or -lpthread on target. To clean this situation up somewhat and to simplify binary package dependecies for all of the potential musl, glibc and uclibc cases, drop those packages and move libpthread.so as well as librt.so into the main libc package for those libc implementations that happen ship them as extra shared libraries. Also let the abstract libc package provide virtual libpthread and librt packages in order to ease migration for packages that still explicitly depend on them. Signed-off-by: Jo-Philipp Wich --- package/devel/perf/Makefile | 2 +- package/devel/valgrind/Makefile | 2 +- package/libs/libevent2/Makefile | 2 +- package/libs/libnl/Makefile | 1 - package/libs/libusb/Makefile | 2 +- package/libs/musl-fts/Makefile | 1 - package/libs/toolchain/Makefile | 107 ++---------------- package/network/config/ltq-adsl-app/Makefile | 2 +- .../network/config/ltq-vdsl-vr9-app/Makefile | 2 +- package/network/ipv6/thc-ipv6/Makefile | 5 +- package/system/opkg/Makefile | 2 +- package/utils/adb/Makefile | 2 +- package/utils/mdadm/Makefile | 2 +- package/utils/util-linux/Makefile | 1 - 14 files changed, 18 insertions(+), 115 deletions(-) diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index f9573c4150..c7c02146cc 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -27,7 +27,7 @@ include $(INCLUDE_DIR)/nls.mk define Package/perf SECTION:=devel CATEGORY:=Development - DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @KERNEL_PERF_EVENTS \ + DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +objdump @!IN_SDK @KERNEL_PERF_EVENTS \ +PACKAGE_libbfd:libbfd +PACKAGE_libopcodes:libopcodes TITLE:=Linux performance monitoring tool VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index 9f8a2e9e79..465104a3ef 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -33,7 +33,7 @@ include $(INCLUDE_DIR)/kernel.mk define Package/valgrind SECTION:=devel CATEGORY:=Development - DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||aarch64 +libpthread +librt + DEPENDS:=@mips||mipsel||mips64||mips64el||i386||x86_64||powerpc||arm_v7||aarch64 TITLE:=debugging and profiling tools for Linux URL:=http://www.valgrind.org endef diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 92602607ae..25203d71df 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -104,7 +104,7 @@ endef define Package/libevent2-pthreads $(call Package/libevent2/Default) TITLE+= Pthreads library (version 2.1) - DEPENDS+=+libpthread +libevent2-core + DEPENDS+=+libevent2-core endef define Package/libevent2-pthreads/description diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 93817e5f40..c71095485e 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -34,7 +34,6 @@ endef define Package/libnl-core $(call Package/libnl/default) TITLE:=Core Netlink Library - DEPENDS:=+libpthread endef define Package/libnl-genl diff --git a/package/libs/libusb/Makefile b/package/libs/libusb/Makefile index 0c6de7cb61..36ff02dc0a 100644 --- a/package/libs/libusb/Makefile +++ b/package/libs/libusb/Makefile @@ -31,7 +31,7 @@ define Package/libusb-1.0 SECTION:=libs CATEGORY:=Libraries TITLE:=A library for accessing Linux USB devices - DEPENDS:=+libpthread +librt +libatomic + DEPENDS:=+libatomic URL:=http://libusb.info/ ABI_VERSION:=0 endef diff --git a/package/libs/musl-fts/Makefile b/package/libs/musl-fts/Makefile index 72341cd379..147b828c19 100644 --- a/package/libs/musl-fts/Makefile +++ b/package/libs/musl-fts/Makefile @@ -37,7 +37,6 @@ define Package/musl-fts CATEGORY:=Libraries TITLE:=fts implementation for musl libc URL:=https://github.com/pullmoll/musl-fts - DEPENDS:= +libpthread endef define Package/musl-fts/description diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile index ea36af5da4..2b4f5e9526 100644 --- a/package/libs/toolchain/Makefile +++ b/package/libs/toolchain/Makefile @@ -115,7 +115,7 @@ define Package/libasan $(call Package/gcc/Default) NAME:=libasan TITLE:=Runtime library for AddressSanitizer in GCC - DEPENDS:=@USE_GLIBC +librt +libstdcpp @!mips64 @!mips64el @!arc + DEPENDS:=@USE_GLIBC +libstdcpp @!mips64 @!mips64el @!arc ABI_VERSION:=5 endef @@ -144,7 +144,7 @@ define Package/libtsan $(call Package/gcc/Default) NAME:=libtsan TITLE:=Runtime library for ThreadSanitizer in GCC - DEPENDS:=@USE_GLIBC +librt +libstdcpp @!mips @!mipsel @!mips64 @!mips64el @!arc + DEPENDS:=@USE_GLIBC +libstdcpp @!mips @!mipsel @!mips64 @!mips64el @!arc ABI_VERSION:=0 endef @@ -173,7 +173,7 @@ define Package/liblsan $(call Package/gcc/Default) NAME:=liblsan TITLE:=Runtime library for LeakSanitizer in GCC - DEPENDS:=@USE_GLIBC +librt +libstdcpp @!mips @!mipsel @!mips64 @!mips64el @!arc + DEPENDS:=@USE_GLIBC +libstdcpp @!mips @!mipsel @!mips64 @!mips64el @!arc ABI_VERSION:=0 endef @@ -202,7 +202,7 @@ define Package/libubsan $(call Package/gcc/Default) NAME:=libubsan TITLE:=Runtime library for UndefinedBehaviorSanitizer in GCC - DEPENDS:=@USE_GLIBC +librt +libstdcpp @!mips64 @!mips64el @!arc + DEPENDS:=@USE_GLIBC +libstdcpp @!mips64 @!mips64el @!arc ABI_VERSION:=1 endef @@ -239,6 +239,7 @@ endef define Package/libc $(call Package/libc/Default) TITLE:=C library + PROVIDES:=libpthread librt endef define Package/libc/config @@ -256,33 +257,7 @@ define Package/libc/config string prompt "libc shared library files (use wildcards)" depends on EXTERNAL_TOOLCHAIN && PACKAGE_libc - default "./lib/ld{*.so*,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*,.so}" - - endmenu -endef - - -define Package/libpthread -$(call Package/libc/Default) - TITLE:=POSIX thread library -endef - -define Package/libpthread/config - menu "Configuration" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread - - config LIBPTHREAD_ROOT_DIR - string - prompt "libpthread shared library base directory" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread - default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN - default "/" if NATIVE_TOOLCHAIN - - config LIBPTHREAD_FILE_SPEC - string - prompt "libpthread shared library files (use wildcards)" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_libpthread - default "./lib/libpthread{-*.so,.so.*}" + default "./lib/ld{*.so*,-linux*.so.*} ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,pthread,resolv,rt,util}{-*.so,.so.*,.so}" endmenu endef @@ -314,33 +289,6 @@ define Package/libthread-db/config endmenu endef -define Package/librt -$(call Package/libc/Default) - TITLE:=POSIX.1b RealTime extension library - DEPENDS:=+libpthread -endef - -define Package/librt/config - menu "Configuration" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt - - config LIBRT_ROOT_DIR - string - prompt "librt shared library base directory" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt - default TOOLCHAIN_ROOT if !NATIVE_TOOLCHAIN - default "/" if NATIVE_TOOLCHAIN - - config LIBRT_FILE_SPEC - string - prompt "librt shared library files (use wildcards)" - depends on EXTERNAL_TOOLCHAIN && PACKAGE_librt - default "./lib/librt{-*.so,.so.*}" - - endmenu -endef - - define Package/libgfortran $(call Package/gcc/Default) TITLE:=GFortran support library @@ -524,7 +472,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(CP) \ $(TOOLCHAIN_DIR)/lib/ld*.so.* \ $(1)/lib/ - for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libresolv libutil; do \ + for file in libanl libc libcidn libcrypt libdl libm libnsl libnss_dns libnss_files libpthread libresolv librt libutil; do \ for file in $(TOOLCHAIN_DIR)/lib/$$$$file.so.*; do \ if [ -e "$$$$file" ]; then \ $(CP) $$$$file $(1)/lib/; \ @@ -553,40 +501,19 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) define Package/libc/install_lib $(CP) $(filter-out %/libdl_pic.a %/libpthread_pic.a %/libresolv_pic.a,$(wildcard $(TOOLCHAIN_DIR)/lib/lib*.a)) $(1)/lib/ $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libc_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libc_so.a $(1)/lib/libc_pic.a) + $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a) $(if $(LIBGCC_MAP), \ $(CP) $(LIBGCC_A) $(1)/lib/libgcc_s_pic.a; \ $(CP) $(LIBGCC_MAP) $(1)/lib/libgcc_s_pic.map \ ) endef - define Package/libpthread/install - $(INSTALL_DIR) $(1)/lib - ifneq ($(CONFIG_USE_MUSL),y) - $(CP) \ - $(TOOLCHAIN_DIR)/lib/libpthread.so.* \ - $(1)/lib/ - endif - endef - define Package/libthread-db/install $(INSTALL_DIR) $(1)/lib $(CP) \ $(TOOLCHAIN_DIR)/lib/libthread_db.so.* $(1)/lib endef - define Package/libpthread/install_lib - $(if $(wildcard $(TOOLCHAIN_DIR)/lib/libpthread_so.a),$(CP) $(TOOLCHAIN_DIR)/lib/libpthread_so.a $(1)/lib/libpthread_pic.a) - endef - - define Package/librt/install - $(INSTALL_DIR) $(1)/lib - ifneq ($(CONFIG_USE_MUSL),y) - $(CP) \ - $(TOOLCHAIN_DIR)/lib/librt.so.* \ - $(1)/lib/ - endif - endef - define Package/ldd/install $(INSTALL_DIR) $(1)/usr/bin/ $(CP) $(TOOLCHAIN_DIR)/bin/ldd $(1)/usr/bin/ @@ -674,14 +601,6 @@ else $(call Package/$(LIBC)/install,$1) endef - define Package/libpthread/install - for file in $(call qstrip,$(CONFIG_LIBPTHREAD_FILE_SPEC)); do \ - $(INSTALL_DIR) $(1)/lib ; \ - $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file $(1)/lib/ ; \ - done ; \ - exit 0 - endef - define Package/libthread-db/install for file in $(call qstrip,$(CONFIG_LIBTHREAD_DB_FILE_SPEC)); do \ $(INSTALL_DIR) $(1)/lib ; \ @@ -690,14 +609,6 @@ else exit 0 endef - define Package/librt/install - for file in $(call qstrip,$(CONFIG_LIBRT_FILE_SPEC)); do \ - $(INSTALL_DIR) $(1)/lib ; \ - $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file $(1)/lib/ ; \ - done ; \ - exit 0 - endef - define Package/libatomic/install for file in $(call qstrip,$(CONFIG_LIBATOMIC_FILE_SPEC)); do \ $(INSTALL_DIR) $(1)/lib ; \ @@ -742,9 +653,7 @@ $(eval $(call BuildPackage,libasan)) $(eval $(call BuildPackage,libtsan)) $(eval $(call BuildPackage,liblsan)) $(eval $(call BuildPackage,libubsan)) -$(eval $(call BuildPackage,libpthread)) $(eval $(call BuildPackage,libthread-db)) -$(eval $(call BuildPackage,librt)) $(eval $(call BuildPackage,libgfortran)) $(eval $(call BuildPackage,libgomp)) $(eval $(call BuildPackage,ldd)) diff --git a/package/network/config/ltq-adsl-app/Makefile b/package/network/config/ltq-adsl-app/Makefile index 472e3c0ed9..184475606c 100644 --- a/package/network/config/ltq-adsl-app/Makefile +++ b/package/network/config/ltq-adsl-app/Makefile @@ -35,7 +35,7 @@ define Package/ltq-adsl-app CATEGORY:=Network TITLE:=Lantiq DSL userland tool URL:=http://www.lantiq.com/ - DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) +libpthread +ltq-dsl-base +libubox +libubus + DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xway_legacy||TARGET_lantiq_ase) +ltq-dsl-base +libubox +libubus PROVIDES:=ltq-dsl-app MENU:=1 endef diff --git a/package/network/config/ltq-vdsl-vr9-app/Makefile b/package/network/config/ltq-vdsl-vr9-app/Makefile index c51489e2c5..d085ec7881 100644 --- a/package/network/config/ltq-vdsl-vr9-app/Makefile +++ b/package/network/config/ltq-vdsl-vr9-app/Makefile @@ -29,7 +29,7 @@ define Package/ltq-vdsl-vr9-app CATEGORY:=Network TITLE:=Lantiq VDSL userland tool URL:=http://www.lantiq.com/ - DEPENDS:=@TARGET_lantiq_xrx200 +libpthread +librt +ltq-dsl-base +libubox +libubus + DEPENDS:=@TARGET_lantiq_xrx200 +ltq-dsl-base +libubox +libubus PROVIDES:=ltq-dsl-app endef diff --git a/package/network/ipv6/thc-ipv6/Makefile b/package/network/ipv6/thc-ipv6/Makefile index b26b0507fb..7df0d62a80 100644 --- a/package/network/ipv6/thc-ipv6/Makefile +++ b/package/network/ipv6/thc-ipv6/Makefile @@ -33,15 +33,12 @@ THC_APPLETS := \ randicmp6 redir6 rsmurf6 sendpees6 sendpeesmp6 smurf6 thcping6 \ toobig6 trace6 toobigsniff6 flood_unreach6 connect6 -THC_DEPENDS_dnsdict6 := +libpthread -THC_DEPENDS_thcping6 := +librt - define BuildTool define Package/thc-ipv6-$(subst _,-,$(1)) TITLE:=THC-IPv6 $(1) utility SECTION:=net CATEGORY:=Network - DEPENDS:=+libpcap $(THC_DEPENDS_$(1)) + DEPENDS:=+libpcap URL:=https://github.com/vanhauser-thc/thc-ipv6 SUBMENU:=THC-IPv6 attack and analyzing toolkit endef diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 3510e7435d..29cf282b4f 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -38,7 +38,7 @@ define Package/opkg SECTION:=base CATEGORY:=Base system TITLE:=opkg package manager - DEPENDS:=+uclient-fetch +libpthread +libubox + DEPENDS:=+uclient-fetch +libubox URL:=$(PKG_SOURCE_URL) MENU:=1 endef diff --git a/package/utils/adb/Makefile b/package/utils/adb/Makefile index c207c333b2..b5a17a3420 100644 --- a/package/utils/adb/Makefile +++ b/package/utils/adb/Makefile @@ -27,7 +27,7 @@ define Package/adb CATEGORY:=Utilities TITLE:=Android Debug Bridge CLI tool URL:=http://tools.android.com/ - DEPENDS:=+zlib +libopenssl +libpthread + DEPENDS:=+zlib +libopenssl endef define Package/adb/description diff --git a/package/utils/mdadm/Makefile b/package/utils/mdadm/Makefile index 8070003394..0103b2540a 100644 --- a/package/utils/mdadm/Makefile +++ b/package/utils/mdadm/Makefile @@ -29,7 +29,7 @@ define Package/mdadm SUBMENU:=Disc TITLE:=A tool for managing Soft RAID under Linux URL:=https://www.kernel.org/pub/linux/utils/raid/mdadm/ - DEPENDS:=+libpthread +kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1 + DEPENDS:=+kmod-md-mod +kmod-md-raid0 +kmod-md-raid10 +kmod-md-raid1 endef define Package/mdadm/description diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index ec6925f0ea..0f7931311d 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -33,7 +33,6 @@ include $(INCLUDE_DIR)/meson.mk define Package/util-linux/Default SECTION:=utils CATEGORY:=Utilities - DEPENDS:= +librt URL:=http://www.kernel.org/pub/linux/utils/util-linux/ endef -- 2.30.2