Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 854909 - app-editors/vim-core-8.2.5066: "missing dependency: ncurses" when cross-compiling
Summary: app-editors/vim-core-8.2.5066: "missing dependency: ncurses" when cross-compi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Other
: Normal normal
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords: PATCH
: 839744 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-06-28 18:26 UTC by aaltinay101
Modified: 2022-07-21 15:59 UTC (History)
3 users (show)

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


Attachments
config logs (config.log,181.82 KB, text/plain)
2022-06-28 18:26 UTC, aaltinay101
Details
emerge info (emerge-info (2),6.98 KB, text/plain)
2022-06-28 18:26 UTC, aaltinay101
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aaltinay101 2022-06-28 18:26:08 UTC
Created attachment 788540 [details]
config logs

I am getting the following error when I try to build vim-core. I attached detailed logs.

checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... yes
tinfo library is not usable
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      On Linux that would be the libncurses-dev package.
      Or specify the name of the library with --with-tlib.
 * ERROR: app-editors/vim-core-8.2.5066::portage-stable failed (configure phase):
 *   econf failed
 *
 * Call stack:
 *               ebuild.sh, line  127:  Called src_configure
 *             environment, line 3036:  Called econf '--with-modified-by=Gentoo-8.2.5066' '--enable-gui=no' '--without-x' '--disable-darwin' '--disable-perlinterp' '--disable-pythoninterp' '--disable-rubyinterp' '--disable-gpm' '--disable-selinux' '--disable-nls' '--disable-acl'
 *        phase-helpers.sh, line  710:  Called __helpers_die 'econf failed'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"
Comment 1 aaltinay101 2022-06-28 18:26:40 UTC
Created attachment 788543 [details]
emerge info
Comment 2 Matt Turner gentoo-dev 2022-06-29 05:11:46 UTC
In the future it would be good to mention clearly that you're on ChromeOS. It's apparent from the logs, but just saying so would be nice.

*** This bug has been marked as a duplicate of bug 839744 ***
Comment 3 aaltinay101 2022-06-29 06:18:05 UTC
Sure, I will add it next time. I think this is not the duplicate of the bug ... I tried adding ">=sys-libs/ncurses-5.2-r2:0=" as RDEPEND and DEPEND and both of them did not solve the problem. Note that I am trying to build 8.2.5066 while the other bug is for 8.2.4586.

I did some digging and these are my findings so far. I compared the config.log of 8.2.4586 and 8.2.5066.

8.2.5066 config.log
configure:11939: x86_64-cros-linux-gnu-clang -o conftest -Os -pipe -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections  -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all conftest.c -ltinfo  -lelf  >&5
configure:11939: $? = 0
configure:11949: result: yes
configure:11988: result: tinfo library is not usable

8.2.4586 config.log
configure:11905: checking for tgetent in -ltinfo
configure:11930: x86_64-cros-linux-gnu-clang -o conftest -Os -pipe -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections  -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all conftest.c -ltinfo  -lelf  >&5
configure:11930: $? = 0
configure:11940: result: yes
configure:12017: checking whether we talk terminfo
configure:12061: result: yes
configure:12069: checking what tgetent() returns for an unknown terminal

For some reason 8.2.5066 can't use tinfo and says "result: tinfo library is not usable". I don't know why that happens. Do you have any guesses?

I compiled the conftest.c myself with the command:
x86_64-cros-linux-gnu-clang -o conftest -Os -pipe -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections -fno-function-sections -fno-data-sections  -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all conftest.c -L/build/lakitu/usr/lib64/ -ltinfo  -lelf

After that I run it like this and nothing happens:
LD_LIBRARY_PATH=/build/lakitu/usr/lib64/ ./conftest

I will update this bug once I do more digging.
Comment 4 aaltinay101 2022-06-29 06:21:22 UTC
I should also mention that we are using ncurses-6.3_p20220423.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-29 06:25:20 UTC
>After that I run it like this and nothing happens:
>LD_LIBRARY_PATH=/build/lakitu/usr/lib64/ ./conftest

What's the exit code? Try "echo $?" after running it.
Comment 6 aaltinay101 2022-06-29 06:42:38 UTC
It is 0.
Comment 7 aaltinay101 2022-06-29 07:52:54 UTC
The logs after adding the `--with-tlib=tinfo` flag to econf command:

configure:12013: $? = 0
configure:12014: result: yes
configure:12026: checking whether we talk terminfo
configure:12070: result: yes
configure:12078: checking what tgetent() returns for an unknown terminal
configure:12086: error: failed to compile test program.

This means that error happens on another conftest.c. I was looking at the wrong program.
Comment 8 aaltinay101 2022-06-30 22:24:46 UTC
I found the bug. I think the cross compilation patch was removed because it wasn't getting applied nicely. The following patch fixes it:

--- vim-8.0.5066/src/configure.ac       2022-06-30 22:01:24.718188814 +0000
+++ vim-8.0.5066/src/configure.ac       2022-06-30 21:59:38.080917053 +0000
@@ -3441,7 +3441,7 @@
 # include <stddef.h>
 #endif
 main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }])],
-                         res="OK", res="FAIL", res="FAIL")
+                         res="OK", res="FAIL", res="OK")
       if test "$res" = "OK"; then
        break
       fi
@@ -3512,7 +3512,7 @@
     ],[
       vim_cv_tgetent=non-zero
     ],[
-      AC_MSG_ERROR(failed to compile test program.)
+      vim_cv_tgent=zero
     ])
   ])


I added this patch to the files directory and applied it with the following change:

 src_prepare() {
        if [[ ${PV} != 9999* ]] ; then
                rm "${WORKDIR}"/patches/006-vim-8.0.0617-crosscompile.patch || die
+               # We replace the crosscompile patch above with the patch below.
+               # This can be removed once the Gentoo integrates this patch to their patches.
+               # This can be tracked with the bug https://bugs.gentoo.org/854909
+               cp "${FILESDIR}"/006-vim-8.0.5066-crosscompile.patch "${WORKDIR}"/patches/
Comment 9 aaltinay101 2022-06-30 23:05:21 UTC
Forgot to mention that the same patch is needed for the vim package as well.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-04 15:39:52 UTC
*** Bug 839744 has been marked as a duplicate of this bug. ***
Comment 11 Larry the Git Cow gentoo-dev 2022-07-07 19:05:00 UTC
The bug has been closed via the following commit(s):

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

commit 58e155a64292807edfd25e4de50376dfa28888c5
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2022-07-07 18:56:41 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2022-07-07 19:04:22 +0000

    app-editors/vim: Rebase and apply cross-compiling patch
    
    Thanks-to: aaltinay101@gmail.com, enlightened@chromium.org
    Closes: https://bugs.gentoo.org/854909
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 app-editors/vim/Manifest                                        | 1 +
 app-editors/vim/{vim-8.2.5066.ebuild => vim-8.2.5066-r1.ebuild} | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)

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

commit 9075f8ac06821f8e3fdf489721ebb6dc5bdd8bd6
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2022-07-07 18:57:48 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2022-07-07 19:04:12 +0000

    app-editors/vim-core: Rebase and apply cross-compiling patch
    
    Thanks-to: aaltinay101@gmail.com, enlightened@chromium.org
    Closes: https://bugs.gentoo.org/854909
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 app-editors/vim-core/Manifest                                         | 1 +
 .../{vim-core-8.2.5066.ebuild => vim-core-8.2.5066-r1.ebuild}         | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
Comment 12 Larry the Git Cow gentoo-dev 2022-07-21 15:59:07 UTC
The bug has been referenced in the following commit(s):

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

commit ee0ada7f0399433bb5788fe8a0a0e70313d9c79d
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2022-07-21 15:55:24 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2022-07-21 15:57:57 +0000

    app-editors/vim-core: Add ncurses to DEPEND
    
    The configure script checks for ncurses, specifically libtinfo:
    
        checking for tgetent in -ltinfo... yes
    
    Depending on ncurses helps when cross-compiling vim-core, as ncurses may
    not be built for the host yet.
    
    Bug: https://bugs.gentoo.org/854909
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 .../{vim-core-8.2.5066-r1.ebuild => vim-core-8.2.5066-r2.ebuild}        | 2 ++
 .../vim-core/{vim-core-9.0.0049.ebuild => vim-core-9.0.0049-r1.ebuild}  | 2 ++
 app-editors/vim-core/vim-core-9999.ebuild                               | 2 ++
 3 files changed, 6 insertions(+)