diff mbox

kconfig: Check for libncurses before menuconfig

Message ID 20170409130708.4753-1-bp@alien8.de (mailing list archive)
State New, archived
Headers show

Commit Message

Borislav Petkov April 9, 2017, 1:07 p.m. UTC
From: Borislav Petkov <bp@suse.de>

There is a check and a nice user-friendly message when the curses
library is not present on the system and the user wants to do "make
menuconfig". It doesn't get issued, though. Instead, we fail the build
when mconf.c doesn't find the curses.h header:

    HOSTCC  scripts/kconfig/mconf.o
  In file included from scripts/kconfig/mconf.c:23:0:
  scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
   #include CURSES_LOC
                      ^
  compilation terminated.

Make that check a prerequisite to mconf so that the user sees the error
message instead:

  $ make menuconfig
   *** Unable to find the ncurses libraries or the
   *** required header files.
   *** 'make menuconfig' requires the ncurses libraries.
   ***
   *** Install ncurses (ncurses-devel) and try again.
   ***
  scripts/kconfig/Makefile:203: recipe for target 'scripts/kconfig/dochecklxdialog' failed
  make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
  Makefile:548: recipe for target 'menuconfig' failed
  make: *** [menuconfig] Error 2

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild@vger.kernel.org
---
 scripts/kconfig/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Comments

Masahiro Yamada May 20, 2017, 7:38 p.m. UTC | #1
Hi Borislav,


2017-04-09 22:07 GMT+09:00 Borislav Petkov <bp@alien8.de>:
> From: Borislav Petkov <bp@suse.de>
>
> There is a check and a nice user-friendly message when the curses
> library is not present on the system and the user wants to do "make
> menuconfig". It doesn't get issued, though. Instead, we fail the build
> when mconf.c doesn't find the curses.h header:
>
>     HOSTCC  scripts/kconfig/mconf.o
>   In file included from scripts/kconfig/mconf.c:23:0:
>   scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
>    #include CURSES_LOC
>                       ^
>   compilation terminated.


Strange, I could not reproduce this.

As far as I tested,
"make menuconfig" invoked dochecklxdialog without this patch.



mconf depends on $(lxdiaglog) at line 184:
mconf-objs     := mconf.o zconf.tab.o $(lxdialog)


$(lxdialog) depends on dochecklxdialog at line 199:
$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog




> Make that check a prerequisite to mconf so that the user sees the error
> message instead:
>
>   $ make menuconfig
>    *** Unable to find the ncurses libraries or the
>    *** required header files.
>    *** 'make menuconfig' requires the ncurses libraries.
>    ***
>    *** Install ncurses (ncurses-devel) and try again.
>    ***
>   scripts/kconfig/Makefile:203: recipe for target 'scripts/kconfig/dochecklxdialog' failed
>   make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
>   Makefile:548: recipe for target 'menuconfig' failed
>   make: *** [menuconfig] Error 2
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: linux-kbuild@vger.kernel.org
> ---
>  scripts/kconfig/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 90a091b6ae4d..e58220ce65b9 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -24,6 +24,8 @@ xconfig: $(obj)/qconf
>  gconfig: $(obj)/gconf
>         $< $(silent) $(Kconfig)
>
> +$(obj)/mconf: $(obj)/dochecklxdialog
> +
>  menuconfig: $(obj)/mconf
>         $< $(silent) $(Kconfig)
>
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Borislav Petkov May 20, 2017, 8:33 p.m. UTC | #2
On Sun, May 21, 2017 at 04:38:35AM +0900, Masahiro Yamada wrote:
> Strange, I could not reproduce this.

Remove libncurses5-dev or whatever it is called on your system and do:

$ make menuconfig
  HOSTCC  scripts/kconfig/mconf.o
In file included from scripts/kconfig/mconf.c:23:0:
scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
 #include CURSES_LOC
                    ^
compilation terminated.
scripts/Makefile.host:124: recipe for target 'scripts/kconfig/mconf.o' failed
make[1]: *** [scripts/kconfig/mconf.o] Error 1
Makefile:548: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2
Masahiro Yamada May 21, 2017, 9:15 a.m. UTC | #3
Hi Borislav,


2017-05-21 5:33 GMT+09:00 Borislav Petkov <bp@alien8.de>:
> On Sun, May 21, 2017 at 04:38:35AM +0900, Masahiro Yamada wrote:
>> Strange, I could not reproduce this.
>
> Remove libncurses5-dev or whatever it is called on your system and do:
>
> $ make menuconfig
>   HOSTCC  scripts/kconfig/mconf.o
> In file included from scripts/kconfig/mconf.c:23:0:
> scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
>  #include CURSES_LOC
>                     ^
> compilation terminated.
> scripts/Makefile.host:124: recipe for target 'scripts/kconfig/mconf.o' failed
> make[1]: *** [scripts/kconfig/mconf.o] Error 1
> Makefile:548: recipe for target 'menuconfig' failed
> make: *** [menuconfig] Error 2


OK, I see.

So, it is $(obj)/mconf.o instead of $(obj)/mconf
that should depend on $(obj)/dochecklxdialog.


Could you change line 199

  $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog

to

  $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog

and send v2, please?


This will make sure dochecklxdialog is run before compiling mconf.o
in parallel building.


Thanks!
diff mbox

Patch

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 90a091b6ae4d..e58220ce65b9 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -24,6 +24,8 @@  xconfig: $(obj)/qconf
 gconfig: $(obj)/gconf
 	$< $(silent) $(Kconfig)
 
+$(obj)/mconf: $(obj)/dochecklxdialog
+
 menuconfig: $(obj)/mconf
 	$< $(silent) $(Kconfig)