[PATCH] uclibc++: remove

Rosen Penev rosenp at gmail.com
Fri Feb 26 23:17:46 EST 2021


No package here depends on it. Furthermore, uClibc++ is a fairly buggy
C++ library and seems to be relatively inactive upstream.

It also lacks proper support for modern C++11 features.

The main benefit of it is size: 66.6 KB	vs 287.3 KB on mips24kc. Static
linking and LTO can help bring the size down of packages that need it.

Added warning message to uclibc++.mk

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 config/Config-build.in                        |  14 --
 include/uclibc++.mk                           |  18 +--
 package/libs/uclibc++/Makefile                | 105 -------------
 package/libs/uclibc++/files/config.default    |  58 -------
 .../libs/uclibc++/patches/001-no-ansi.patch   |  10 --
 .../patches/002-undef-functions.patch         |  35 -----
 .../libs/uclibc++/patches/003-no-fPIC.patch   |  10 --
 ...ibc-Make-long-long-available-to-C-11.patch | 143 ------------------
 .../005-istream_helpers-Fix-sscanf-typo.patch |  37 -----
 9 files changed, 2 insertions(+), 428 deletions(-)
 delete mode 100644 package/libs/uclibc++/Makefile
 delete mode 100644 package/libs/uclibc++/files/config.default
 delete mode 100644 package/libs/uclibc++/patches/001-no-ansi.patch
 delete mode 100644 package/libs/uclibc++/patches/002-undef-functions.patch
 delete mode 100644 package/libs/uclibc++/patches/003-no-fPIC.patch
 delete mode 100644 package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
 delete mode 100644 package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch

diff --git a/config/Config-build.in b/config/Config-build.in
index 342859b7c0..c72ba74755 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -217,20 +217,6 @@ menu "Global build settings"
 		  make the system libraries incompatible with most of the packages that are
 		  not selected during the build process.
 
-	choice
-		prompt "Preferred standard C++ library"
-		default USE_LIBSTDCXX if USE_GLIBC
-		default USE_UCLIBCXX
-		help
-		  Select the preferred standard C++ library for all packages that support this.
-
-		config USE_UCLIBCXX
-			bool "uClibc++"
-
-		config USE_LIBSTDCXX
-			bool "libstdc++"
-	endchoice
-
 	comment "Hardening build options"
 
 	config PKG_CHECK_FORMAT_SECURITY
diff --git a/include/uclibc++.mk b/include/uclibc++.mk
index a1a61f26d4..10f8d98e15 100644
--- a/include/uclibc++.mk
+++ b/include/uclibc++.mk
@@ -1,16 +1,2 @@
-ifndef DUMP
-  ifdef __package_mk
-    $(error uclibc++.mk must be included before package.mk)
-  endif
-endif
-
-PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
-CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
-
-ifneq ($(CONFIG_USE_UCLIBCXX),)
- ifneq ($(CONFIG_CCACHE),)
-  TARGET_CXX_NOCACHE=g++-uc
- else
-  TARGET_CXX=g++-uc
- endif
-endif
+$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS)
+CXX_DEPENDS = +libstdcpp
diff --git a/package/libs/uclibc++/Makefile b/package/libs/uclibc++/Makefile
deleted file mode 100644
index 0e3210a5b9..0000000000
--- a/package/libs/uclibc++/Makefile
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# Copyright (C) 2006-2012 OpenWrt.org
-# Copyright (c) 2016 LEDE project
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=uclibc++
-PKG_VERSION:=0.2.5
-PKG_RELEASE:=3
-
-PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=https://cxx.uclibc.org/src/
-PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a
-PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
-
-PKG_LICENSE:=LGPL-2.1-or-later
-PKG_INSTALL:=1
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/uclibcxx
-  NAME:=uclibc++
-  SECTION:=libs
-  CATEGORY:=Libraries
-  TITLE:=C++ library for embedded systems
-  URL:=https://cxx.uclibc.org/
-endef
-
-UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
-	-e 's/i.86/i386/' \
-	-e 's/sparc.*/sparc/' \
-	-e 's/m68k.*/m68k/' \
-	-e 's/ppc/powerpc/g' \
-	-e 's/v850.*/v850/g' \
-	-e 's/sh64/sh/' \
-	-e 's/sh[234].*/sh/' \
-	-e 's/mips.*/mips/' \
-	-e 's/mipsel.*/mips/' \
-)
-
-TARGET_CFLAGS += $(FPIC) -nostdinc++ -std=c++11
-TARGET_LDFLAGS += -Wl,--gc-sections
-
-ifneq ($(CONFIG_CCACHE),)
-TARGET_CXX=$(TARGET_CXX_NOCACHE)
-endif
-
-ifeq ($(CONFIG_USE_MUSL),y)
-SSP_LIB=-lssp_nonshared
-endif
-
-ifeq (${V}, s)
-MAKE_VARS+= \
-	V=1
-else ifeq (${V}, sc)
-MAKE_VARS+= \
-	V=2
-endif
-
-MAKE_FLAGS:= \
-	$(TARGET_CONFIGURE_OPTS) \
-	CPU_CFLAGS="$(TARGET_CFLAGS)" \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	LDFLAGS="$(TARGET_LDFLAGS)" \
-	GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \
-	check_as_needed=
-
-# check_as_needed overrides dependency on libgcc_s
-
-define Build/Configure
-	if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
-		cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
-	else \
-		cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
-	fi
-endef
-
-define Build/InstallDev
-	$(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/
-	$(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
-	$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
-	$(SED) 's!\(^\|[[:space:]]\)-[IL]$(TOOLCHAIN_DIR)/[^[:space:]]*!!g' $(TOOLCHAIN_DIR)/bin/g++-uc
-	$(SED) 's|-I/include/|-I$$$${STAGING_DIR:-$(STAGING_DIR)}/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
-	$(SED) 's|-L/lib/|-L$$$${STAGING_DIR:-$(STAGING_DIR)}/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
-# add another wrapper which links against both uClibc++ and libstdc++
-	$(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std
-	$(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
-	$(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
-	$(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
-endef
-
-define Package/uclibcxx/install
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
-	$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
-endef
-
-$(eval $(call BuildPackage,uclibcxx))
diff --git a/package/libs/uclibc++/files/config.default b/package/libs/uclibc++/files/config.default
deleted file mode 100644
index d76670e969..0000000000
--- a/package/libs/uclibc++/files/config.default
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-
-#
-# Target Features and Options
-#
-UCLIBCXX_HAS_FLOATS=y
-# UCLIBCXX_HAS_LONG_DOUBLE is not set
-# UCLIBCXX_HAS_TLS is not set
-UCLIBCXX_WARNINGS=""
-BUILD_EXTRA_LIBRARIES=""
-HAVE_DOT_CONFIG=y
-
-#
-# String and I/O Stream Support
-#
-UCLIBCXX_HAS_WCHAR=y
-UCLIBCXX_IOSTREAM_BUFSIZE=32
-UCLIBCXX_HAS_LFS=y
-UCLIBCXX_SUPPORT_CDIR=y
-UCLIBCXX_SUPPORT_CIN=y
-UCLIBCXX_SUPPORT_COUT=y
-UCLIBCXX_SUPPORT_CERR=y
-UCLIBCXX_SUPPORT_CLOG=y
-# UCLIBCXX_SUPPORT_WCIN is not set
-# UCLIBCXX_SUPPORT_WCOUT is not set
-# UCLIBCXX_SUPPORT_WCERR is not set
-# UCLIBCXX_SUPPORT_WCLOG is not set
-
-#
-# STL and Code Expansion
-#
-UCLIBCXX_STL_BUFFER_SIZE=32
-UCLIBCXX_CODE_EXPANSION=y
-UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS=y
-UCLIBCXX_EXPAND_STRING_CHAR=y
-UCLIBCXX_EXPAND_VECTOR_BASIC=y
-UCLIBCXX_EXPAND_IOS_CHAR=y
-UCLIBCXX_EXPAND_STREAMBUF_CHAR=y
-UCLIBCXX_EXPAND_ISTREAM_CHAR=y
-UCLIBCXX_EXPAND_OSTREAM_CHAR=y
-UCLIBCXX_EXPAND_FSTREAM_CHAR=y
-UCLIBCXX_EXPAND_SSTREAM_CHAR=y
-
-#
-# Library Installation Options
-#
-UCLIBCXX_RUNTIME_PREFIX=""
-UCLIBCXX_RUNTIME_INCLUDE_SUBDIR="/include"
-UCLIBCXX_RUNTIME_LIB_SUBDIR="/lib"
-UCLIBCXX_RUNTIME_BIN_SUBDIR="/bin"
-UCLIBCXX_EXCEPTION_SUPPORT=y
-IMPORT_LIBSUP=y
-# IMPORT_LIBGCC_EH is not set
-BUILD_STATIC_LIB=y
-# BUILD_ONLY_STATIC_LIB is not set
-# DODEBUG is not set
diff --git a/package/libs/uclibc++/patches/001-no-ansi.patch b/package/libs/uclibc++/patches/001-no-ansi.patch
deleted file mode 100644
index 7ddbf52f00..0000000000
--- a/package/libs/uclibc++/patches/001-no-ansi.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -232,7 +232,6 @@ endif
- GEN_CXXFLAGS:=-nostdinc++
- GEN_CXXFLAGS+=$(if $(CXXFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY)
- CXXFLAGS:=$(CFLAGS)
--CFLAGS += -ansi
- 
- LIBGCC:=$(shell $(CC) -print-libgcc-file-name)
- LIBGCC_DIR:=$(dir $(LIBGCC))
diff --git a/package/libs/uclibc++/patches/002-undef-functions.patch b/package/libs/uclibc++/patches/002-undef-functions.patch
deleted file mode 100644
index 47fa1580f2..0000000000
--- a/package/libs/uclibc++/patches/002-undef-functions.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 8245f62c1e7aba150f666b3c3a1dda646dee6d4b Mon Sep 17 00:00:00 2001
-From: Rosen Penev <rosenp at gmail.com>
-Date: Fri, 27 Sep 2019 13:12:44 -0700
-Subject: [PATCH] cstdio: Add undef for four functions
-
-When compiling with uClibc-ng, these functions get defined as macros and
-become unavailable for std.
-
-Fixes programs that use the std versions of these functions.
-
-This matches libstdcpp behavior.
-
-Signed-off-by: Rosen Penev <rosenp at gmail.com>
----
- include/cstdio | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
---- a/include/cstdio
-+++ b/include/cstdio
-@@ -21,6 +21,15 @@
- #ifndef __HEADER_CSTDIO
- #define __HEADER_CSTDIO 1
- 
-+#undef clearerr
-+#undef feof
-+#undef ferror
-+#undef fgetc
-+#undef fputc
-+#undef getc
-+#undef getchar
-+#undef putc
-+#undef putchar
- 
- namespace std{
- 	using ::FILE;
diff --git a/package/libs/uclibc++/patches/003-no-fPIC.patch b/package/libs/uclibc++/patches/003-no-fPIC.patch
deleted file mode 100644
index dfd8833ae4..0000000000
--- a/package/libs/uclibc++/patches/003-no-fPIC.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -185,7 +185,6 @@ export UCLIBCXX_RUNTIME_PREFIX UCLIBCXX_
- 
- WRAPPER = $(top_builddir)bin/g++-uc
- OPTIMIZATION:=
--PICFLAG:=-fPIC
- 
- # use '-Os' optimization if available, else use -O2, allow Config to override
- $(eval $(call check-gcc-var,-Os))
diff --git a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch b/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
deleted file mode 100644
index 6e13f22c8a..0000000000
--- a/package/libs/uclibc++/patches/004-uClibc-Make-long-long-available-to-C-11.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001
-From: Rosen Penev <rosenp at gmail.com>
-Date: Thu, 3 Oct 2019 18:58:43 -0700
-Subject: [PATCH] uClibc++: Make long long available to C++11
-
-C++11 makes long long available. It is no longer a GNU extension.
-
-Signed-off-by: Rosen Penev <rosenp at gmail.com>
----
- include/istream         | 4 ++--
- include/istream_helpers | 2 +-
- include/ostream         | 8 ++++----
- include/ostream_helpers | 8 ++++----
- tests/sstreamtest.cpp   | 4 ++--
- 5 files changed, 13 insertions(+), 13 deletions(-)
-
---- a/include/istream
-+++ b/include/istream
-@@ -72,7 +72,7 @@ namespace std{
- 		basic_istream<charT,traits>& operator>>(void*& p);
- 		basic_istream<charT,traits>& operator>>(basic_streambuf<char_type,traits>* sb);
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 		basic_istream<charT,traits>& operator>>(long long& n);
- 		basic_istream<charT,traits>& operator>>(unsigned long long& n);
- #endif
-@@ -455,7 +455,7 @@ namespace std{
- 		return *this;
- 	}
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 	template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>&
- 		basic_istream<charT,traits>::operator>>(long long& n)
- 	{
---- a/include/istream_helpers
-+++ b/include/istream_helpers
-@@ -301,7 +301,7 @@ namespace std{
- 	};
- 
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 	template <class traits> class _UCXXEXPORT __istream_readin<traits, char, long long>{
- 	public:
- 		inline static void readin(basic_istream<char, traits >& stream, long long & var)
---- a/include/ostream
-+++ b/include/ostream
-@@ -85,7 +85,7 @@ namespace std {
- 		basic_ostream<charT,traits>& operator<<(long double f);
- 		basic_ostream<charT,traits>& operator<<(void* p);
- 		basic_ostream<charT,traits>& operator<<(basic_streambuf<char_type,traits>* sb);
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 		basic_ostream<charT,traits>& operator<<(long long n);
- 		basic_ostream<charT,traits>& operator<<(unsigned long long n);
- #endif
-@@ -221,7 +221,7 @@ namespace std {
- 		return *this;
- 	}
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 	template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(long long n)
- 	{
- 		sentry s(*this);
-@@ -487,7 +487,7 @@ namespace std {
- #endif
- 
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- //Support for output of long long data types
- 
-@@ -509,7 +509,7 @@ template<class Ch, class Tr> _UCXXEXPORT
- }
- 
- 
--#endif	//__STRICT_ANSI__
-+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- 
- 
---- a/include/ostream_helpers
-+++ b/include/ostream_helpers
-@@ -142,7 +142,7 @@ namespace std{
- 		}
- 	};
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, signed long long int>{
- 	public:
-@@ -237,7 +237,7 @@ namespace std{
- 	};
- 
- 
--#endif	//__STRICT_ANSI__
-+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, double>{
- 	public:
-@@ -357,7 +357,7 @@ namespace std{
- 		}
- 	};
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, signed long long int>{
- 	public:
-@@ -428,7 +428,7 @@ namespace std{
- 	};
- 
- 
--#endif	//__STRICT_ANSI__
-+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 
- 	template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, double>{
- 	public:
---- a/tests/sstreamtest.cpp
-+++ b/tests/sstreamtest.cpp
-@@ -9,7 +9,7 @@ int main(){
- 	int i;
- 	std::string s;
- 	char c;
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 	long long ll;
- 	unsigned long long ull;
- #endif
-@@ -32,7 +32,7 @@ int main(){
- 
- 
- 
--#ifndef __STRICT_ANSI__
-+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
- 	a.str("678 76 54");
- 	a >> ll >> ull >> s;
- 	std::cout << "ll (should be 678): " << ll << std::endl;
diff --git a/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch b/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch
deleted file mode 100644
index 66b62c197c..0000000000
--- a/package/libs/uclibc++/patches/005-istream_helpers-Fix-sscanf-typo.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 7f6dd860818512c0eb313320308b22ba7e2c7205 Mon Sep 17 00:00:00 2001
-From: Rosen Penev <rosenp at gmail.com>
-Date: Fri, 4 Oct 2019 20:06:53 -0700
-Subject: [PATCH] istream_helpers: Fix sscanf typo
-
-This caused readin not to work properly with long long types.
-
-Found accidentally through a glibc warning
-(declared with warn_unused_result).
-
-Tested with gptfdisk on OpenWrt.
-
-Signed-off-by: Rosen Penev <rosenp at gmail.com>
----
- include/istream_helpers | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/include/istream_helpers
-+++ b/include/istream_helpers
-@@ -317,7 +317,7 @@ namespace std{
- 					sscanf(temp.c_str(), "%llo", (unsigned long long *)&var );
- 				}else if(stream.flags() & ios_base::hex){
- 					if(stream.flags() & ios_base::uppercase){
--						scanf(temp.c_str(), "%llX", (unsigned long long *)&var );
-+						sscanf(temp.c_str(), "%llX", (unsigned long long *)&var );
- 					}else{
- 						sscanf(temp.c_str(), "%llx", (unsigned long long *)&var);
- 					}
-@@ -344,7 +344,7 @@ namespace std{
- 					sscanf(temp.c_str(), "%llo", &var );
- 				}else if(stream.flags() & ios_base::hex){
- 					if(stream.flags() & ios_base::uppercase){
--						scanf(temp.c_str(), "%llX", &var );
-+						sscanf(temp.c_str(), "%llX", &var );
- 					}else{
- 						sscanf(temp.c_str(), "%llx", &var);
- 					}
-- 
2.25.1




More information about the openwrt-devel mailing list