diff mbox

[1/2] package/powertop: needs ncursesw

Message ID 1427472097-30708-1-git-send-email-bernd.kuhls@t-online.de
State Superseded
Headers show

Commit Message

Bernd Kuhls March 27, 2015, 4:01 p.m. UTC
Fixes
http://autobuild.buildroot.net/results/913/913cea22f8a8f5902d8da5f64c3fce056d66790f/
http://autobuild.buildroot.net/results/6e1/6e11fa2a7405a69c59ced046b92ff08660c4aab7/
http://autobuild.buildroot.net/results/1d3/1d3323b2afaefa7989854dbccf92015731199e66/
http://autobuild.buildroot.net/results/1e3/1e31d412d8b3a38a375ad0be8f696bee993ec297/
http://autobuild.buildroot.net/results/2ff/2ff511eb8d00b94aca68427446e2d0f6e4317a5a/
and maybe others

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/powertop/Config.in |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni March 27, 2015, 4:34 p.m. UTC | #1
Dear Bernd Kuhls,

On Fri, 27 Mar 2015 17:01:36 +0100, Bernd Kuhls wrote:
> Fixes
> http://autobuild.buildroot.net/results/913/913cea22f8a8f5902d8da5f64c3fce056d66790f/
> http://autobuild.buildroot.net/results/6e1/6e11fa2a7405a69c59ced046b92ff08660c4aab7/
> http://autobuild.buildroot.net/results/1d3/1d3323b2afaefa7989854dbccf92015731199e66/
> http://autobuild.buildroot.net/results/1e3/1e31d412d8b3a38a375ad0be8f696bee993ec297/
> http://autobuild.buildroot.net/results/2ff/2ff511eb8d00b94aca68427446e2d0f6e4317a5a/
> and maybe others
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>

I am not sure about this patch. I believe there might be a bug in the
powertop configure.ac script. It's doing:

PKG_CHECK_MODULES([NCURSES], [ncursesw ncurses], [LIBS="$LIBS $ncurses_LIBS"], [
        AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], [
                AC_MSG_ERROR([ncurses is required but was not found])
        ], [])
])

So, when using PKG_CHECK_MODULES(), it wants both ncursesw and ncurses.
But if that fails, it tests with AC_SEARCH_LIBS(), but in this case, it
is looking for either ncursesw *or* ncurses.

Am I missing something?

Thomas
Bernd Kuhls March 27, 2015, 5:16 p.m. UTC | #2
[posted and mailed]

Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
@public.gmane.org> wrote in news:20150327173446.779683cf@free-electrons.com:

> Am I missing something?

Hi,

powertop is a weird piece of code;)

Using this defconfig

BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_POWERTOP=y

configure works

checking for NCURSES... no
checking for library containing delwin... -lncurses
[...]

but then this happens:

lib.cpp: In function 'void align_string(char*, size_t, size_t)':
lib.cpp:271:59: error: 'mbsrtowcs' was not declared in this scope
  sz = mbsrtowcs(NULL, (const char **)&buffer, max_sz, NULL);

Afaics mbsrtowcs() is a function which is only available with a wchar-enabled 
toolchain, so my patch does the right thing, but the description needs some 
additions.

Regards, Bernd

PS: Upstream of the powertop tarball is problematic:
http://autobuild.buildroot.net/results/50e/50e70b0c7c3533ddb7397fa7542a9369bf
7a7249/build-end.log
Gustavo Zacarias March 31, 2015, 11:03 p.m. UTC | #3
On 03/27/2015 02:16 PM, Bernd Kuhls wrote:

> Hi,
> 
> powertop is a weird piece of code;)
> 
> Using this defconfig
> 
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_PACKAGE_POWERTOP=y
> 
> configure works
> 
> checking for NCURSES... no
> checking for library containing delwin... -lncurses
> [...]
> 
> but then this happens:
> 
> lib.cpp: In function 'void align_string(char*, size_t, size_t)':
> lib.cpp:271:59: error: 'mbsrtowcs' was not declared in this scope
>   sz = mbsrtowcs(NULL, (const char **)&buffer, max_sz, NULL);
> 
> Afaics mbsrtowcs() is a function which is only available with a wchar-enabled 
> toolchain, so my patch does the right thing, but the description needs some 
> additions.

Hi.
Actually mb* and wc* usage is a pointer towards wchar, yes.
But in ncurses-land there's no need for ncursesw since powertop doesn't
use any of the wide (*_wch) variant functions.
Hence it just sucks at finding libncurses: you can drop the
NCURSES_WCHAR select and do something like:

$(if $(BR2_PACKAGE_NCURSES_WCHAR),y)
POWERTOP_CONF_ENV += ac_cv_search_delwin="-lncursesw"
else
POWERTOP_CONF_ENV += ac_cv_search_delwin="-lncurses"
fi

(or in a single if if you're so inclined).

Regards.
Thomas Petazzoni April 1, 2015, 10:07 p.m. UTC | #4
Dear Bernd Kuhls,

On Fri, 27 Mar 2015 17:01:36 +0100, Bernd Kuhls wrote:
> Fixes
> http://autobuild.buildroot.net/results/913/913cea22f8a8f5902d8da5f64c3fce056d66790f/
> http://autobuild.buildroot.net/results/6e1/6e11fa2a7405a69c59ced046b92ff08660c4aab7/
> http://autobuild.buildroot.net/results/1d3/1d3323b2afaefa7989854dbccf92015731199e66/
> http://autobuild.buildroot.net/results/1e3/1e31d412d8b3a38a375ad0be8f696bee993ec297/
> http://autobuild.buildroot.net/results/2ff/2ff511eb8d00b94aca68427446e2d0f6e4317a5a/
> and maybe others
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/powertop/Config.in |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

I've applied your patch, but after changing it according to Gustavo's
suggestion: ncurses wchar is not mandatory, but a little help is needed
to teach powertop about which variant of ncurses is available.

Thanks,

Thomas
diff mbox

Patch

diff --git a/package/powertop/Config.in b/package/powertop/Config.in
index f157f46..cee78e5 100644
--- a/package/powertop/Config.in
+++ b/package/powertop/Config.in
@@ -4,7 +4,9 @@  config BR2_PACKAGE_POWERTOP
 	depends on !BR2_bfin
 	# libnl dependency
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_WCHAR # ncurses
 	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NCURSES_WCHAR
 	select BR2_PACKAGE_PCIUTILS
 	select BR2_PACKAGE_LIBNL
 	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT
@@ -13,6 +15,6 @@  config BR2_PACKAGE_POWERTOP
 
 	  https://01.org/powertop/
 
-comment "powertop needs a toolchain w/ threads"
+comment "powertop needs a toolchain w/ threads, wchar"
 	depends on !BR2_bfin
-	depends on !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR