ncurses: remove BR2_PACKAGE_NCURSES_TARGET_{FORM, MENU, PANEL} options
PATCH 1/1 ncurses: remove BR2_PACKAGE_NCURSES_TARGET_{FORM, MENU, PANEL} options
The ncurses sub-options BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} are currently very badly broken: they only control whether the libform, libmenu and libpanel libraries are installed in $(TARGET_DIR), but do absolutely nothing about their installation in $(STAGING_DIR).
This means that when one of those options is disabled, the corresponding library is indeed not installed in the target, but is available in staging. It can therefore be detected by the configure script of another package and used... even though the library will not be in the target, causing a runtime failure.
Internally, ncurses.mk uses the "make install" logic of ncurses for the staging installation, but uses a completely hand-written logic for the target installation, which is the reason for this desynchronization between what's installed in staging and target.
When BR2_PACKAGE_NCURSES_WCHAR=y, this also causes some build failures. Indeed, when BR2_PACKAGE_NCURSES_WCHAR=y, Buildroot creates some symbolic links lib<foo>w.so -> lib<foo>.so in staging and target, but only for the lib<foo> that have been enabled by BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL}. Due to this, a package that for example needed the libmenu library but forgot to select BR2_PACKAGE_NCURSES_TARGET_MENU was:
- Building fine with BR2_PACKAGE_NCURSES_WCHAR disabled (because libmenu.so exists in staging), but would fail to run at runtime because libmenu.so is not in the target.
- Fail to build with BR2_PACKAGE_NCURSES_WCHAR=y because only libmenuw.so exists, and not the libmenu.so symbolic link.
Since those libraries are small (43K for libform, 21K for libmenu and 8.2K for libpanel), this commit takes the very simple approach of removing those options, and installing the libraries unconditionally. It therefore uses the "make install" logic for both the staging *and* target installation.
In detail, this commit:
- Removes the NCURSES_PROGS variable, not needed since --without-progs already allows to disable the build and installation of programs.
- Removes the NCURSES_LIBS-y variable, and replaces it with a single unconditional assignement to NCURSES_LIBS, only used to create the lib<foo>w.so -> lib<foo>.so symbolic links when wchar support is enabled.
- Ensure the NCURSES_LINK_TARGET_LIBS hook gets called as a target post installation hook, since the custom NCURSES_INSTALL_TARGET_CMDS is removed.
- Removes NCURSES_INSTALL_TARGET_CMDS and the functions it was
calling: NCURSES_INSTALL_TARGET_LIBS and NCURSES_INSTALL_TARGET_PROGS.
- Adds a NCURSES_TARGET_SYMLINK_RESET hook to create the reset -> tset symbolic link, as was done before.
- Adds a NCURSES_TARGET_CLEANUP_TERMINFO to cleanup the terminfo files in the target, so that we stay in the same situation in terms of installed terminfo files.
- Removes the BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} options from the Config.in files: both their definition and usage.
It is worth mentioning that adding Config.in.legacy support is *NOT* necessary. Indeed:
- If they were disabled before this patch, having them in Config.in.legacy would not trigger the legacy warning.
- If they were enabled before this patch, then the behavior is
unchanged: all libraries are now unconditionally installed. So there is no point in warning the user.
We double-checked the installed size of a filesystem containing just ncurses before and after this patch, and the only folder that has its size changed is /usr/lib, growing from 852 KB to 932 KB in the wchar enabled case. That's a 80 KB system size increase.
This commit fixes the sngrep build failure and potentially numerous runtime issues with ncurses.
Fixes:
http://autobuild.buildroot.net/results/7b5db21a6c568e6c6c8fe2b5d5a2f5ca24df510c/
--- package/alsa-utils/Config.in | 3 --- package/iprutils/Config.in | 3 --- package/iptraf-ng/Config.in | 1 - package/kismet/Config.in | 1 - package/ncurses/Config.in | 15 -------------- package/ncurses/ncurses.mk | 47 +++++++++++++------------------------------- package/nload/Config.in | 1 - package/samba4/samba4.mk | 2 +- 8 files changed, 15 insertions(+), 58 deletions(-)
package/alsa-utils/Config.in +0 -3
@@ -34,9 +34,6 @@ config BR2_PACKAGE_ALSA_UTILS_ALSALOOP config BR2_PACKAGE_ALSA_UTILS_ALSAMIXER bool "alsamixer" select BR2_PACKAGE_NCURSES - select BR2_PACKAGE_NCURSES_TARGET_PANEL - select BR2_PACKAGE_NCURSES_TARGET_FORM - select BR2_PACKAGE_NCURSES_TARGET_MENU select BR2_PACKAGE_ALSA_LIB_MIXER depends on BR2_USE_WCHAR default y
package/iprutils/Config.in +0 -3
@@ -1,9 +1,6 @@ config BR2_PACKAGE_IPRUTILS bool "iprutils" select BR2_PACKAGE_NCURSES - select BR2_PACKAGE_NCURSES_TARGET_PANEL - select BR2_PACKAGE_NCURSES_TARGET_FORM - select BR2_PACKAGE_NCURSES_TARGET_MENU select BR2_PACKAGE_LIBSYSFS select BR2_PACKAGE_PCIUTILS depends on BR2_USE_MMU # fork()
package/iptraf-ng/Config.in +0 -1
@@ -2,7 +2,6 @@ config BR2_PACKAGE_IPTRAF_NG bool "iptraf-ng" depends on BR2_USE_MMU # fork() select BR2_PACKAGE_NCURSES - select BR2_PACKAGE_NCURSES_TARGET_PANEL help IPTraf-ng is a ncurses-based network monitoring utility. It gathers data like TCP connection packet and byte counts, interface statistics
package/kismet/Config.in +0 -1
@@ -10,7 +10,6 @@ config BR2_PACKAGE_KISMET depends on BR2_USE_MMU # fork() depends on !BR2_STATIC_LIBS # dlfcn.h select BR2_PACKAGE_NCURSES - select BR2_PACKAGE_NCURSES_TARGET_PANEL select BR2_PACKAGE_LIBPCAP select BR2_PACKAGE_LIBNL help
package/ncurses/Config.in +0 -15
@@ -18,21 +18,6 @@ config BR2_PACKAGE_NCURSES_WCHAR help Enable wide char & UTF-8 support in ncurses libraries -config BR2_PACKAGE_NCURSES_TARGET_PANEL - bool "ncurses libpanel in target" - help - Includes ncurses dynamic libpanel in target - -config BR2_PACKAGE_NCURSES_TARGET_FORM - bool "ncurses libform in target" - help - Includes ncurses dynamic libform in target - -config BR2_PACKAGE_NCURSES_TARGET_MENU - bool "ncurses libmenu in target" - help - Includes ncurses dynamic libmenu in target - config BR2_PACKAGE_NCURSES_TARGET_PROGS bool "ncurses programs" help
package/ncurses/ncurses.mk +14 -33
97 lines not on this page · raw message
package/nload/Config.in +0 -1
@@ -5,7 +5,6 @@ config BR2_PACKAGE_NLOAD bool "nload" depends on BR2_INSTALL_LIBSTDCPP select BR2_PACKAGE_NCURSES - select BR2_PACKAGE_NCURSES_TARGET_FORM help nload is a console application which monitors network traffic and bandwidth usage in real time. It visualizes the in- and
package/samba4/samba4.mk +1 -1
@@ -59,7 +59,7 @@ else SAMBA4_CONF_OPTS += --disable-gnutls endif -ifeq ($(BR2_PACKAGE_NCURSES_TARGET_FORM)$(BR2_PACKAGE_NCURSES_TARGET_MENU)$(BR2_PACKAGE_NCURSES_TARGET_PANEL),yyy) +ifeq ($(BR2_PACKAGE_NCURSES),y) SAMBA4_CONF_ENV += NCURSES_CONFIG="$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)" SAMBA4_DEPENDENCIES += ncurses else
Signature · 1 line
2.7.4
PATCH 1/1 ncurses: remove BR2_PACKAGE_NCURSES_TARGET_{FORM, MENU, PANEL} options
Hi Thomas, All,
Le 21/02/2017 ? 22:39, Thomas Petazzoni a ?crit :
Quoted 38 lines
The ncurses sub-options BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} are currently very badly broken: they only control whether the libform, libmenu and libpanel libraries are installed in $(TARGET_DIR), but do absolutely nothing about their installation in $(STAGING_DIR).
This means that when one of those options is disabled, the corresponding library is indeed not installed in the target, but is available in staging. It can therefore be detected by the configure script of another package and used... even though the library will not be in the target, causing a runtime failure.
Internally, ncurses.mk uses the "make install" logic of ncurses for the staging installation, but uses a completely hand-written logic for the target installation, which is the reason for this desynchronization between what's installed in staging and target.
When BR2_PACKAGE_NCURSES_WCHAR=y, this also causes some build failures. Indeed, when BR2_PACKAGE_NCURSES_WCHAR=y, Buildroot creates some symbolic links lib<foo>w.so -> lib<foo>.so in staging and target, but only for the lib<foo> that have been enabled by BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL}. Due to this, a package that for example needed the libmenu library but forgot to select
BR2_PACKAGE_NCURSES_TARGET_MENUwas:- Building fine with
BR2_PACKAGE_NCURSES_WCHARdisabled (because libmenu.so exists in staging), but would fail to run at runtime because libmenu.so is not in the target.- Fail to build with BR2_PACKAGE_NCURSES_WCHAR=y because only libmenuw.so exists, and not the libmenu.so symbolic link.
Since those libraries are small (43K for libform, 21K for libmenu and 8.2K for libpanel), this commit takes the very simple approach of removing those options, and installing the libraries unconditionally. It therefore uses the "make install" logic for both the staging *and* target installation.
Quoted 5 lines
In detail, this commit:
- Removes the
NCURSES_PROGSvariable, not needed since --without-progs already allows to disable the build and installation of programs.
Not related to you patch bu maybe we can add --with-progs in:
$(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs)
Otherwise this patch looks ok.
Best regards,
Romain
Quoted 48 lines
- Removes the NCURSES_LIBS-y variable, and replaces it with a single unconditional assignement to
NCURSES_LIBS, only used to create the lib<foo>w.so -> lib<foo>.so symbolic links when wchar support is enabled.- Ensure the
NCURSES_LINK_TARGET_LIBShook gets called as a target post installation hook, since the customNCURSES_INSTALL_TARGET_CMDSis removed.- Removes
NCURSES_INSTALL_TARGET_CMDSand the functions it was
calling:NCURSES_INSTALL_TARGET_LIBSandNCURSES_INSTALL_TARGET_PROGS.- Adds a
NCURSES_TARGET_SYMLINK_RESEThook to create the reset -> tset symbolic link, as was done before.- Adds a
NCURSES_TARGET_CLEANUP_TERMINFOto cleanup the terminfo files in the target, so that we stay in the same situation in terms of installed terminfo files.- Removes the BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} options from the Config.in files: both their definition and usage.
It is worth mentioning that adding Config.in.legacy support is *NOT* necessary. Indeed:
- If they were disabled before this patch, having them in Config.in.legacy would not trigger the legacy warning.
- If they were enabled before this patch, then the behavior is
unchanged: all libraries are now unconditionally installed. So there is no point in warning the user.We double-checked the installed size of a filesystem containing just ncurses before and after this patch, and the only folder that has its size changed is
/usr/lib, growing from 852 KB to 932 KB in the wchar enabled case. That's a 80 KB system size increase.This commit fixes the sngrep build failure and potentially numerous runtime issues with ncurses.
Fixes:
http://autobuild.buildroot.net/results/7b5db21a6c568e6c6c8fe2b5d5a2f5ca24df510c/
Signed-off-by Thomas Petazzoni <[email protected]>---
PATCH 1/1 ncurses: remove BR2_PACKAGE_NCURSES_TARGET_{FORM, MENU, PANEL} options
In reply to Thomas PetazzoniThomas, All,
On 2017-02-21 22:39 +0100, Thomas Petazzoni spake thusly:
Quoted 5 lines
The ncurses sub-options BR2_PACKAGE_NCURSES_TARGET_{FORM,MENU,PANEL} are currently very badly broken: they only control whether the libform, libmenu and libpanel libraries are installed in $(TARGET_DIR), but do absolutely nothing about their installation in $(STAGING_DIR).
[--SNIP--]
Impressive xommit log. Great! :-)
Quoted 3 lines
Signed-off-by Thomas Petazzoni <[email protected]>--- package/ncurses/ncurses.mk | 47 +++++++++++++-------------------------------
[--SNIP--]
package/ncurses/ncurses.mk
Quoted 4 lines
package/ncurses/ncurses.mk +0
-0
[--SNIP--]
package/ncurses/ncurses.mk NCURSES_TERMINFO_FILES += \ · line 113
Quoted 5 lines
package/ncurses/ncurses.mk +1
-0@@ -115,6 +110,7 @@ NCURSES_TERMINFO_FILES += \ NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC +NCURSES_POST_INSTALL_TARGET_HOOKS += NCURSES_LINK_TARGET_LIBS
Would do you need to create the symlinks in target/ ?
When a program (or lib) is linked to a library, its DT_SONAME is used, not the filename.
So if you have this chain of symlink, with the last element being an actual file:
libform.so -> libformw.so -> libformw.so.6 -> libformw.so.6.0
Then 'ld -lform' will in fact use the file libformw.so.6.0, extract its DT_SONAME, and use that as a DT_NEEDED in the executable.
In this case, the DT_SONAME is libformw.so.6
Then at runtime, ld.so will use the DT_NEEDED name to find what library to use, so in our case it will be looking for libformw.so.6, and will never look for libform.so to start with.
So the w-suffixed symlinks in target are useless.
Ditto the syminks about the static libs: they are totally useless in target/
Otherwise, tjis is a nice cleanup.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 ncurses: remove BR2_PACKAGE_NCURSES_TARGET_{FORM, MENU, PANEL} options
Hello,
Quoted 1 line · Yann E. MORIN
Impressive xommit log. Great! :-)
Thanks!
Quoted 12 lines
Quoted 3 lines
NCURSES_POST_INSTALL_STAGING_HOOKS+=NCURSES_LINK_STAGING_LIBSNCURSES_POST_INSTALL_STAGING_HOOKS+=NCURSES_LINK_STAGING_PC
+NCURSES_POST_INSTALL_TARGET_HOOKS +=NCURSES_LINK_TARGET_LIBSWould do you need to create the symlinks in target/ ?
When a program (or lib) is linked to a library, its
DT_SONAMEis used, not the filename.So if you have this chain of symlink, with the last element being an actual file:
Quoted 6 lines
libform.so -> libformw.so -> libformw.so.6 -> libformw.so.6.0Then 'ld -lform' will in fact use the file libformw.so.6.0, extract its
DT_SONAME, and use that as aDT_NEEDEDin the executable.In this case, the
DT_SONAMEis libformw.so.6
Hum, that's right. Those symlinks are not needd. They were here before, so I just kept them, but you are indeed right.
Quoted 2 lines
Ditto the syminks about the static libs: they are totally useless in target/
Well, static libs are not installed at all on the target, so indeed, symlinks are useless.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com