ncurses library location fix
cover ncurses library location fix
Hello,
This pull request improves the way ncurses libraries are installed, moving only libncurses, libncursesw, and libtinfo soname libs into base_libdir, and leaving everything else in libdir. This is how ncurses is packaged on my Ubuntu host, and doing things this way fixes bug #2070 so ncurses will work within python again. It is also a partial bugfix for bug #1937.
Scott
The following changes since commit f47ada62a3da879006e7cb27479dc9b72c56e923:
cmake.bbclass: add ${base_libdir} to CMAKE_LIBRARY_PATH (2012-03-12 17:46:16 +0000)are available in the git repository at:
git://git.pokylinux.org/poky-contrib sgarman/python-ncurses-fix-oe
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/python-ncurses-fix-oe
Scott Garman (3):
path.py: add make_relative_symlink method
ncurses: move only libncurses and libtinfo to base_libdir
gettext: do not set libncurses prefix explicitly
meta/lib/oe/path.py | 27 +++++++++++++++++ meta/recipes-core/gettext/gettext_0.18.1.1.bb | 5 +-- meta/recipes-core/ncurses/ncurses.inc | 40 +++++++++++++++++------- 3 files changed, 56 insertions(+), 16 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 path.py: add make_relative_symlink method
This method allows you to convert an absolute symlink into a relative one.
--- meta/lib/oe/path.py | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
meta/lib/oe/path.py +27 -0
@@ -40,6 +40,33 @@ def relative(src, dest): return os.path.sep.join(relpath) +def make_relative_symlink(path): + """ Convert an absolute symlink to a relative one """ + if not os.path.islink(path): + return + link = os.readlink(path) + if not os.path.isabs(link): + return + + # find the common ancestor directory + ancestor = path + depth = 0 + while ancestor and not link.startswith(ancestor): + ancestor = ancestor.rpartition('/')[0] + depth += 1 + + if not ancestor: + print "make_relative_symlink() Error: unable to find the common ancestor of %s and its target" % path + return + + base = link.partition(ancestor)[2].strip('/') + while depth > 1: + base = "../" + base + depth -= 1 + + os.remove(path) + os.symlink(base, path) + def format_display(path, metadata): """ Prepare a path for display to the user. """ rel = relative(metadata.getVar("TOPDIR", True), path)
Signature · 1 line
1.7.5.4
PATCH 2/3 ncurses: move only libncurses and libtinfo to base_libdir
In reply to Scott GarmanThe previous approach to moving the ncurses libraries to base_libdir was too aggressive, and it broke curses support in python.
Instead, move only libncurses, libncursesw, and libtinfo to base_libdir and leave the remaining libraries in libdir.
Also delete ${libdir}/terminfo as it never gets packaged to avoid a QA warning.
This fixes [YOCTO #2070] and is a partial fix for [YOCTO #1937].
--- meta/recipes-core/ncurses/ncurses.inc | 40 +++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 12 deletions(-)
meta/recipes-core/ncurses/ncurses.inc +28 -12
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc SECTION = "libs" DEPENDS = "ncurses-native" DEPENDS_virtclass-native = "" -INC_PR = "r4" +INC_PR = "r5" inherit autotools binconfig multilib_header
@@ -44,7 +44,6 @@ ncurses_configure() { --enable-hard-tabs \ --enable-xmc-glitch \ --enable-colorfgbg \ - --libdir=${base_libdir} \ --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \ --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \ --with-shared \
@@ -114,7 +113,12 @@ _install_opts = "\ install.libs install.includes install.man \ " -do_install() { +python do_install () { + bb.build.exec_func("shell_do_install", d) + oe.path.make_relative_symlink(d.expand("${D}${libdir}/libtinfo.so")) +} + +shell_do_install() { # Order of installation is important; widec installs a 'curses.h' # header with more definitions and must be installed last hence. # Compatibility of these headers will be checked in 'do_test()'.
@@ -147,6 +151,8 @@ do_install() { ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm fi + rm ${D}${libdir}/terminfo + if [ "${PN}" = "ncurses" ]; then mv ${D}${bindir}/clear ${D}${bindir}/clear.${PN} mv ${D}${bindir}/reset ${D}${bindir}/reset.${PN}
@@ -158,7 +164,7 @@ do_install() { # else when '-Wl,--no-copy-dt-needed-entries' has been set in # linker flags. for i in libncurses libncursesw; do - f=${D}${base_libdir}/$i.so + f=${D}${libdir}/$i.so test -h $f || continue rm -f $f echo '/* GNU ld script */' >$f
@@ -167,20 +173,33 @@ do_install() { # Make sure that libcurses is linked so that it gets -ltinfo # also, this should be addressed upstream really. - ln -sf libncurses.so ${D}${base_libdir}/libcurses.so + ln -sf libncurses.so ${D}${libdir}/libcurses.so # create libtermcap.so linker script for backward compatibility - f=${D}${base_libdir}/libtermcap.so + f=${D}${libdir}/libtermcap.so echo '/* GNU ld script */' >$f echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f + if [ ! -d "${D}${base_libdir}" ]; then + # Setting base_libdir to libdir as is done in the -native + # case will skip this code + mkdir ${D}${base_libdir} + mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir} + mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir} + + mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir} + rm ${D}${libdir}/libtinfo.so + # We'll turn this into a relative symlink after do_install returns + ln -sf ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so + fi + oe_multilib_header curses.h } python populate_packages_prepend () { - base_libdir = d.expand("${base_libdir}") + libdir = d.expand("${libdir}") pnbase = d.expand("${PN}-lib%s") - do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) + do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) }
@@ -212,10 +231,7 @@ FILES_${PN} = "\ ${bindir}/ncurses5-config \ ${bindir}/ncursesw5-config \ ${datadir}/tabset \ -" - -FILES_${PN}-dev += "\ - ${base_libdir}/*.so \ + ${base_libdir}/* \ " # This keeps only tput/tset in ncurses
Signature · 1 line
1.7.5.4
Re: [PATCH 2/3] ncurses: move only libncurses and libtinfo to base_libdir
Quoted 11 lines · Scott Garman
The previous approach to moving the ncurses libraries to
base_libdirwas too aggressive, and it broke curses support in python.Instead, move only libncurses, libncursesw, and libtinfo to
base_libdirand leave the remaining libraries in libdir.Also delete ${libdir}/terminfo as it never gets packaged to avoid a QA warning.
This fixes [YOCTO #2070] and is a partial fix for [YOCTO #1937].
Hello Scott,
package splitting doesn't seem to work anymore. Libs that previously had their own package now end up being stored in the main ncurses package.
Regards,
Andreas
Quoted 108 lines
Signed-off-by Scott Garman <[email protected]>--- meta/recipes-core/ncurses/ncurses.inc | 40 +++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 12 deletions(-)meta/recipes-core/ncurses/ncurses.inc +28
-12@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc SECTION = "libs" DEPENDS = "ncurses-native" DEPENDS_virtclass-native = "" -INC_PR = "r4" +INC_PR = "r5" inherit autotools binconfig multilib_header@@ -44,7 +44,6 @@ ncurses_configure() { --enable-hard-tabs \ --enable-xmc-glitch \ --enable-colorfgbg \ - --libdir=${base_libdir} \ --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \ --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \ --with-shared \@@ -114,7 +113,12 @@ _install_opts = "\ install.libs install.includes install.man \ " -do_install() { +python do_install () { + bb.build.exec_func("shell_do_install", d) + oe.path.make_relative_symlink(d.expand("${D}${libdir}/libtinfo.so")) +} + +shell_do_install() { # Order of installation is important; widec installs a 'curses.h' # header with more definitions and must be installed last hence. # Compatibility of these headers will be checked in 'do_test()'.@@ -147,6 +151,8 @@ do_install() { ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm fi + rm ${D}${libdir}/terminfo + if [ "${PN}" = "ncurses" ]; then mv ${D}${bindir}/clear ${D}${bindir}/clear.${PN} mv ${D}${bindir}/reset ${D}${bindir}/reset.${PN}@@ -158,7 +164,7 @@ do_install() { # else when '-Wl,--no-copy-dt-needed-entries' has been set in # linker flags. for i in libncurses libncursesw; do - f=${D}${base_libdir}/$i.so + f=${D}${libdir}/$i.so test -h $f || continue rm -f $f echo '/* GNU ld script */' >$f@@ -167,20 +173,33 @@ do_install() { # Make sure that libcurses is linked so that it gets -ltinfo # also, this should be addressed upstream really. - ln -sf libncurses.so ${D}${base_libdir}/libcurses.so + ln -sf libncurses.so ${D}${libdir}/libcurses.so # create libtermcap.so linker script for backward compatibility - f=${D}${base_libdir}/libtermcap.so + f=${D}${libdir}/libtermcap.so echo '/* GNU ld script */' >$f echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f + if [ ! -d "${D}${base_libdir}" ]; then + # Setting base_libdir to libdir as is done in the -native + # case will skip this code + mkdir ${D}${base_libdir} + mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir} + mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir} + + mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir} + rm ${D}${libdir}/libtinfo.so + # We'll turn this into a relative symlink after do_install returns + ln -sf ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so + fi + oe_multilib_header curses.h } python populate_packages_prepend () { - base_libdir = d.expand("${base_libdir}") + libdir = d.expand("${libdir}") pnbase = d.expand("${PN}-lib%s") - do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) + do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True) }@@ -212,10 +231,7 @@ FILES_${PN} = "\ ${bindir}/ncurses5-config \ ${bindir}/ncursesw5-config \ ${datadir}/tabset \ -" - -FILES_${PN}-dev += "\ - ${base_libdir}/*.so \ + ${base_libdir}/* \ " # This keeps only tput/tset in ncurses
Re: [PATCH 2/3] ncurses: move only libncurses and libtinfo to base_libdir
Quoted 11 lines · Andreas Oberritter
Quoted 10 lines · Scott Garman
The previous approach to moving the ncurses libraries to
base_libdirwas too aggressive, and it broke curses support in python.Instead, move only libncurses, libncursesw, and libtinfo to
base_libdirand leave the remaining libraries in libdir.Also delete ${libdir}/terminfo as it never gets packaged to avoid a QA warning.
Quoted 6 lines
Quoted 1 line
This fixes [YOCTO #2070] and is a partial fix for [YOCTO #1937].
Hello Scott,
package splitting doesn't seem to work anymore. Libs that previously had their own package now end up being stored in the main ncurses package.
Thanks for reporting this, Andreas. I am working on a fix for it now. My apologies for the trouble.
Scott
Signature · 3 lines
Scott Garman Embedded Linux Engineer - Yocto Project Intel Open Source Technology Center
PATCH 3/3 gettext: do not set libncurses prefix explicitly
In reply to Scott GarmanThe --with-libncurses-prefix configure option was added before this recipe had ncurses in DEPENDS, so it should be safe to remove it.
--- meta/recipes-core/gettext/gettext_0.18.1.1.bb | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
meta/recipes-core/gettext/gettext_0.18.1.1.bb +1 -4
@@ -5,7 +5,7 @@ SECTION = "libs" LICENSE = "GPL-3+ & LGPL-2.1+" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -PR = "r7" +PR = "r8" DEPENDS = "libxml2-native gettext-native virtual/libiconv ncurses expat" DEPENDS_virtclass-native = "libxml2-native" PROVIDES = "virtual/libintl virtual/gettext"
@@ -21,8 +21,6 @@ SRC_URI_append_libc-uclibc = " file://wchar-uclibc.patch \ SRC_URI[md5sum] = "3dd55b952826d2b32f51308f2f91aa89" SRC_URI[sha256sum] = "93ac71a7afa5b70c1b1032516663658c51e653087f42a3fc8044752c026443e9" -#PARALLEL_MAKE = "" - inherit autotools EXTRA_OECONF += "--without-lispdir \
@@ -32,7 +30,6 @@ EXTRA_OECONF += "--without-lispdir \ --disable-native-java \ --disable-openmp \ --with-included-glib \ - --with-libncurses-prefix=${STAGING_LIBDIR}/.. \ --without-emacs \ --without-cvs \ --without-git \
Signature · 1 line
1.7.5.4
Re: [PATCH 3/3] gettext: do not set libncurses prefix explicitly
Quoted 32 lines · Scott Garman
The --with-libncurses-prefix configure option was added before this recipe had ncurses in DEPENDS, so it should be safe to remove it.
Signed-off-by Scott Garman <[email protected]>--- meta/recipes-core/gettext/gettext_0.18.1.1.bb | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)meta/recipes-core/gettext/gettext_0.18.1.1.bb +1
-3@@ -5,7 +5,7 @@ SECTION = "libs" LICENSE = "GPL-3+ & LGPL-2.1+" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -PR = "r7" +PR = "r8" DEPENDS = "libxml2-native gettext-native virtual/libiconv ncurses expat" DEPENDS_virtclass-native = "libxml2-native" PROVIDES = "virtual/libintl virtual/gettext"@@ -21,8 +21,6 @@ SRC_URI_append_libc-uclibc = " file://wchar-uclibc.patch \ SRC_URI[md5sum] = "3dd55b952826d2b32f51308f2f91aa89" SRC_URI[sha256sum] = "93ac71a7afa5b70c1b1032516663658c51e653087f42a3fc8044752c026443e9" -#PARALLEL_MAKE = "" - inherit autotools EXTRA_OECONF += "--without-lispdir \
meta/recipes-core/gettext/gettext_0.18.1.1.bb EXTRA_OECONF += "--without-lispdir \ · line 35
Quoted 7 lines
meta/recipes-core/gettext/gettext_0.18.1.1.bb +0
-1@@ -32,7 +30,6 @@ EXTRA_OECONF += "--without-lispdir \ --disable-native-java \ --disable-openmp \ --with-included-glib \ - --with-libncurses-prefix=${STAGING_LIBDIR}/.. \ --without-emacs \ --without-cvs \ --without-git \
Sadly this breaks gettext for me as I'm now seeing things like:
i586-poky-linux-libtool: link: i586-poky-linux-gcc -m32 -march=i586 --sysroot=/media/build1/poky/build/tmp/sysroots/qemux86 -std=gnu99 -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o .libs/recode-sr-latin recode_sr_latin-recode-sr-latin.o recode_sr_latin-filter-sr-latin.o ../gnulib-lib/.libs/libgettextlib.so -L/usr/lib -lc -lncurses /media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: warning: library search path "/usr/lib" is unsafe for cross-compilation
/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: skipping incompatible /usr/lib/libtinfo.so when searching for -ltinfo
/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: skipping incompatible /usr/lib/libtinfo.a when searching for -ltinfo
in the logs which triggers a QA warning.
Cheers,
Richard
Re: [PATCH 3/3] gettext: do not set libncurses prefix explicitly
Quoted 43 lines · Richard Purdie
Quoted 32 lines · Scott Garman
The --with-libncurses-prefix configure option was added before this recipe had ncurses in DEPENDS, so it should be safe to remove it.
Signed-off-by Scott Garman<[email protected]>--- meta/recipes-core/gettext/gettext_0.18.1.1.bb | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)meta/recipes-core/gettext/gettext_0.18.1.1.bb +1
-3@@ -5,7 +5,7 @@ SECTION = "libs" LICENSE = "GPL-3+& LGPL-2.1+" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" -PR = "r7" +PR = "r8" DEPENDS = "libxml2-native gettext-native virtual/libiconv ncurses expat" DEPENDS_virtclass-native = "libxml2-native" PROVIDES = "virtual/libintl virtual/gettext"@@ -21,8 +21,6 @@ SRC_URI_append_libc-uclibc = " file://wchar-uclibc.patch \ SRC_URI[md5sum] = "3dd55b952826d2b32f51308f2f91aa89" SRC_URI[sha256sum] = "93ac71a7afa5b70c1b1032516663658c51e653087f42a3fc8044752c026443e9" -#PARALLEL_MAKE = "" - inherit autotools EXTRA_OECONF += "--without-lispdir \meta/recipes-core/gettext/gettext_0.18.1.1.bb EXTRA_OECONF += "--without-lispdir \ · line 35
Quoted 7 lines
meta/recipes-core/gettext/gettext_0.18.1.1.bb +0
-1@@ -32,7 +30,6 @@ EXTRA_OECONF += "--without-lispdir \ --disable-native-java \ --disable-openmp \ --with-included-glib \ - --with-libncurses-prefix=${STAGING_LIBDIR}/.. \ --without-emacs \ --without-cvs \ --without-git \Sadly this breaks gettext for me as I'm now seeing things like:
Quoted 6 lines
i586-poky-linux-libtool: link: i586-poky-linux-gcc -m32 -march=i586 --sysroot=/media/build1/poky/build/tmp/sysroots/qemux86 -std=gnu99 -O2 -pipe -g -feliminate-unused-debug-types -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o .libs/recode-sr-latin recode_sr_latin-recode-sr-latin.o recode_sr_latin-filter-sr-latin.o ../gnulib-lib/.libs/libgettextlib.so -L/usr/lib -lc -lncurses /media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: warning: library search path "
/usr/lib" is unsafe for cross-compilation
/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: skipping incompatible/usr/lib/libtinfo.sowhen searching for -ltinfo
/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/libexec/i586-poky-linux/gcc/i586-poky-linux/4.6.4/ld: skipping incompatible/usr/lib/libtinfo.awhen searching for -ltinfoin the logs which triggers a QA warning.
Argh. Please revert that commit then. It was harmless on my two build test systems, but apparently it is needed on others to avoid host contamination.
Scott
Signature · 3 lines
Scott Garman Embedded Linux Engineer - Yocto Project Intel Open Source Technology Center
Quoted 8 lines · Scott Garman
Hello,
This pull request improves the way ncurses libraries are installed, moving only libncurses, libncursesw, and libtinfo soname libs into
base_libdir, and leaving everything else in libdir. This is how ncurses is packaged on my Ubuntu host, and doing things this way fixes bug #2070 so ncurses will work within python again. It is also a partial bugfix for bug #1937.
I'll add that I've build-tested this on all five of our qemu architectures, and runtime tested the python curses fix on qemux86-64.
Scott
Signature · 3 lines
Scott Garman Embedded Linux Engineer - Yocto Project Intel Open Source Technology Center
Op 13 mrt. 2012, om 03:08 heeft Scott Garman het volgende geschreven:
Quoted 7 lines
Hello,
This pull request improves the way ncurses libraries are installed, moving only libncurses, libncursesw, and libtinfo soname libs into
base_libdir, and leaving everything else in libdir. This is how ncurses is packaged on my Ubuntu host, and doing things this way fixes bug #2070 so ncurses will work within python again.
Shouldn't there a PR bump for python as well in this series?
regards,
Koen
Quoted 5 lines · Koen Kooi
Op 13 mrt. 2012, om 03:08 heeft Scott Garman het volgende geschreven:
Quoted 2 lines
Hello,
Quoted 7 lines
Quoted 5 lines
This pull request improves the way ncurses libraries are installed, moving only libncurses, libncursesw, and libtinfo soname libs into
base_libdir, and leaving everything else in libdir. This is how ncurses is packaged on my Ubuntu host, and doing things this way fixes bug #2070 so ncurses will work within python again.Shouldn't there a PR bump for python as well in this series?
Just pushed a commit to my branch to do this.
Scott
Signature · 3 lines
Scott Garman Embedded Linux Engineer - Yocto Project Intel Open Source Technology Center