diff mbox

Makefile: use locally built sparse in the selfcheck target

Message ID 10d6a020-ebe8-6a31-e4cb-ff67c1a1009c@ramsayjones.plus.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Ramsay Jones Nov. 9, 2017, 4:30 p.m. UTC
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Chris,

I was recently setting up a new system and didn't have sparse
installed. The 'make selfcheck' target failed ...

ATB,
Ramsay Jones

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luc Van Oostenryck Nov. 9, 2017, 5:06 p.m. UTC | #1
Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>


BTW, selfcheck also fails when reaching sparse-llvm.c because of
the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.

I suppose you don't have LLVM on the platform you use, no problem,
I just wanted to inform you about it.
It's already fixed on my series you just commented about.

Regards,
-- Luc Van Oostenryck
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Nov. 9, 2017, 5:37 p.m. UTC | #2
On 09/11/17 17:06, Luc Van Oostenryck wrote:
> 
> Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> 
> 
> BTW, selfcheck also fails when reaching sparse-llvm.c because of
> the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.

Hmm, I used to have LLVM installed on Linux as well as cygwin, but
I didn't install it the last time I did a 'nuke-n-pave' Linux
installation. (Linux Mint is much easier to upgrade these days, which
is to say it actually works now, but that wasn't always the case!).

On cygwin, sparse-llvm.c complains for a cygwin-only reason, so it
may be that those errors a hiding the ones you are seeing. I have been
meaning to get around to fix the cygwin problems.

What kind of errors are you seeing?

ATB,
Ramsay Jones

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Nov. 9, 2017, 5:43 p.m. UTC | #3
On Thu, Nov 9, 2017 at 6:37 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
>
> On 09/11/17 17:06, Luc Van Oostenryck wrote:
>>
>> Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
>>
>>
>> BTW, selfcheck also fails when reaching sparse-llvm.c because of
>> the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.
>
> Hmm, I used to have LLVM installed on Linux as well as cygwin, but
> I didn't install it the last time I did a 'nuke-n-pave' Linux
> installation. (Linux Mint is much easier to upgrade these days, which
> is to say it actually works now, but that wasn't always the case!).
>
> On cygwin, sparse-llvm.c complains for a cygwin-only reason, so it
> may be that those errors a hiding the ones you are seeing. I have been
> meaning to get around to fix the cygwin problems.
>
> What kind of errors are you seeing?

The specific error message is:
    sparse-llvm.c:6:11: error: unable to open 'llvm-c/Core.h'
but the cause is simply because the LLVM CFLAGS are used like:
    sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
but selfcheck/cgcc, correctly, doesn't know about BASIC_CFLAGS.

Chris should be already aware of it and is busy to cook a patch
changing the way the CFLAGS are used.

Regards,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Nov. 9, 2017, 5:48 p.m. UTC | #4
On Fri, Nov 10, 2017 at 12:30 AM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Chris,
>
> I was recently setting up a new system and didn't have sparse
> installed. The 'make selfcheck' target failed ...

Thanks for the patch, applied.

I haven't push it out just yet.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Nov. 9, 2017, 5:55 p.m. UTC | #5
On 09/11/17 17:43, Luc Van Oostenryck wrote:
> On Thu, Nov 9, 2017 at 6:37 PM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>
>>
>> On 09/11/17 17:06, Luc Van Oostenryck wrote:
>>>
>>> Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
>>>
>>>
>>> BTW, selfcheck also fails when reaching sparse-llvm.c because of
>>> the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.
>>
>> Hmm, I used to have LLVM installed on Linux as well as cygwin, but
>> I didn't install it the last time I did a 'nuke-n-pave' Linux
>> installation. (Linux Mint is much easier to upgrade these days, which
>> is to say it actually works now, but that wasn't always the case!).
>>
>> On cygwin, sparse-llvm.c complains for a cygwin-only reason, so it
>> may be that those errors a hiding the ones you are seeing. I have been
>> meaning to get around to fix the cygwin problems.
>>
>> What kind of errors are you seeing?
> 
> The specific error message is:
>     sparse-llvm.c:6:11: error: unable to open 'llvm-c/Core.h'
> but the cause is simply because the LLVM CFLAGS are used like:
>     sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
> but selfcheck/cgcc, correctly, doesn't know about BASIC_CFLAGS.

Hmm, that doesn't make much sense - the selfcheck target uses
the $(ALL_CFLAGS), just like the '%.o %.c' target. So, if the
file is compiled by gcc, then cgcc should have the same flags
(plus some sparse specific flags).

[This is the Makefile on the master branch @ c408da2].

puzzled ...

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Nov. 9, 2017, 5:57 p.m. UTC | #6
On Fri, Nov 10, 2017 at 1:55 AM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>> The specific error message is:
>>     sparse-llvm.c:6:11: error: unable to open 'llvm-c/Core.h'
>> but the cause is simply because the LLVM CFLAGS are used like:
>>     sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
>> but selfcheck/cgcc, correctly, doesn't know about BASIC_CFLAGS.
>
> Hmm, that doesn't make much sense - the selfcheck target uses
> the $(ALL_CFLAGS), just like the '%.o %.c' target. So, if the

Right. But selfcheck using *.sc target.

So the likely fix is just:
sparse-llvm.o sparse-llvm.sc: XXX_CFLAGS += $(LLVM_CFLAGS)

I am looking at this right now.

Interesting enough, on my FC 26 it is not triggering the header
file error.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Nov. 9, 2017, 6:03 p.m. UTC | #7
On 09/11/17 17:55, Ramsay Jones wrote:
> 
> 
> On 09/11/17 17:43, Luc Van Oostenryck wrote:
>> On Thu, Nov 9, 2017 at 6:37 PM, Ramsay Jones
>> <ramsay@ramsayjones.plus.com> wrote:
>>>
>>>
>>> On 09/11/17 17:06, Luc Van Oostenryck wrote:
>>>>
>>>> Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
>>>>
>>>>
>>>> BTW, selfcheck also fails when reaching sparse-llvm.c because of
>>>> the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.
>>>
>>> Hmm, I used to have LLVM installed on Linux as well as cygwin, but
>>> I didn't install it the last time I did a 'nuke-n-pave' Linux
>>> installation. (Linux Mint is much easier to upgrade these days, which
>>> is to say it actually works now, but that wasn't always the case!).
>>>
>>> On cygwin, sparse-llvm.c complains for a cygwin-only reason, so it
>>> may be that those errors a hiding the ones you are seeing. I have been
>>> meaning to get around to fix the cygwin problems.
>>>
>>> What kind of errors are you seeing?
>>
>> The specific error message is:
>>     sparse-llvm.c:6:11: error: unable to open 'llvm-c/Core.h'
>> but the cause is simply because the LLVM CFLAGS are used like:
>>     sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
>> but selfcheck/cgcc, correctly, doesn't know about BASIC_CFLAGS.
> 
> Hmm, that doesn't make much sense - the selfcheck target uses
> the $(ALL_CFLAGS), just like the '%.o %.c' target. So, if the
> file is compiled by gcc, then cgcc should have the same flags
> (plus some sparse specific flags).
> 
> [This is the Makefile on the master branch @ c408da2].
> 
> puzzled ...

Ah, no longer puzzled. Hmm, didn't there used to be a rule like:

sparse-llvm.o sparse-llvm.sc: BASIC_CFLAGS += $(LLVM_CFLAGS)

this?

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christopher Li Nov. 9, 2017, 6:09 p.m. UTC | #8
On Fri, Nov 10, 2017 at 2:03 AM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
> Ah, no longer puzzled. Hmm, didn't there used to be a rule like:
>
> sparse-llvm.o sparse-llvm.sc: BASIC_CFLAGS += $(LLVM_CFLAGS)
>

I search the history. Nope, I miss that when I add the selfcheck.
I did not catch this error because on FC26 missing the LLVM_CFLAGS
does not cause compile error.

$ llvm-config --cflags
-I/usr/include -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
-fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings
-Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment
-Werror=date-time -ffunction-sections -fdata-sections -O2 -g -DNDEBUG
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS

"llvm-config --cflags" does not introduce new header file searching directory.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ramsay Jones Nov. 9, 2017, 6:32 p.m. UTC | #9
On 09/11/17 18:09, Christopher Li wrote:
> On Fri, Nov 10, 2017 at 2:03 AM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>
>> Ah, no longer puzzled. Hmm, didn't there used to be a rule like:
>>
>> sparse-llvm.o sparse-llvm.sc: BASIC_CFLAGS += $(LLVM_CFLAGS)
>>
> 
> I search the history. Nope, I miss that when I add the selfcheck.
> I did not catch this error because on FC26 missing the LLVM_CFLAGS
> does not cause compile error.

Heh, our emails crossed.

> 
> $ llvm-config --cflags
> -I/usr/include -O2 -g -pipe -Wall -Werror=format-security
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
> --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
> -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings
> -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment
> -Werror=date-time -ffunction-sections -fdata-sections -O2 -g -DNDEBUG
> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
> -D__STDC_LIMIT_MACROS
> 
> "llvm-config --cflags" does not introduce new header file searching directory.

Ah, OK.

So, 'llvm-config --cflags' produces different output on
whichever platform Luc is on?

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Nov. 9, 2017, 6:32 p.m. UTC | #10
On Thu, Nov 9, 2017 at 7:03 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
>
> On 09/11/17 17:55, Ramsay Jones wrote:
>>
>>
>> On 09/11/17 17:43, Luc Van Oostenryck wrote:
>>> On Thu, Nov 9, 2017 at 6:37 PM, Ramsay Jones
>>> <ramsay@ramsayjones.plus.com> wrote:
>>>>
>>>>
>>>> On 09/11/17 17:06, Luc Van Oostenryck wrote:
>>>>>
>>>>> Acked-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
>>>>>
>>>>>
>>>>> BTW, selfcheck also fails when reaching sparse-llvm.c because of
>>>>> the use of CFLAGS/BASIC_CFLAGS/ALL_CFLAGS/COMMON_CFLAGS/PKG_CFLAGS.
>>>>
>>>> Hmm, I used to have LLVM installed on Linux as well as cygwin, but
>>>> I didn't install it the last time I did a 'nuke-n-pave' Linux
>>>> installation. (Linux Mint is much easier to upgrade these days, which
>>>> is to say it actually works now, but that wasn't always the case!).
>>>>
>>>> On cygwin, sparse-llvm.c complains for a cygwin-only reason, so it
>>>> may be that those errors a hiding the ones you are seeing. I have been
>>>> meaning to get around to fix the cygwin problems.
>>>>
>>>> What kind of errors are you seeing?
>>>
>>> The specific error message is:
>>>     sparse-llvm.c:6:11: error: unable to open 'llvm-c/Core.h'
>>> but the cause is simply because the LLVM CFLAGS are used like:
>>>     sparse-llvm.o: BASIC_CFLAGS += $(LLVM_CFLAGS)
>>> but selfcheck/cgcc, correctly, doesn't know about BASIC_CFLAGS.
>>
>> Hmm, that doesn't make much sense - the selfcheck target uses
>> the $(ALL_CFLAGS), just like the '%.o %.c' target. So, if the
>> file is compiled by gcc, then cgcc should have the same flags
>> (plus some sparse specific flags).
>>
>> [This is the Makefile on the master branch @ c408da2].
>>
>> puzzled ...
>
> Ah, no longer puzzled. Hmm, didn't there used to be a rule like:
>
> sparse-llvm.o sparse-llvm.sc: BASIC_CFLAGS += $(LLVM_CFLAGS)
>
> this?

Yes, for example.

-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luc Van Oostenryck Nov. 11, 2017, 2:44 p.m. UTC | #11
On Thu, Nov 9, 2017 at 7:32 PM, Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>>
>> $ llvm-config --cflags
>> -I/usr/include -O2 -g -pipe -Wall -Werror=format-security
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
>> --param=ssp-buffer-size=4 -grecord-gcc-switches
>> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
>> -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings
>> -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment
>> -Werror=date-time -ffunction-sections -fdata-sections -O2 -g -DNDEBUG
>> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
>> -D__STDC_LIMIT_MACROS
>>
>> "llvm-config --cflags" does not introduce new header file searching directory.
>
> Ah, OK.
>
> So, 'llvm-config --cflags' produces different output on
> whichever platform Luc is on?

Usually, I have nothing (of interest) in /usr since most of my stuff
is installed in somewhere in $HOME or /opt.

Regards,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d034176..d1a303e 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@  LDFLAGS += -g
 LD = gcc
 AR = ar
 PKG_CONFIG = pkg-config
-CHECKER = ./cgcc -no-compile
+CHECKER = CHECK=./sparse ./cgcc -no-compile
 CHECKER_FLAGS =
 
 ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)