Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 654034 - sys-apps/util-linux: cross build fails due to using -L/usr/lib64 and not finding libncursesw.so.6 and libtinfow.so.6
Summary: sys-apps/util-linux: cross build fails due to using -L/usr/lib64 and not find...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-25 03:20 UTC by Joe Harvell
Modified: 2020-01-11 19:03 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output of sudo armv7a-pip-linux-gnueabi-emerge --info (pip-emerge-info.txt,4.72 KB, text/plain)
2018-04-25 03:20 UTC, Joe Harvell
Details
output of sudo emerge --info (emerge-info.txt,6.39 KB, text/plain)
2018-04-25 03:22 UTC, Joe Harvell
Details
build.log (build.log,722.15 KB, text/x-log)
2018-04-25 03:22 UTC, Joe Harvell
Details
build-.arm.log (build-.arm.log,720.84 KB, text/plain)
2018-04-25 03:22 UTC, Joe Harvell
Details
config.log (config.log,325.50 KB, text/plain)
2018-04-25 03:23 UTC, Joe Harvell
Details
configure (configure,924.98 KB, application/x-shellscript)
2018-04-25 03:23 UTC, Joe Harvell
Details
total hack I used to make it work (util-linux-hack-ncurses6w.patch,581 bytes, patch)
2018-04-25 04:27 UTC, Joe Harvell
Details | Diff
util-linux-2.35.ebuild.patch (util-linux-2.35.ebuild.patch,969 bytes, patch)
2020-01-09 09:27 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Harvell 2018-04-25 03:20:44 UTC
Created attachment 528474 [details]
output of sudo armv7a-pip-linux-gnueabi-emerge --info

/bin/sh ./libtool  --tag=CC   --mode=link armv7a-pip-linux-gnueabi-gcc -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls 
-Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wimplicit-function-declaration
 -Wno-clobbered -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -march=armv7-a -mtune=cortex-a8 -mfpu=neon-vfpv3 -mfloat-abi=hard -Os -pipe -fomit-frame-pointer -ftree-vectorize -flto=10  -flto=10 -fuse-ld=gold -fuse-linker-plugin -o more text-u
tils/more-more.o   -L/usr/lib64 -lncursesw -ltinfow

/usr/libexec/gcc/armv7a-pip-linux-gnueabi/ld.gold: error: /lib64/libncursesw.so.6: incompatible target
/usr/libexec/gcc/armv7a-pip-linux-gnueabi/ld.gold: error: /lib64/libtinfow.so.6: incompatible target
/usr/libexec/gcc/armv7a-pip-linux-gnueabi/ld.gold: warning: skipping incompatible /usr/lib64/libc.so while searching for c
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function print_out: error: undefined reference to 'tputs'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'setupterm'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'setupterm'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetstr'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetstr'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetstr'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetstr'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetflag'
/usr/armv7a-pip-linux-gnueabi/tmp/portage/sys-apps/util-linux-2.32-r3/temp/ccNh2EdW.ltrans0.ltrans.o:<artificial>:function main: error: undefined reference to 'tigetflag'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:7251: ul] Error 1


This is happening becuase ofthe -L/usr/lib64 on the command line.  It causes the linker to look in /usr/lib64 (in sysroot) instead of /usr/lib.

The reason -L/usr/lib64 is on the command line is because the configure script fails to find the correct ncursesw6-config program.  It is supposed to use the one in $SYSROOT: /usr/armv7a-pip-linux-gnueabi/usr/bin/ncursesw6-config, but instead it finds the one in the build root: /usr/bin/ncursesw6-config.  Then when it calls ncursesw6-config --libdir it returns /usr/lib64, which is wrong.

From config.log:

configure:20810: checking for armv7a-pip-linux-gnueabi-ncursesw6-config
configure:20840: result: no
configure:20850: checking for ncursesw6-config
configure:20866: found /usr/bin/ncursesw6-config
configure:20877: result: ncursesw6-config
configure:20889: WARNING: using cross tools not prefixed with host triplet


The configure script seems to be expecting to find /usr/bin/armv7a-pip-linux-gnueabi-ncursesw6-config instead of finding it where it actually is in $SYSROOT: /usr/armv7a-pip-linux-gnueabi/usr/bin/ncursesw6-config.


To reproduce:

1.Create cross toolcain (crossdev -t armv7a-pip-linux-gnueabi)
2.Unpack latest portage snapshot into /usr/armv7a-pip-linux-gnueabi/usr
3.Update /usr/armv7a-pip-linux-gnueabi/etc/portage/make.profile symlink to point to ../../usr/portage/profiles/default/linux/arm/13.0/armv7a
4. sudo armv7a-pip-linux-gnueabi-emerge -a1v --noreplace --keep-going @system
5. repeat step 4 as necessary until emerge actually attempts to build sys-apps/util-linux

joey@akita util-linux-2.32$ ~/bin/pipenv eix sys-libs/ncurses
[I] sys-libs/ncurses
     Available versions:  
     (5)    5.9-r101(5/5)
     (0)    6.1-r2(0/6){tbz2}
       {ada +cxx debug doc gpm minimal profile static-libs test threads tinfo trace unicode ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32"}
     Installed versions:  6.1-r2(0/6){tbz2}(19:50:23 22/04/2018)(cxx unicode -ada -debug -doc -gpm -minimal -profile -static-libs -test -threads -tinfo -trace ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="-32 -64 -x32")
     Homepage:            https://www.gnu.org/software/ncurses/ http://dickey.his.com/ncurses/
     Description:         console display library

joey@akita util-linux-2.32$ ls -l /usr/armv7a-pip-linux-gnueabi/usr/bin/ncurses6-config 
-rwxr-xr-x 1 root root 6155 22 avril 19:49 /usr/armv7a-pip-linux-gnueabi/usr/bin/ncurses6-config
joey@akita util-linux-2.32$ /usr/armv7a-pip-linux-gnueabi/usr/bin/ncurses6-config --libdir
/usr/lib
joey@akita util-linux-2.32$ cat ~/bin/pipenv
#!/bin/bash

#export PATH=/usr/x86_64-pc-linux-gnu/armv7a-pip-linux-gnueabi/binutils-bin:/usr/x86_64-pc-linux-gnu/armv7a-pip-linux-gnueabi/gcc-bin:"$PATH"
#export CC=/usr/bin/armv7a-pip-linux-gnueabi-gcc
#export CPP=/usr/bin/armv7a-pip-linux-gnueabi-cpp
#export CXX=/usr/bin/armv7a-pip-linux-gnueabi-g++
export PORTAGE_CONFIGROOT=/usr/armv7a-pip-linux-gnueabi
export ROOT=/usr/armv7a-pip-linux-gnueabi
export SYSROOT=/usr/armv7a-pip-linux-gnueabi
exec $*
joey@akita util-linux-2.32$
Comment 1 Joe Harvell 2018-04-25 03:22:12 UTC
Created attachment 528476 [details]
output of sudo emerge --info
Comment 2 Joe Harvell 2018-04-25 03:22:42 UTC
Created attachment 528478 [details]
build.log
Comment 3 Joe Harvell 2018-04-25 03:22:59 UTC
Created attachment 528480 [details]
build-.arm.log
Comment 4 Joe Harvell 2018-04-25 03:23:25 UTC
Created attachment 528482 [details]
config.log
Comment 5 Joe Harvell 2018-04-25 03:23:59 UTC
Created attachment 528484 [details]
configure
Comment 6 Joe Harvell 2018-04-25 04:27:43 UTC
Created attachment 528486 [details, diff]
total hack I used to make it work

installed successfully with this hack
Comment 7 filbar 2018-04-26 16:58:58 UTC
I found, that this is triggered by missing "armv6j-hardfloat-linux-gnueabi-ncursesw6-config" file from ncurses package. Because of missing file it uses  ncursesw6-config from original system:
--------------------------------------------------------------------------
configure:20489: checking for armv6j-hardfloat-linux-gnueabi-ncursesw6-config
configure:20519: result: no
configure:20529: checking for ncursesw6-config
configure:20545: found /usr/bin/ncursesw6-config
configure:20556: result: ncursesw6-config
--------------------------------------------------------------------------
Comment 8 Joe Harvell 2018-04-26 17:10:12 UTC
(In reply to filbar from comment #7)
> I found, that this is triggered by missing
> "armv6j-hardfloat-linux-gnueabi-ncursesw6-config" file from ncurses package.
> Because of missing file it uses  ncursesw6-config from original system:
> --------------------------------------------------------------------------
> configure:20489: checking for armv6j-hardfloat-linux-gnueabi-ncursesw6-config
> configure:20519: result: no
> configure:20529: checking for ncursesw6-config
> configure:20545: found /usr/bin/ncursesw6-config
> configure:20556: result: ncursesw6-config
> --------------------------------------------------------------------------

I wouldn't say the problem is that the ncurses package is "missing" that file.  If ncurses (when cross-compiled) installed a file with that name, it would be installed at /usr/armv6j-hardfloat-linux-gnueabi/usr/bin/armv6j-hardfloat-linux-gnueabi-ncursesw6-config.  And in that case the build would not find it, since cross-emerge does not prepend /usr/armv6j-hardfloat-linux-gnueabi/usr/bin to PATH.

It looks like the problem is that this ebuild should be searching in SYSROOT (/usr/armv6j-hardfloat-linux-gnueabi in your case) for an executable named ncursesw6-config.

Take a look at the minor patch I made in https://bugs.gentoo.org/show_bug.cgi?id=653938.  That ebuild was looing in SYSROOT, just in /bin instead of /usr/bin.
Comment 9 filbar 2018-04-26 17:37:59 UTC
As a workaround I create symlink as:
"ln -s /usr/armv6j-hardfloat-linux-gnueabi/usr/bin/ncursesw6-config /usr/bin/armv6j-hardfloat-linux-gnueabi-ncursesw6-config"
Comment 10 Joe Harvell 2018-04-26 18:11:15 UTC
Yes, that would also work. Thanks.

I already worked around with the patch I attached.
Comment 11 Jiří Moravec 2018-08-08 20:03:23 UTC
Still there... :-(
Comment 12 tt_1 2019-01-21 22:22:25 UTC
The idea of using a softlink from #9 is pretty solid stuff. It works for me.
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-09 09:26:35 UTC
The bug is still there. Fun fact: ebuild already attempted to fix it by mangling ncursesw6-config into pkg-config ncursesw:

	# Undo bad ncurses handling by upstream. #601530
        sed -i -E \
		-e '/NCURSES_/s:(ncursesw?)[56]-config:$PKG_CONFIG \1:' \
		-e 's:(ncursesw?)[56]-config --version:$PKG_CONFIG --exists --print-errors \1:' \
		configure || die

But it does not do anything due to updated ./configure:
      NCURSES_LIBS=`$NCURSESW6_CONFIG --libs`
      NCURSES_CFLAGS=`$NCURSESW6_CONFIG --cflags`

Happened in https://github.com/karelzak/util-linux/commit/862326451184bb0fe9c2b2b110fcfc986f9b1734

The following change makes util-linux to cross-compile successfully for me:

diff --git a/sys-apps/util-linux/util-linux-2.35_rc1.ebuild b/sys-apps/util-linux/util-linux-2.35_rc1.ebuild
index cfaef772324..f1759d4eb6c 100644
--- a/sys-apps/util-linux/util-linux-2.35_rc1.ebuild
+++ b/sys-apps/util-linux/util-linux-2.35_rc1.ebuild
@@ -92,12 +92,6 @@ src_prepare() {
 		eautoreconf
 	fi

-	# Undo bad ncurses handling by upstream. #601530
-	sed -i -E \
-		-e '/NCURSES_/s:(ncursesw?)[56]-config:$PKG_CONFIG \1:' \
-		-e 's:(ncursesw?)[56]-config --version:$PKG_CONFIG --exists --print-errors \1:' \
-		configure || die
-
 	elibtoolize
 }

@@ -144,6 +138,10 @@ multilib_src_configure() {
 	export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486
 	export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042

+	# Undo bad ncurses handling by upstream. Fall back to pkg-config. #601530
+	export NCURSES6_CONFIG=false NCURSES5_CONFIG=false
+	export NCURSESW6_CONFIG=false NCURSESW5_CONFIG=false
+
 	# configure args shared by python and non-python builds
 	local commonargs=(
 		--enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin"
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-09 09:27:03 UTC
Created attachment 602812 [details, diff]
util-linux-2.35.ebuild.patch
Comment 15 Larry the Git Cow gentoo-dev 2020-01-10 11:24:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c84572164618637ab7528a9a95946b6bc39d0eb5

commit c84572164618637ab7528a9a95946b6bc39d0eb5
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-01-10 11:21:32 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2020-01-10 11:21:49 +0000

    sys-apps/util-linux: Fixed cross-compilation
    
    Closes: https://bugs.gentoo.org/654034
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 sys-apps/util-linux/util-linux-2.33.2.ebuild   | 10 ++++------
 sys-apps/util-linux/util-linux-2.34-r3.ebuild  | 10 ++++------
 sys-apps/util-linux/util-linux-2.35_rc2.ebuild | 10 ++++------
 sys-apps/util-linux/util-linux-9999.ebuild     | 10 ++++------
 4 files changed, 16 insertions(+), 24 deletions(-)
Comment 16 tt_1 2020-01-10 13:10:35 UTC
confirmed, working now. Thank you very much! :-)
Comment 17 Larry the Git Cow gentoo-dev 2020-01-10 20:09:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0defa5f02f34b540eafcfd9b8ec9faaa80189cde

commit 0defa5f02f34b540eafcfd9b8ec9faaa80189cde
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-01-10 20:08:15 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-01-10 20:08:15 +0000

    dev-lang/ghc: add powerpc64le binary for ghc-8.8.1
    
    Bug: https://bugs.gentoo.org/654034
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-lang/ghc/Manifest         |  1 +
 dev-lang/ghc/ghc-8.8.1.ebuild | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
Comment 18 Larry the Git Cow gentoo-dev 2020-01-11 18:58:15 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae822c6a643103428de23fa18fa0be867983cbcd

commit ae822c6a643103428de23fa18fa0be867983cbcd
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-01-11 18:55:06 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-01-11 18:58:09 +0000

    dev-lang/ghc: add powerpc64le binary for ghc-8.6.5
    
    Bug: https://bugs.gentoo.org/654034
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-lang/ghc/Manifest         |  1 +
 dev-lang/ghc/ghc-8.6.5.ebuild | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-11 19:03:18 UTC
(In reply to Larry the Git Cow from comment #18)
> The bug has been referenced in the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=ae822c6a643103428de23fa18fa0be867983cbcd
> 
> commit ae822c6a643103428de23fa18fa0be867983cbcd
> Author:     Sergei Trofimovich <slyfox@gentoo.org>
> AuthorDate: 2020-01-11 18:55:06 +0000
> Commit:     Sergei Trofimovich <slyfox@gentoo.org>
> CommitDate: 2020-01-11 18:58:09 +0000
> 
>     dev-lang/ghc: add powerpc64le binary for ghc-8.6.5

Gah, wrong bug. Sorry for the spam.