Message ID | 20201223063311.695894-1-rosenp@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [PATCHv3] ccache: update to 4.1 | expand |
Rosen Penev kirjoitti 23.12.2020 klo 8.33: > Upstream switched to building with CMake. Adjust accordingly. > > Reapplied patch as upstream changed the file format. > > Added HOST_BUILD_PARALLEL for faster compilation. > > Added cmake tool dependency. > > Adjusted dependent tools to use NOCACHE as they are needed to build > ccache. > > Signed-off-by: Rosen Penev <rosenp@gmail.com> > --- > v3: zstd was missing in the commit for some reason > v2: fix compilation issues without OS tools. > tools/Makefile | 1 + > tools/ccache/Makefile | 17 +++++++++-------- > tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- > tools/libressl/Makefile | 1 + > tools/pkgconf/Makefile | 2 ++ > tools/zstd/Makefile | 1 + > 6 files changed, 24 insertions(+), 18 deletions(-) > > diff --git a/tools/Makefile b/tools/Makefile > index c66d4fb991..316ffb5ea6 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -82,6 +82,7 @@ endif > ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) > $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) > tools-y += ccache > +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile > endif > > # in case there is no patch tool on the host we need to make patch tool a > I am not sure if that is right. The v3 patch may create a circular dependency. * First, on line 83 all tools except xz and patch (and flock, sed and tar that are later handled separately) are marked to depend on ccache. This includes cmake. * Then the new addition to the next line makes ccache to depend on cmake. Sounds circular to me. Maybe we need to filter out also cmake on line 83 (in addition to xz and patch).
On Tue, Dec 22, 2020 at 11:53 PM Hannu Nyman <hannu.nyman@iki.fi> wrote: > > Rosen Penev kirjoitti 23.12.2020 klo 8.33: > > Upstream switched to building with CMake. Adjust accordingly. > > > > Reapplied patch as upstream changed the file format. > > > > Added HOST_BUILD_PARALLEL for faster compilation. > > > > Added cmake tool dependency. > > > > Adjusted dependent tools to use NOCACHE as they are needed to build > > ccache. > > > > Signed-off-by: Rosen Penev <rosenp@gmail.com> > > --- > > v3: zstd was missing in the commit for some reason > > v2: fix compilation issues without OS tools. > > tools/Makefile | 1 + > > tools/ccache/Makefile | 17 +++++++++-------- > > tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- > > tools/libressl/Makefile | 1 + > > tools/pkgconf/Makefile | 2 ++ > > tools/zstd/Makefile | 1 + > > 6 files changed, 24 insertions(+), 18 deletions(-) > > > > diff --git a/tools/Makefile b/tools/Makefile > > index c66d4fb991..316ffb5ea6 100644 > > --- a/tools/Makefile > > +++ b/tools/Makefile > > @@ -82,6 +82,7 @@ endif > > ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) > > $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) > > tools-y += ccache > > +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile > > endif > > > > # in case there is no patch tool on the host we need to make patch tool a > > > > I am not sure if that is right. The v3 patch may create a circular dependency. That doesn't seem to be the case. make tools/ccache/compile works perfectly fine with build/staging_dir removed. Without that addition, ccache will not compile. Removing that line and moving the tool names up to line 83 also does not compile. > > * First, on line 83 all tools except xz and patch (and flock, sed and tar > that are later handled separately) are marked to depend on ccache. This > includes cmake. > > * Then the new addition to the next line makes ccache to depend on cmake. > > Sounds circular to me. > > > Maybe we need to filter out also cmake on line 83 (in addition to xz and patch). > >
Rosen Penev kirjoitti 23.12.2020 klo 10.14: > On Tue, Dec 22, 2020 at 11:53 PM Hannu Nyman <hannu.nyman@iki.fi> wrote: >> Rosen Penev kirjoitti 23.12.2020 klo 8.33: >>> Upstream switched to building with CMake. Adjust accordingly. >>> >>> Reapplied patch as upstream changed the file format. >>> >>> Added HOST_BUILD_PARALLEL for faster compilation. >>> >>> Added cmake tool dependency. >>> >>> Adjusted dependent tools to use NOCACHE as they are needed to build >>> ccache. >>> >>> Signed-off-by: Rosen Penev <rosenp@gmail.com> >>> --- >>> v3: zstd was missing in the commit for some reason >>> v2: fix compilation issues without OS tools. >>> tools/Makefile | 1 + >>> tools/ccache/Makefile | 17 +++++++++-------- >>> tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- >>> tools/libressl/Makefile | 1 + >>> tools/pkgconf/Makefile | 2 ++ >>> tools/zstd/Makefile | 1 + >>> 6 files changed, 24 insertions(+), 18 deletions(-) >>> >>> diff --git a/tools/Makefile b/tools/Makefile >>> index c66d4fb991..316ffb5ea6 100644 >>> --- a/tools/Makefile >>> +++ b/tools/Makefile >>> @@ -82,6 +82,7 @@ endif >>> ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) >>> $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) >>> tools-y += ccache >>> +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile >>> endif >>> >>> # in case there is no patch tool on the host we need to make patch tool a >>> >> I am not sure if that is right. The v3 patch may create a circular dependency. > That doesn't seem to be the case. > > make tools/ccache/compile works perfectly fine with build/staging_dir removed. Did you also test after make dirclean? So that there are no tools. > > Without that addition, ccache will not compile. Removing that line and > moving the tool names up to line 83 also does not compile. Hmm... "tool names" ??? I proposed (below) adding cmake to this filter list "$(filter-out xz patch,$(tools-y))". That would make cmake not to depend on ccache. And then you can quite nicely set ccache to depend on cmake on the next line > >> * First, on line 83 all tools except xz and patch (and flock, sed and tar >> that are later handled separately) are marked to depend on ccache. This >> includes cmake. >> >> * Then the new addition to the next line makes ccache to depend on cmake. >> >> Sounds circular to me. >> >> >> Maybe we need to filter out also cmake on line 83 (in addition to xz and patch). >> >> Something like this (I also added zstd in the exclusion list, as ccache now depends on it): $(foreach tool, $(filter-out xz patch cmake zstd,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) tools-y += ccache +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile
On 2020-12-23 09:14, Rosen Penev wrote: > On Tue, Dec 22, 2020 at 11:53 PM Hannu Nyman <hannu.nyman@iki.fi> wrote: >> >> Rosen Penev kirjoitti 23.12.2020 klo 8.33: >> > Upstream switched to building with CMake. Adjust accordingly. >> > >> > Reapplied patch as upstream changed the file format. >> > >> > Added HOST_BUILD_PARALLEL for faster compilation. >> > >> > Added cmake tool dependency. >> > >> > Adjusted dependent tools to use NOCACHE as they are needed to build >> > ccache. >> > >> > Signed-off-by: Rosen Penev <rosenp@gmail.com> >> > --- >> > v3: zstd was missing in the commit for some reason >> > v2: fix compilation issues without OS tools. >> > tools/Makefile | 1 + >> > tools/ccache/Makefile | 17 +++++++++-------- >> > tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- >> > tools/libressl/Makefile | 1 + >> > tools/pkgconf/Makefile | 2 ++ >> > tools/zstd/Makefile | 1 + >> > 6 files changed, 24 insertions(+), 18 deletions(-) >> > >> > diff --git a/tools/Makefile b/tools/Makefile >> > index c66d4fb991..316ffb5ea6 100644 >> > --- a/tools/Makefile >> > +++ b/tools/Makefile >> > @@ -82,6 +82,7 @@ endif >> > ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) >> > $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) >> > tools-y += ccache >> > +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile >> > endif >> > >> > # in case there is no patch tool on the host we need to make patch tool a >> > >> >> I am not sure if that is right. The v3 patch may create a circular dependency. > That doesn't seem to be the case. > > make tools/ccache/compile works perfectly fine with build/staging_dir removed. > > Without that addition, ccache will not compile. Removing that line and > moving the tool names up to line 83 also does not compile. Yes, it may work in your tests, but the build shows a lot of warnings like this one: make[1]: Circular tools/libressl/compile <- tools/ccache/compile dependency dropped. Hannu is right about the circular dependency and his proposed solution. Please fix your patch - Felix
On Wed, Dec 23, 2020 at 12:28 AM Felix Fietkau <nbd@nbd.name> wrote: > > > On 2020-12-23 09:14, Rosen Penev wrote: > > On Tue, Dec 22, 2020 at 11:53 PM Hannu Nyman <hannu.nyman@iki.fi> wrote: > >> > >> Rosen Penev kirjoitti 23.12.2020 klo 8.33: > >> > Upstream switched to building with CMake. Adjust accordingly. > >> > > >> > Reapplied patch as upstream changed the file format. > >> > > >> > Added HOST_BUILD_PARALLEL for faster compilation. > >> > > >> > Added cmake tool dependency. > >> > > >> > Adjusted dependent tools to use NOCACHE as they are needed to build > >> > ccache. > >> > > >> > Signed-off-by: Rosen Penev <rosenp@gmail.com> > >> > --- > >> > v3: zstd was missing in the commit for some reason > >> > v2: fix compilation issues without OS tools. > >> > tools/Makefile | 1 + > >> > tools/ccache/Makefile | 17 +++++++++-------- > >> > tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- > >> > tools/libressl/Makefile | 1 + > >> > tools/pkgconf/Makefile | 2 ++ > >> > tools/zstd/Makefile | 1 + > >> > 6 files changed, 24 insertions(+), 18 deletions(-) > >> > > >> > diff --git a/tools/Makefile b/tools/Makefile > >> > index c66d4fb991..316ffb5ea6 100644 > >> > --- a/tools/Makefile > >> > +++ b/tools/Makefile > >> > @@ -82,6 +82,7 @@ endif > >> > ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) > >> > $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) > >> > tools-y += ccache > >> > +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile > >> > endif > >> > > >> > # in case there is no patch tool on the host we need to make patch tool a > >> > > >> > >> I am not sure if that is right. The v3 patch may create a circular dependency. > > That doesn't seem to be the case. > > > > make tools/ccache/compile works perfectly fine with build/staging_dir removed. > > > > Without that addition, ccache will not compile. Removing that line and > > moving the tool names up to line 83 also does not compile. > Yes, it may work in your tests, but the build shows a lot of warnings > like this one: > make[1]: Circular tools/libressl/compile <- tools/ccache/compile > dependency dropped. > > Hannu is right about the circular dependency and his proposed solution. > Please fix your patch Fixed and resent. make tools/ccache/compile V=s &> err.txt grep "Circular" err.txt <-- no longer returns any results. > > - Felix
diff --git a/tools/Makefile b/tools/Makefile index c66d4fb991..316ffb5ea6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -82,6 +82,7 @@ endif ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) $(foreach tool, $(filter-out xz patch,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile)) tools-y += ccache +$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile endif # in case there is no patch tool on the host we need to make patch tool a diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 6e55001fd5..e016e0beb3 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -1,4 +1,4 @@ -# +# # Copyright (C) 2006-2015 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. @@ -8,25 +8,26 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/target.mk PKG_NAME:=ccache -PKG_VERSION:=3.7.11 +PKG_VERSION:=4.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION) -PKG_HASH:=8d450208099a4d202bd7df87caaec81baee20ce9dd62da91e9ea7b95a9072f68 +PKG_HASH:=5fdc804056632d722a1182e15386696f0ea6c59cb4ab4d65a54f0b269ae86f99 + +HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk -HOST_CONFIGURE_VARS += CC="$(HOSTCC_NOCACHE)" +CMAKE_HOST_OPTIONS += \ + -DCMAKE_C_COMPILER_LAUNCHER="" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="" define Host/Install/ccache $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/ $(CP) ./files/* $(STAGING_DIR_HOST)/bin/ endef -define Host/Clean - -$(MAKE) -C $(HOST_BUILD_DIR) uninstall - $(call Host/Clean/Default) -endef define Host/Install $(call Host/Install/Default) $(call Host/Install/ccache) diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index ccfa1c0247..e4045ef9be 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,10 +1,10 @@ ---- a/src/ccache.c -+++ b/src/ccache.c -@@ -2277,6 +2277,7 @@ calculate_object_hash(struct args *args, - "CPLUS_INCLUDE_PATH", - "OBJC_INCLUDE_PATH", - "OBJCPLUS_INCLUDE_PATH", // clang -+ "GCC_HONOUR_COPTS", - NULL - }; - for (const char **p = envvars; *p; ++p) { +--- a/src/ccache.cpp ++++ b/src/ccache.cpp +@@ -1654,6 +1654,7 @@ calculate_result_name(Context& ctx, + "CPLUS_INCLUDE_PATH", + "OBJC_INCLUDE_PATH", + "OBJCPLUS_INCLUDE_PATH", // clang ++ "GCC_HONOUR_COPTS", + nullptr}; + for (const char** p = envvars; *p; ++p) { + const char* v = getenv(*p); diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index dbd8ca4d1a..2b5a33450c 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -23,6 +23,7 @@ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +HOSTCC := $(HOSTCC_NOCACHE) HOST_CONFIGURE_ARGS += --enable-static --disable-shared --disable-tests HOST_CFLAGS += $(FPIC) diff --git a/tools/pkgconf/Makefile b/tools/pkgconf/Makefile index 7d785aae39..0f56de0e29 100644 --- a/tools/pkgconf/Makefile +++ b/tools/pkgconf/Makefile @@ -19,6 +19,8 @@ include $(INCLUDE_DIR)/host-build.mk unexport PKG_CONFIG +HOSTCC := $(HOSTCC_NOCACHE) + define Host/Install $(MAKE) -C $(HOST_BUILD_DIR) install mv $(STAGING_DIR_HOST)/bin/pkgconf $(STAGING_DIR_HOST)/bin/pkg-config.real diff --git a/tools/zstd/Makefile b/tools/zstd/Makefile index 7459725e8e..ec85362544 100644 --- a/tools/zstd/Makefile +++ b/tools/zstd/Makefile @@ -15,6 +15,7 @@ HOST_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/host-build.mk +HOSTCC := $(HOSTCC_NOCACHE) HOST_MAKE_FLAGS = PREFIX=$(HOST_BUILD_PREFIX) HAVE_ZLIB=0 HAVE_LZMA=0 HAVE_LZ4=0 $(eval $(call HostBuild))
Upstream switched to building with CMake. Adjust accordingly. Reapplied patch as upstream changed the file format. Added HOST_BUILD_PARALLEL for faster compilation. Added cmake tool dependency. Adjusted dependent tools to use NOCACHE as they are needed to build ccache. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- v3: zstd was missing in the commit for some reason v2: fix compilation issues without OS tools. tools/Makefile | 1 + tools/ccache/Makefile | 17 +++++++++-------- tools/ccache/patches/100-honour-copts.patch | 20 ++++++++++---------- tools/libressl/Makefile | 1 + tools/pkgconf/Makefile | 2 ++ tools/zstd/Makefile | 1 + 6 files changed, 24 insertions(+), 18 deletions(-)