diff mbox series

tools: zlib: fix broken compile with ccache enabled

Message ID 20201217235900.4824-1-ansuelsmth@gmail.com
State Rejected
Delegated to: Petr Štetiar
Headers show
Series tools: zlib: fix broken compile with ccache enabled | expand

Commit Message

Christian Marangi Dec. 17, 2020, 11:59 p.m. UTC
If ccache is enabled with an empty buildroot the compilation fails. Fix
this by using the NOCACHE compiler as it's done by other tools package.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 tools/zlib/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Christian Marangi Dec. 18, 2020, 12:10 a.m. UTC | #1
> -----Messaggio originale-----
> Da: Ansuel Smith <ansuelsmth@gmail.com>
> Inviato: venerdì 18 dicembre 2020 00:59
> A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> Cc: Ansuel Smith <ansuelsmth@gmail.com>
> Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> 
> If ccache is enabled with an empty buildroot the compilation fails. Fix
> this by using the NOCACHE compiler as it's done by other tools package.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
>  tools/zlib/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> index 279851f..5dc311d 100644
> --- a/tools/zlib/Makefile
> +++ b/tools/zlib/Makefile
> @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>  include $(INCLUDE_DIR)/host-build.mk
>  include $(INCLUDE_DIR)/cmake.mk
> 
> +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
>  HOST_CFLAGS +=-fPIC
> 
>  define Host/Install
> --
> 2.29.2

Ignore, it seems it cause other problem with cmake?
Rosen Penev Dec. 18, 2020, 1:10 a.m. UTC | #2
On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
>
>
>
> > -----Messaggio originale-----
> > Da: Ansuel Smith <ansuelsmth@gmail.com>
> > Inviato: venerdì 18 dicembre 2020 00:59
> > A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> > Cc: Ansuel Smith <ansuelsmth@gmail.com>
> > Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> >
> > If ccache is enabled with an empty buildroot the compilation fails. Fix
> > this by using the NOCACHE compiler as it's done by other tools package.
> >
> > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > ---
> >  tools/zlib/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> > index 279851f..5dc311d 100644
> > --- a/tools/zlib/Makefile
> > +++ b/tools/zlib/Makefile
> > @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
> >  include $(INCLUDE_DIR)/host-build.mk
> >  include $(INCLUDE_DIR)/cmake.mk
> >
> > +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
> >  HOST_CFLAGS +=-fPIC
> >
> >  define Host/Install
> > --
> > 2.29.2
>
> Ignore, it seems it cause other problem with cmake?
You're missing -D and CMAKE_HOST_OPTIONS.

I submitted a patch that fixes this. Tested on Fedora 33.
>
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Christian Marangi Dec. 18, 2020, 1:15 a.m. UTC | #3
> On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
> >
> >
> >
> > > -----Messaggio originale-----
> > > Da: Ansuel Smith <ansuelsmth@gmail.com>
> > > Inviato: venerdì 18 dicembre 2020 00:59
> > > A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> > > Cc: Ansuel Smith <ansuelsmth@gmail.com>
> > > Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> > >
> > > If ccache is enabled with an empty buildroot the compilation fails. Fix
> > > this by using the NOCACHE compiler as it's done by other tools package.
> > >
> > > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > > ---
> > >  tools/zlib/Makefile | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> > > index 279851f..5dc311d 100644
> > > --- a/tools/zlib/Makefile
> > > +++ b/tools/zlib/Makefile
> > > @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
> > >  include $(INCLUDE_DIR)/host-build.mk
> > >  include $(INCLUDE_DIR)/cmake.mk
> > >
> > > +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
> > >  HOST_CFLAGS +=-fPIC
> > >
> > >  define Host/Install
> > > --
> > > 2.29.2
> >
> > Ignore, it seems it cause other problem with cmake?
> You're missing -D and CMAKE_HOST_OPTIONS.
> 
> I submitted a patch that fixes this. Tested on Fedora 33.

I'm testing this with the other package. I could be very wrong but it
seems that ccache is just broken with cmake. My current implementation
is a variable CMAKE_NOCCACHE that disable the use of ccache for that
package. For now I found that this is needed for both the host build and the
pkg build. (libubox, opkg, libjson-c affected) Can you check if you can
compile that package with not problem with your implementation. Just
to make sure I'm not making things wrong.

> >
> >
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Rosen Penev Dec. 18, 2020, 1:25 a.m. UTC | #4
On Thu, Dec 17, 2020 at 5:15 PM <ansuelsmth@gmail.com> wrote:
>
> > On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
> > >
> > >
> > >
> > > > -----Messaggio originale-----
> > > > Da: Ansuel Smith <ansuelsmth@gmail.com>
> > > > Inviato: venerdì 18 dicembre 2020 00:59
> > > > A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> > > > Cc: Ansuel Smith <ansuelsmth@gmail.com>
> > > > Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> > > >
> > > > If ccache is enabled with an empty buildroot the compilation fails. Fix
> > > > this by using the NOCACHE compiler as it's done by other tools package.
> > > >
> > > > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > > > ---
> > > >  tools/zlib/Makefile | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> > > > index 279851f..5dc311d 100644
> > > > --- a/tools/zlib/Makefile
> > > > +++ b/tools/zlib/Makefile
> > > > @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
> > > >  include $(INCLUDE_DIR)/host-build.mk
> > > >  include $(INCLUDE_DIR)/cmake.mk
> > > >
> > > > +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
> > > >  HOST_CFLAGS +=-fPIC
> > > >
> > > >  define Host/Install
> > > > --
> > > > 2.29.2
> > >
> > > Ignore, it seems it cause other problem with cmake?
> > You're missing -D and CMAKE_HOST_OPTIONS.
> >
> > I submitted a patch that fixes this. Tested on Fedora 33.
>
> I'm testing this with the other package. I could be very wrong but it
> seems that ccache is just broken with cmake. My current implementation
> is a variable CMAKE_NOCCACHE that disable the use of ccache for that
> package. For now I found that this is needed for both the host build and the
> pkg build. (libubox, opkg, libjson-c affected) Can you check if you can
> compile that package with not problem with your implementation. Just
> to make sure I'm not making things wrong.
Looks like this is not right either.

That cmake bump is what broke ccache.

More info: https://github.com/openwrt/openwrt/commit/bfc433efd4a0c6875a92981d1bd2a5e3e60c61c6#commitcomment-45228331
>
> > >
> > >
> > >
> > > _______________________________________________
> > > openwrt-devel mailing list
> > > openwrt-devel@lists.openwrt.org
> > > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Christian Marangi Dec. 18, 2020, 1:33 a.m. UTC | #5
> On Thu, Dec 17, 2020 at 5:15 PM <ansuelsmth@gmail.com> wrote:
> >
> > > On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
> > > >
> > > >
> > > >
> > > > > -----Messaggio originale-----
> > > > > Da: Ansuel Smith <ansuelsmth@gmail.com>
> > > > > Inviato: venerdì 18 dicembre 2020 00:59
> > > > > A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> > > > > Cc: Ansuel Smith <ansuelsmth@gmail.com>
> > > > > Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> > > > >
> > > > > If ccache is enabled with an empty buildroot the compilation fails. Fix
> > > > > this by using the NOCACHE compiler as it's done by other tools package.
> > > > >
> > > > > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > > > > ---
> > > > >  tools/zlib/Makefile | 1 +
> > > > >  1 file changed, 1 insertion(+)
> > > > >
> > > > > diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> > > > > index 279851f..5dc311d 100644
> > > > > --- a/tools/zlib/Makefile
> > > > > +++ b/tools/zlib/Makefile
> > > > > @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
> > > > >  include $(INCLUDE_DIR)/host-build.mk
> > > > >  include $(INCLUDE_DIR)/cmake.mk
> > > > >
> > > > > +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
> > > > >  HOST_CFLAGS +=-fPIC
> > > > >
> > > > >  define Host/Install
> > > > > --
> > > > > 2.29.2
> > > >
> > > > Ignore, it seems it cause other problem with cmake?
> > > You're missing -D and CMAKE_HOST_OPTIONS.
> > >
> > > I submitted a patch that fixes this. Tested on Fedora 33.
> >
> > I'm testing this with the other package. I could be very wrong but it
> > seems that ccache is just broken with cmake. My current implementation
> > is a variable CMAKE_NOCCACHE that disable the use of ccache for that
> > package. For now I found that this is needed for both the host build and the
> > pkg build. (libubox, opkg, libjson-c affected) Can you check if you can
> > compile that package with not problem with your implementation. Just
> > to make sure I'm not making things wrong.
> Looks like this is not right either.
> 
> That cmake bump is what broke ccache.
> 
> More info:
> https://github.com/openwrt/openwrt/commit/bfc433efd4a0c6875a92981d1bd
> 2a5e3e60c61c6#commitcomment-45228331
> 

Can confirm that the proposed change in the comment fix the problem and pkg that
use cmake are compiled.
Hannu Nyman Dec. 18, 2020, 9:43 a.m. UTC | #6
Rosen Penev kirjoitti 18.12.2020 klo 3.25:
> On Thu, Dec 17, 2020 at 5:15 PM <ansuelsmth@gmail.com> wrote:
>>> On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
>>>>
>>>>
>>>>> -----Messaggio originale-----
>>>>> Da: Ansuel Smith <ansuelsmth@gmail.com>
>>>>> Inviato: venerdì 18 dicembre 2020 00:59
>>>>> A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
>>>>> Cc: Ansuel Smith <ansuelsmth@gmail.com>
>>>>> Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
>>>>>
>>>>> If ccache is enabled with an empty buildroot the compilation fails. Fix
>>>>> this by using the NOCACHE compiler as it's done by other tools package.
>>>>>
>>>>> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
>>>>> ---
>>>>>   tools/zlib/Makefile | 1 +
>>>>>   1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
>>>>> index 279851f..5dc311d 100644
>>>>> --- a/tools/zlib/Makefile
>>>>> +++ b/tools/zlib/Makefile
>>>>> @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>>>>>   include $(INCLUDE_DIR)/host-build.mk
>>>>>   include $(INCLUDE_DIR)/cmake.mk
>>>>>
>>>>> +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
>>>>>   HOST_CFLAGS +=-fPIC
>>>>>
>>>>>   define Host/Install
>>>>> --
>>>>> 2.29.2
>>>> Ignore, it seems it cause other problem with cmake?
>>> You're missing -D and CMAKE_HOST_OPTIONS.
>>>
>>> I submitted a patch that fixes this. Tested on Fedora 33.
>> I'm testing this with the other package. I could be very wrong but it
>> seems that ccache is just broken with cmake. My current implementation
>> is a variable CMAKE_NOCCACHE that disable the use of ccache for that
>> package. For now I found that this is needed for both the host build and the
>> pkg build. (libubox, opkg, libjson-c affected) Can you check if you can
>> compile that package with not problem with your implementation. Just
>> to make sure I'm not making things wrong.
> Looks like this is not right either.
>
> That cmake bump is what broke ccache.
>
> More info: https://github.com/openwrt/openwrt/commit/bfc433efd4a0c6875a92981d1bd2a5e3e60c61c6#commitcomment-45228331


Note that we are also using an outdated version of ccache.

ccache has last been updated to version 3.7.11 in August 2020 (by me).

There is now already version 4.1 of ccache available.
That might possibly help with zlib.

Release notes of ccache 4.0 an 4.1 contain some cmake references.
https://ccache.dev/releasenotes.html#_ccache_4_1
Rosen Penev Dec. 18, 2020, 11:24 p.m. UTC | #7
On Fri, Dec 18, 2020 at 1:43 AM Hannu Nyman <hannu.nyman@iki.fi> wrote:
>
> Rosen Penev kirjoitti 18.12.2020 klo 3.25:
> > On Thu, Dec 17, 2020 at 5:15 PM <ansuelsmth@gmail.com> wrote:
> >>> On Thu, Dec 17, 2020 at 4:13 PM <ansuelsmth@gmail.com> wrote:
> >>>>
> >>>>
> >>>>> -----Messaggio originale-----
> >>>>> Da: Ansuel Smith <ansuelsmth@gmail.com>
> >>>>> Inviato: venerdì 18 dicembre 2020 00:59
> >>>>> A: OpenWrt Development List <openwrt-devel@lists.openwrt.org>
> >>>>> Cc: Ansuel Smith <ansuelsmth@gmail.com>
> >>>>> Oggetto: [PATCH] tools: zlib: fix broken compile with ccache enabled
> >>>>>
> >>>>> If ccache is enabled with an empty buildroot the compilation fails. Fix
> >>>>> this by using the NOCACHE compiler as it's done by other tools package.
> >>>>>
> >>>>> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> >>>>> ---
> >>>>>   tools/zlib/Makefile | 1 +
> >>>>>   1 file changed, 1 insertion(+)
> >>>>>
> >>>>> diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
> >>>>> index 279851f..5dc311d 100644
> >>>>> --- a/tools/zlib/Makefile
> >>>>> +++ b/tools/zlib/Makefile
> >>>>> @@ -22,6 +22,7 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
> >>>>>   include $(INCLUDE_DIR)/host-build.mk
> >>>>>   include $(INCLUDE_DIR)/cmake.mk
> >>>>>
> >>>>> +CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
> >>>>>   HOST_CFLAGS +=-fPIC
> >>>>>
> >>>>>   define Host/Install
> >>>>> --
> >>>>> 2.29.2
> >>>> Ignore, it seems it cause other problem with cmake?
> >>> You're missing -D and CMAKE_HOST_OPTIONS.
> >>>
> >>> I submitted a patch that fixes this. Tested on Fedora 33.
> >> I'm testing this with the other package. I could be very wrong but it
> >> seems that ccache is just broken with cmake. My current implementation
> >> is a variable CMAKE_NOCCACHE that disable the use of ccache for that
> >> package. For now I found that this is needed for both the host build and the
> >> pkg build. (libubox, opkg, libjson-c affected) Can you check if you can
> >> compile that package with not problem with your implementation. Just
> >> to make sure I'm not making things wrong.
> > Looks like this is not right either.
> >
> > That cmake bump is what broke ccache.
> >
> > More info: https://github.com/openwrt/openwrt/commit/bfc433efd4a0c6875a92981d1bd2a5e3e60c61c6#commitcomment-45228331
>
>
> Note that we are also using an outdated version of ccache.
>
> ccache has last been updated to version 3.7.11 in August 2020 (by me).
>
> There is now already version 4.1 of ccache available.
> That might possibly help with zlib.
>
> Release notes of ccache 4.0 an 4.1 contain some cmake references.
> https://ccache.dev/releasenotes.html#_ccache_4_1
Those have nothing to do with this failure.

There was a diff that fixed the issue. I'll post it as a patch.
>
>
diff mbox series

Patch

diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
index 279851f..5dc311d 100644
--- a/tools/zlib/Makefile
+++ b/tools/zlib/Makefile
@@ -22,6 +22,7 @@  PKG_CPE_ID:=cpe:/a:gnu:zlib
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/cmake.mk
 
+CMAKE_HOST_C_COMPILER:=$(HOSTCC_NOCACHE)
 HOST_CFLAGS +=-fPIC
 
 define Host/Install