Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
@ 2024-04-03 12:18 Robert Marko
  2024-04-03 16:28 ` Petr Vorel
  2024-04-08 20:36 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 9+ messages in thread
From: Robert Marko @ 2024-04-03 12:18 UTC (permalink / raw)
  To: buildroot; +Cc: Petr Vorel, Robert Marko

GCC14 now treats implicit int types as error so when check() from
check-lxdialog.sh is called to check whether we can link against ncurses
it will fail silently and the help text indicating to install ncurses is
printed.

However, this is not due to missing ncurses but once the stderr redirect
to /dev/null is removed we can see the root cause:
<stdin>:2:1: error: return type defaults to ‘int’ [-Wimplicit-int]

So, in order for menuconfig to work with GCC14 lets just specify the
return type of main() as int.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 support/kconfig/lxdialog/check-lxdialog.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/kconfig/lxdialog/check-lxdialog.sh b/support/kconfig/lxdialog/check-lxdialog.sh
index 16cd9a3186..27d6c30a57 100755
--- a/support/kconfig/lxdialog/check-lxdialog.sh
+++ b/support/kconfig/lxdialog/check-lxdialog.sh
@@ -48,7 +48,7 @@ trap "rm -f $tmp" 0 1 2 3 15
 check() {
         $cc -x c - -o $tmp 2>/dev/null <<'EOF'
 #include CURSES_LOC
-main() {}
+int main() {}
 EOF
 	if [ $? != 0 ]; then
 	    echo " *** Unable to find the ncurses libraries or the"       1>&2
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-03 12:18 [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14 Robert Marko
@ 2024-04-03 16:28 ` Petr Vorel
  2024-04-08 20:36 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2024-04-03 16:28 UTC (permalink / raw)
  To: Robert Marko; +Cc: Yann E. MORIN, buildroot

Hi Robert,

> GCC14 now treats implicit int types as error so when check() from
> check-lxdialog.sh is called to check whether we can link against ncurses
> it will fail silently and the help text indicating to install ncurses is
> printed.

> However, this is not due to missing ncurses but once the stderr redirect
> to /dev/null is removed we can see the root cause:
> <stdin>:2:1: error: return type defaults to ‘int’ [-Wimplicit-int]

> So, in order for menuconfig to work with GCC14 lets just specify the
> return type of main() as int.

Good catch. Not only gcc-14, but also clang-16 fails due -Wimplicit-int.
(clang-14 was ok).

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Tested-by: Petr Vorel <petr.vorel@gmail.com>

Kind regards,
Petr

> Signed-off-by: Robert Marko <robimarko@gmail.com>
> ---
>  support/kconfig/lxdialog/check-lxdialog.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/support/kconfig/lxdialog/check-lxdialog.sh b/support/kconfig/lxdialog/check-lxdialog.sh
> index 16cd9a3186..27d6c30a57 100755
> --- a/support/kconfig/lxdialog/check-lxdialog.sh
> +++ b/support/kconfig/lxdialog/check-lxdialog.sh
> @@ -48,7 +48,7 @@ trap "rm -f $tmp" 0 1 2 3 15
>  check() {
>          $cc -x c - -o $tmp 2>/dev/null <<'EOF'
>  #include CURSES_LOC
> -main() {}
> +int main() {}
>  EOF
>  	if [ $? != 0 ]; then
>  	    echo " *** Unable to find the ncurses libraries or the"       1>&2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-03 12:18 [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14 Robert Marko
  2024-04-03 16:28 ` Petr Vorel
@ 2024-04-08 20:36 ` Thomas Petazzoni via buildroot
  2024-04-08 21:15   ` Robert Marko
  2024-04-08 21:38   ` Petr Vorel
  1 sibling, 2 replies; 9+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-04-08 20:36 UTC (permalink / raw)
  To: Robert Marko; +Cc: Petr Vorel, buildroot

Hello Robert,

On Wed,  3 Apr 2024 14:18:07 +0200
Robert Marko <robimarko@gmail.com> wrote:

> GCC14 now treats implicit int types as error so when check() from
> check-lxdialog.sh is called to check whether we can link against ncurses
> it will fail silently and the help text indicating to install ncurses is
> printed.
> 
> However, this is not due to missing ncurses but once the stderr redirect
> to /dev/null is removed we can see the root cause:
> <stdin>:2:1: error: return type defaults to ‘int’ [-Wimplicit-int]
> 
> So, in order for menuconfig to work with GCC14 lets just specify the
> return type of main() as int.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>

Thanks a lot for the patch. However, making changes in support/kconfig/
in Buildroot requires a bit more care. Indeed, this code is taken from
the Linux kernel code, and we try to keep a well-defined list of
changes on top of the original code from the kernel.

As explained in support/kconfig/README.buildroot, the current code in
support/kconfig/ is taken from Linux 4.17-rc2, on top of which the
patches in support/kconfig/patches/ have been applied.

So from this, you have two options:

(1) Add a new patch in support/kconfig/patches/ which implements the
    change you need for GCC14 compatibility

(2) Update the code in support/kconfig/ to the latest code available in
    the Linux kernel scripts/kconfig directory, rebase our patches, and
    verify it all works.

Obviously, (1) is the easiest path. (2) is nicer long term, as we
benefit from all new features/fixes added by the Linux kernel
developers. Turns out that in the upstream kernel, the
check-lxdialog.sh script has been removed and replaced by something
different, which no longer has this main() function definition.

Could you have a look at implementing either (1) or (2) ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-08 20:36 ` Thomas Petazzoni via buildroot
@ 2024-04-08 21:15   ` Robert Marko
  2024-04-08 21:38   ` Petr Vorel
  1 sibling, 0 replies; 9+ messages in thread
From: Robert Marko @ 2024-04-08 21:15 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Petr Vorel, buildroot

On Mon, 8 Apr 2024 at 22:36, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Robert,
>
> On Wed,  3 Apr 2024 14:18:07 +0200
> Robert Marko <robimarko@gmail.com> wrote:
>
> > GCC14 now treats implicit int types as error so when check() from
> > check-lxdialog.sh is called to check whether we can link against ncurses
> > it will fail silently and the help text indicating to install ncurses is
> > printed.
> >
> > However, this is not due to missing ncurses but once the stderr redirect
> > to /dev/null is removed we can see the root cause:
> > <stdin>:2:1: error: return type defaults to ‘int’ [-Wimplicit-int]
> >
> > So, in order for menuconfig to work with GCC14 lets just specify the
> > return type of main() as int.
> >
> > Signed-off-by: Robert Marko <robimarko@gmail.com>
>
> Thanks a lot for the patch. However, making changes in support/kconfig/
> in Buildroot requires a bit more care. Indeed, this code is taken from
> the Linux kernel code, and we try to keep a well-defined list of
> changes on top of the original code from the kernel.
>
> As explained in support/kconfig/README.buildroot, the current code in
> support/kconfig/ is taken from Linux 4.17-rc2, on top of which the
> patches in support/kconfig/patches/ have been applied.
>
> So from this, you have two options:
>
> (1) Add a new patch in support/kconfig/patches/ which implements the
>     change you need for GCC14 compatibility
>
> (2) Update the code in support/kconfig/ to the latest code available in
>     the Linux kernel scripts/kconfig directory, rebase our patches, and
>     verify it all works.
>
> Obviously, (1) is the easiest path. (2) is nicer long term, as we
> benefit from all new features/fixes added by the Linux kernel
> developers. Turns out that in the upstream kernel, the
> check-lxdialog.sh script has been removed and replaced by something
> different, which no longer has this main() function definition.
>
> Could you have a look at implementing either (1) or (2) ?

Hi Thomas,
I can only implement solution 1 currently, will respin for v2.

Regards,
Robert

>
> Thanks a lot!
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-08 20:36 ` Thomas Petazzoni via buildroot
  2024-04-08 21:15   ` Robert Marko
@ 2024-04-08 21:38   ` Petr Vorel
  2024-04-09 19:46     ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2024-04-08 21:38 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Robert Marko, buildroot

Hi Robert, Thomas,

> Hello Robert,

> On Wed,  3 Apr 2024 14:18:07 +0200
> Robert Marko <robimarko@gmail.com> wrote:

> > GCC14 now treats implicit int types as error so when check() from
> > check-lxdialog.sh is called to check whether we can link against ncurses
> > it will fail silently and the help text indicating to install ncurses is
> > printed.

> > However, this is not due to missing ncurses but once the stderr redirect
> > to /dev/null is removed we can see the root cause:
> > <stdin>:2:1: error: return type defaults to ‘int’ [-Wimplicit-int]

> > So, in order for menuconfig to work with GCC14 lets just specify the
> > return type of main() as int.

> > Signed-off-by: Robert Marko <robimarko@gmail.com>

> Thanks a lot for the patch. However, making changes in support/kconfig/
> in Buildroot requires a bit more care. Indeed, this code is taken from
> the Linux kernel code, and we try to keep a well-defined list of
> changes on top of the original code from the kernel.

> As explained in support/kconfig/README.buildroot, the current code in
> support/kconfig/ is taken from Linux 4.17-rc2, on top of which the
> patches in support/kconfig/patches/ have been applied.

I'm sorry for a wrong review, I completely forget Buildroot uses patches
also for kconfig.

> So from this, you have two options:

> (1) Add a new patch in support/kconfig/patches/ which implements the
>     change you need for GCC14 compatibility

> (2) Update the code in support/kconfig/ to the latest code available in
>     the Linux kernel scripts/kconfig directory, rebase our patches, and
>     verify it all works.

> Obviously, (1) is the easiest path. (2) is nicer long term, as we
> benefit from all new features/fixes added by the Linux kernel
> developers. Turns out that in the upstream kernel, the
> check-lxdialog.sh script has been removed and replaced by something
> different, which no longer has this main() function definition.

FYI I gave up kconfig update after big rewrites in the Linux kernel
made by Masahiro Yamada (the new kbuild and kconfig maintainer), because the
code changes were quite big but kconfig in Buildroot is IMHO not missing any
significant usability function. But I can be wrong, Thomas let me know if you
miss something significant which would justify the update. Obviously we would
get some fixes, but also major rewrite, which would likely require changes in
other parts of Buildroot.

check-lxdialog.sh was removed in 1c5af5cf9308 ("kconfig: refactor ncurses
package checks for building mconf and nconf") in v4.18, but major rewrite come
in 4.19 and 5.0 + kbuild updates in 5.1, changes continue in 5.10, 5.13, later
fixes in 6.x kernels...

Some of these changes moved storing toolchain capabilities in .config (while
Buildroot uses does something similar, I'm not sure whether kernel functionality
could be used without big changes in Buildroot).

Kind regards,
Petr

> Could you have a look at implementing either (1) or (2) ?

> Thanks a lot!

> Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-08 21:38   ` Petr Vorel
@ 2024-04-09 19:46     ` Thomas Petazzoni via buildroot
  2024-04-09 20:50       ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-04-09 19:46 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Robert Marko, buildroot

On Mon, 8 Apr 2024 23:38:07 +0200
Petr Vorel <petr.vorel@gmail.com> wrote:

> FYI I gave up kconfig update after big rewrites in the Linux kernel
> made by Masahiro Yamada (the new kbuild and kconfig maintainer), because the
> code changes were quite big but kconfig in Buildroot is IMHO not missing any
> significant usability function. But I can be wrong, Thomas let me know if you
> miss something significant which would justify the update. Obviously we would
> get some fixes, but also major rewrite, which would likely require changes in
> other parts of Buildroot.

I have no idea what are the new interesting features that have been
added in the upstream scripts/kconfig/ (if any). However, keeping our
support/kconfig/ reasonably up-to-date is not only about new features,
it's also about staying compatible with reasonably recent
libraries/tools (more recent ncurses, Gtk, Qt, more recent GCC, like
this issue illustrates).

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-09 19:46     ` Thomas Petazzoni via buildroot
@ 2024-04-09 20:50       ` Yann E. MORIN
  2024-04-11  0:15         ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2024-04-09 20:50 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Petr Vorel, Robert Marko, buildroot

Thomas, Petr, All,

On 2024-04-09 21:46 +0200, Thomas Petazzoni via buildroot spake thusly:
> On Mon, 8 Apr 2024 23:38:07 +0200
> Petr Vorel <petr.vorel@gmail.com> wrote:
> 
> > FYI I gave up kconfig update after big rewrites in the Linux kernel
> > made by Masahiro Yamada (the new kbuild and kconfig maintainer), because the
> > code changes were quite big but kconfig in Buildroot is IMHO not missing any
> > significant usability function. But I can be wrong, Thomas let me know if you
> > miss something significant which would justify the update. Obviously we would
> > get some fixes, but also major rewrite, which would likely require changes in
> > other parts of Buildroot.
> 
> I have no idea what are the new interesting features that have been
> added in the upstream scripts/kconfig/ (if any). However, keeping our
> support/kconfig/ reasonably up-to-date is not only about new features,
> it's also about staying compatible with reasonably recent
> libraries/tools (more recent ncurses, Gtk, Qt, more recent GCC, like
> this issue illustrates).

The kernel's kconfig has dropped the possibility to include files from
within a choice, so what we're doing now in a few places will not work;
  - toolchain/toolchain-external/Config.in
  - package/openssl/Config.in

and so on...

Unless that was reverted upstream...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-09 20:50       ` Yann E. MORIN
@ 2024-04-11  0:15         ` Petr Vorel
  2024-04-11  5:02           ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2024-04-11  0:15 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Robert Marko, Thomas Petazzoni, buildroot

Hi Yann, Thomas, all,

> Thomas, Petr, All,

> On 2024-04-09 21:46 +0200, Thomas Petazzoni via buildroot spake thusly:
> > On Mon, 8 Apr 2024 23:38:07 +0200
> > Petr Vorel <petr.vorel@gmail.com> wrote:

> > > FYI I gave up kconfig update after big rewrites in the Linux kernel
> > > made by Masahiro Yamada (the new kbuild and kconfig maintainer), because the
> > > code changes were quite big but kconfig in Buildroot is IMHO not missing any
> > > significant usability function. But I can be wrong, Thomas let me know if you
> > > miss something significant which would justify the update. Obviously we would
> > > get some fixes, but also major rewrite, which would likely require changes in
> > > other parts of Buildroot.

> > I have no idea what are the new interesting features that have been
> > added in the upstream scripts/kconfig/ (if any). However, keeping our
> > support/kconfig/ reasonably up-to-date is not only about new features,
> > it's also about staying compatible with reasonably recent
> > libraries/tools (more recent ncurses, Gtk, Qt, more recent GCC, like
> > this issue illustrates).

> The kernel's kconfig has dropped the possibility to include files from
> within a choice, so what we're doing now in a few places will not work;
>   - toolchain/toolchain-external/Config.in
>   - package/openssl/Config.in

Ah, you mean choice within choice .. endchoice.  Thanks for info. That's
unfortunate. Any idea which commits reverted it? I'm not sure if it will be
possible to easily revert it back (there are many changes in kconfig).
Also replacing 'source' with some placeholder and using some preprocessing
in extra make target (dependency for gconfig/xconfig/menuconfig/nconfig/config)
might not be as trivial as it looks like.

> and so on...

Do you remember any other problem?

> Unless that was reverted upstream...

I doubt, but that needs to be find out.

Also, maybe slightly easier way could be to use init-kconfig [1],
used in kdevops [2] (imported via 'git subtree' into the usual scripts/kconfig/
directory). At least we could try to migrate at least some of our patches there.

Kind regards,
Petr

> Regards,
> Yann E. MORIN.

[1] https://github.com/mcgrof/init-kconfig
[2] https://github.com/mcgrof/kdevops
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14
  2024-04-11  0:15         ` Petr Vorel
@ 2024-04-11  5:02           ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2024-04-11  5:02 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Robert Marko, Thomas Petazzoni, buildroot

Petr, All,

> > The kernel's kconfig has dropped the possibility to include files from
> > within a choice, so what we're doing now in a few places will not work;
> >   - toolchain/toolchain-external/Config.in
> >   - package/openssl/Config.in
> Ah, you mean choice within choice .. endchoice.  Thanks for info. That's
               ^^^^^^
s/choice/source/

Yes, "source" in a choice...endchoice block.

> unfortunate. Any idea which commits reverted it?

That was commit in the kernel, 4 years ago:

    09d5873e4d1f7 kconfig: allow only 'config', 'comment', and 'if' inside 'choice'

> I'm not sure if it will be
> possible to easily revert it back (there are many changes in kconfig).

Indeed.

> Also replacing 'source' with some placeholder and using some preprocessing
> in extra make target (dependency for gconfig/xconfig/menuconfig/nconfig/config)
> might not be as trivial as it looks like.

No, it is not...

> Do you remember any other problem?

Not right now. There were a few other major changes, but AFAICS we would
not be impacted.

> Also, maybe slightly easier way could be to use init-kconfig [1],

init-kconfig has not been touched in 2 years. There is no point in
switching from our mothballed copy, to another mothballed copy...

And in any case, they advertise as being "a passive fork of Linux
kconfig", and their "goal is not to fork kconfig and evolve it
separately".

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-11  5:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03 12:18 [Buildroot] [PATCH 1/1] kconfig/lxdialog: fix check() with GCC14 Robert Marko
2024-04-03 16:28 ` Petr Vorel
2024-04-08 20:36 ` Thomas Petazzoni via buildroot
2024-04-08 21:15   ` Robert Marko
2024-04-08 21:38   ` Petr Vorel
2024-04-09 19:46     ` Thomas Petazzoni via buildroot
2024-04-09 20:50       ` Yann E. MORIN
2024-04-11  0:15         ` Petr Vorel
2024-04-11  5:02           ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox