Skip to contentSkip to conversation

package/powertop: needs ncursesw

PATCH New Bernd Kuhls 3 participants 8 messages Mar 27, 2015 – Apr 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/powertop: needs ncursesw

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

---
 package/powertop/Config.in |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/powertop/Config.in +4 -2
index f157f46..cee78e5 100644
@@ -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
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 package/powertop: depends on c++

Fixes configure error due to missing c++

checking for library containing pthread_create... no
configure: error: libpthread is required but was not found

Quote from config.log:

configure:21552: checking for library containing pthread_create
configure:21583: false -o conftest -Os conftest.cpp -lintl >&5
[...]
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=false

using this defconfig

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PACKAGE_POWERTOP=y

Please note the number of .cpp files belonging to powertop

output/build/powertop-2.7$ find -iname *.cpp | wc -l 59

---
 package/powertop/Config.in |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
package/powertop/Config.in +6 -6
index cee78e5..398764e 100644
@@ -1,9 +1,8 @@
 config BR2_PACKAGE_POWERTOP
 	bool "powertop"
-	# pciutils dependency
-	depends on !BR2_bfin
-	# libnl dependency
-	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_bfin # pciutils
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl
 	depends on BR2_USE_WCHAR # ncurses
 	select BR2_PACKAGE_NCURSES
 	select BR2_PACKAGE_NCURSES_WCHAR
@@ -15,6 +14,7 @@ config BR2_PACKAGE_POWERTOP
 
 	  https://01.org/powertop/
 
-comment "powertop needs a toolchain w/ threads, wchar"
+comment "powertop needs a toolchain w/ C++, threads, wchar"
 	depends on !BR2_bfin
-	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_USE_WCHAR
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 2/2 package/powertop: depends on c++

In reply to Bernd Kuhls

Dear Bernd Kuhls,

Quoted 18 lines · Bernd Kuhls

Fixes configure error due to missing c++

checking for library containing pthread_create... no
configure: error: libpthread is required but was not found

Quote from config.log:

configure:21552: checking for library containing pthread_create
configure:21583: false -o conftest -Os conftest.cpp -lintl >&5
[...]
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=false

using this defconfig

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PACKAGE_POWERTOP=y

Quoted 6 lines

Please note the number of .cpp files belonging to powertop

output/build/powertop-2.7$ find -iname *.cpp | wc -l 59

Applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/2 package/powertop: needs ncursesw

In reply to Bernd Kuhls

Dear Bernd Kuhls,

Quoted 9 lines · Bernd Kuhls

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

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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 1/2 package/powertop: needs ncursesw

[posted and mailed]

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

Quoted 1 line

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

#6 lore raw

PATCH 1/2 package/powertop: needs ncursesw

Quoted 17 lines · Bernd Kuhls

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:

Quoted 7 lines

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.

#7 lore raw

PATCH 1/2 package/powertop: needs ncursesw

In reply to Bernd Kuhls

Dear Bernd Kuhls,

Quoted 8 lines · Bernd Kuhls

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

Quoted 4 lines
---
 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com