Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 949743 - sys-apps/util-linux-2.40.4 on prefix fails to link because of split ncurses/tinfo and a malfunctioning pkg-config
Summary: sys-apps/util-linux-2.40.4 on prefix fails to link because of split ncurses/t...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: tinfo
  Show dependency tree
 
Reported: 2025-02-14 20:58 UTC by Joey Dumont
Modified: 2025-02-26 15:54 UTC (History)
1 user (show)

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


Attachments
emerge--info (emerge-info.txt,6.82 KB, text/plain)
2025-02-14 20:58 UTC, Joey Dumont
Details
util-linux ebuild patch (util-linux.patch,1.15 KB, patch)
2025-02-14 21:00 UTC, Joey Dumont
Details | Diff
util-linux-2.40.4-tinfo.patch (file_949743.txt,642 bytes, patch)
2025-02-14 21:01 UTC, Joey Dumont
Details | Diff
config.log (config.log,457.47 KB, text/x-log)
2025-02-15 00:10 UTC, Joey Dumont
Details
build.log (build.log.tar.gz,34.23 KB, application/gzip)
2025-02-15 17:39 UTC, Joey Dumont
Details
ncursesw.pc (ncursesw.pc,661 bytes, text/plain)
2025-02-16 15:39 UTC, Joey Dumont
Details
tinfow.pc (tinfow.pc,667 bytes, text/plain)
2025-02-16 15:39 UTC, Joey Dumont
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joey Dumont 2025-02-14 20:58:16 UTC
Created attachment 918938 [details]
emerge--info

I was having trouble emerging sys-apps/util-linux-2.40.4 because of missing symbols, specifically

```
libtool: link: x86_64-pc-linux-gnu-gcc -fsigned-char -fno-common -Wall -Wextra -Waddress-of-packed-member -Wdiscarded-qualifiers -Wformat-security -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Wno-missing-field-initializers -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wsign-compare -Wstrict-prototypes -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-parameter -Wunused-result -Wunused-variable -Wvla -Walloca -Werror=sequence-point -I./libsmartcols/src -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=4 -fuse-linker-plugin -pipe -Wl,-O1 -Wl,-z -Wl,pack-relative-relocs -Wl,-O1 -Wl,-z -Wl,pack-relative-relocs -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=4 -fuse-linker-plugin -pipe -o .libs/lscpu sys-utils/lscpu-lscpu.o sys-utils/lscpu-lscpu-cputype.o sys-utils/lscpu-lscpu-cpu.o sys-utils/lscpu-lscpu-topology.o sys-utils/lscpu-lscpu-virt.o sys-utils/lscpu-lscpu-arm.o sys-utils/lscpu-lscpu-dmi.o  -Wl,--as-needed ./.libs/libcommon.a ./.libs/libsmartcols.so -Wl,-rpath -Wl,/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib64
/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../lib64/libncursesw.so: undefined reference to symbol 'stdscr'
/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib64/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status 
```

Looking at config.log, it seems that NCURSES_LIBS does not contain -ltinfow, erroring with 

```
Package tinfow was not found in the pkg-config search path.
Perhaps you should add the directory containing `tinfow.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tinfow' not found
configure:31520: $? = 1
configure:31534: $PKG_CONFIG --exists --print-errors "tinfow"
Package tinfow was not found in the pkg-config search path.
Perhaps you should add the directory containing `tinfow.pc'
to the PKG_CONFIG_PATH environment variable
```

Here's the crux of the issue, I think:
```

valandil /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/var/db/repos/gentoo/sys-process/procps $ /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/x86_64-pc-linux-gnu-pkgconf --libs tinfow
Package tinfow was not found in the pkg-config search path.
Perhaps you should add the directory containing `tinfow.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tinfow' not found
valandil /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/var/db/repos/gentoo/sys-process/procps $ which pkg-config
/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/pkg-config
valandil /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/var/db/repos/gentoo/sys-process/procps $ readlink -f $(which pkg-config)
/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/x86_64-pc-linux-gnu-pkgconf
valandil /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/var/db/repos/gentoo/sys-process/procps $ /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/pkg-config --libs tinfow
-ltinfow 
```

There seems to be a difference in search paths from calling the same binary from different symlinks, which seems very weird to me. 

I managed to work around it by manually shoving -ltinfow in the autotools setup for util-linux, but this doesn't address the root cause, only sidesteps it. I'll attach the ugly patches for context.
Comment 1 Joey Dumont 2025-02-14 21:00:52 UTC
Created attachment 918940 [details, diff]
util-linux ebuild patch
Comment 2 Joey Dumont 2025-02-14 21:01:35 UTC
Created attachment 918941 [details, diff]
util-linux-2.40.4-tinfo.patch
Comment 3 Greg Kubaryk 2025-02-14 22:57:30 UTC
might be good to attach the config.log
Comment 4 Joey Dumont 2025-02-15 00:10:06 UTC
Created attachment 918943 [details]
config.log
Comment 5 Mike Gilbert gentoo-dev 2025-02-15 03:47:26 UTC
Comment on attachment 918940 [details, diff]
util-linux ebuild patch

>--- util-linux-2.40.4.ebuild   2025-01-14 21:46:29.882727886 -0500
>+++ util-linux-2.40.4-r1.ebuild   2025-02-12 09:50:19.897900932 -0500
>@@ -296,7 +301,7 @@
>          --enable-rename
>          --enable-rfkill
>          --enable-schedutils
>-         --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
>+         --with-systemdsystemunitdir="${EPREFIX}/$(systemd_get_systemunitdir)"
>          --with-tmpfilesdir="${EPREFIX}"/usr/lib/tmpfiles.d
>          $(use_enable caps setpriv)
>          $(use_enable cramfs) 

systemd_get_systemunitdir already applies EPREFIX to the path, so this change is pointless and broken.
Comment 6 Mike Gilbert gentoo-dev 2025-02-15 03:48:01 UTC
Please also attach a the full build log.
Comment 7 Mike Gilbert gentoo-dev 2025-02-15 03:52:07 UTC
I suspect pkg-config is picking up settings from systemd.pc on the host system rather than from the Gentoo Prefix installation.
Comment 8 Joey Dumont 2025-02-15 17:39:22 UTC
Created attachment 918991 [details]
build.log
Comment 9 Joey Dumont 2025-02-15 17:40:15 UTC
(In reply to Mike Gilbert from comment #5)
> Comment on attachment 918940 [details, diff] [details, diff]
> util-linux ebuild patch
> 
> >--- util-linux-2.40.4.ebuild   2025-01-14 21:46:29.882727886 -0500
> >+++ util-linux-2.40.4-r1.ebuild   2025-02-12 09:50:19.897900932 -0500
> >@@ -296,7 +301,7 @@
> >          --enable-rename
> >          --enable-rfkill
> >          --enable-schedutils
> >-         --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
> >+         --with-systemdsystemunitdir="${EPREFIX}/$(systemd_get_systemunitdir)"
> >          --with-tmpfilesdir="${EPREFIX}"/usr/lib/tmpfiles.d
> >          $(use_enable caps setpriv)
> >          $(use_enable cramfs) 
> 
> systemd_get_systemunitdir already applies EPREFIX to the path, so this
> change is pointless and broken.

Without it, the prefix qa complained about files not installed in the prefix.
Comment 10 Mike Gilbert gentoo-dev 2025-02-16 02:18:30 UTC
(In reply to Joey Dumont from comment #9)
> Without it, the prefix qa complained about files not installed in the prefix.

That indicates pkg-config or a pkgconfig file is broken on your system. Patching the util-linux ebuild is not the solution.
Comment 11 Mike Gilbert gentoo-dev 2025-02-16 02:27:09 UTC
Comment on attachment 918991 [details]
build.log

Please do not use 'tar' when compressing single files.
Comment 12 Mike Gilbert gentoo-dev 2025-02-16 02:36:04 UTC
Looking more closely at the error message, it is complaining about a symbol reference in libncursesw, not in the irqtop sources.

libncursesw has a DT_NEEDED entry on libtinfow. It should not be necessary to name libtinfow explicitly on the link command line.

I think your toolchain is broken, or your CFLAGS/LDFLAGS are breaking something here.
Comment 13 Mike Gilbert gentoo-dev 2025-02-16 02:49:19 UTC
Also, I think your split ncurses/tinfo install is somehow messed up.

Do the following libraries?

${EPREFIX}/usr/lib64/libncursesw.so
${EPREFIX}/usr/lib64/libtinfow.so

How about the pkgconfig files? If so, please attach them to this bug for inspection.

${EPREFIX}/usr/lib64/pkgconfig/tinfow.pc
${EPREFIX}/usr/lib64/pkgconfig/ncursesw.pc
Comment 14 Mike Gilbert gentoo-dev 2025-02-16 02:50:24 UTC
(In reply to Mike Gilbert from comment #13)
> Do the following libraries?

This should say "do the following libraries exist?"
Comment 15 Joey Dumont 2025-02-16 15:39:30 UTC
Created attachment 919101 [details]
ncursesw.pc
Comment 16 Joey Dumont 2025-02-16 15:39:45 UTC
Created attachment 919102 [details]
tinfow.pc
Comment 17 Joey Dumont 2025-02-16 15:48:47 UTC
(In reply to Mike Gilbert from comment #10)
> (In reply to Joey Dumont from comment #9)
> > Without it, the prefix qa complained about files not installed in the prefix.
> 
> That indicates pkg-config or a pkgconfig file is broken on your system.
> Patching the util-linux ebuild is not the solution.

I do acknowledge that shoving -ltinfow manually is a dumb workaround. I did so when I originally posted the patches too. I don't understand how a broken pkgconfig leads to /urs/lib/systemd files in the image directory though. This feels like a separate issue to me.

Ack on not using tar for a single file.

> libncursesw has a DT_NEEDED entry on libtinfow. It should not be necessary to name libtinfow explicitly on the link command line.

Yep, this really confused me too. Ack on my weird CFLAGS/LDFLAGS breaking things. I'm fine with this being the resolution if I'm the only one hitting this.

As for the libraries, they do exist, as do the pkgconfig files. I've attached them both. 

valandil ~ $ ls -ltra ${EPREFIX}/usr/lib64/libncursesw.so ${EPREFIX}/usr/lib64/libtinfow.so
lrwxrwxrwx 1 valandil valandil 14 Jan 26 16:28 /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64//usr/lib64/libtinfow.so -> libtinfow.so.6
lrwxrwxrwx 1 valandil valandil 16 Jan 26 16:28 /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64//usr/lib64/libncursesw.so -> libncursesw.so.6
Comment 18 Mike Gilbert gentoo-dev 2025-02-16 17:01:21 UTC
I see this in config.log:

configure:31510: checking for tinfow
configure:31517: $PKG_CONFIG --exists --print-errors "tinfow"
Package tinfow was not found in the pkg-config search path.
Perhaps you should add the directory containing `tinfow.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tinfow' not found
configure:31520: $? = 1
configure:31534: $PKG_CONFIG --exists --print-errors "tinfow"
Package tinfow was not found in the pkg-config search path.
Perhaps you should add the directory containing `tinfow.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tinfow' not found
configure:31537: $? = 1
configure:31551: result: no
Package 'tinfow' not found

So, pkg-config is not finding that tinfow.pc file you attached.

That leads me to believe that something is wrong with pkg-config on your system: the wrong pkg-config binary is being invoked, or the wrong search path has been compiled into the binary.
Comment 19 Mike Gilbert gentoo-dev 2025-02-16 17:08:55 UTC
Run this to see what pkg-config is using for the search path:

/cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/x86_64-pc-linux-gnu-pkg-config --dump-personality

Also, please check permissions on the pkgconfig-related paths and files to ensure that pkg-config can actually read them.
Comment 20 Joey Dumont 2025-02-16 17:12:02 UTC
(In reply to Mike Gilbert from comment #18)
> I see this in config.log:
> 
> configure:31510: checking for tinfow
> configure:31517: $PKG_CONFIG --exists --print-errors "tinfow"
> Package tinfow was not found in the pkg-config search path.
> Perhaps you should add the directory containing `tinfow.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'tinfow' not found
> configure:31520: $? = 1
> configure:31534: $PKG_CONFIG --exists --print-errors "tinfow"
> Package tinfow was not found in the pkg-config search path.
> Perhaps you should add the directory containing `tinfow.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'tinfow' not found
> configure:31537: $? = 1
> configure:31551: result: no
> Package 'tinfow' not found
> 
> So, pkg-config is not finding that tinfow.pc file you attached.
> 
> That leads me to believe that something is wrong with pkg-config on your
> system: the wrong pkg-config binary is being invoked, or the wrong search
> path has been compiled into the binary.

Yep, I quoted this in my original bug description. I did forget to show that PKG_CONFIG was set to x86_64-pc-linux-gnu-pkg-config, which is a symlink to x86_64-pc-linux-gnu-pkgconf. $EPREFIX/usr/bin/pkg-config is also a symlink to x86_64-pc-linux-gnu-pkgconf. Calling the binary from the different symlinks seems to result in a different search path being used. This is also in my original comment, but looking back at it it should have been made clearer.
Comment 21 Joey Dumont 2025-02-16 17:15:01 UTC
(In reply to Mike Gilbert from comment #19)
> Run this to see what pkg-config is using for the search path:
> 
> /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/x86_64-pc-
> linux-gnu-pkg-config --dump-personality
> 
> Also, please check permissions on the pkgconfig-related paths and files to
> ensure that pkg-config can actually read them.

Ah, there it is! This is a fun one, I did not expect that. Both are symlinks to $EPREFIX/usr/bin/x86_64-pc-linux-gnu-pkgconf. 

valandil ~ $ /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/x86_64-pc-linux-gnu-pkg-config --dump-personality
Triplet: x86_64-pc-linux-gnu
SysrootDir: /
DefaultSearchPaths: /usr/lib/pkgconfig /usr/share/pkgconfig 
SystemIncludePaths: /usr/include 
SystemLibraryPaths: /usr/lib
 
valandil ~ $ /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/bin/pkg-config --dump-personality
Triplet: default
DefaultSearchPaths: /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib64/pkgconfig /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/share/pkgconfig 
SystemIncludePaths: /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/include 
SystemLibraryPaths: /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/lib64 /cvmfs/software.dumont.ca/2021.02/compat/linux/x86_64/usr/lib64
Comment 22 Mike Gilbert gentoo-dev 2025-02-16 17:25:51 UTC
Ah, my apologies for skimming comment 0.

I think this weird pkgconf behavior warrants additional investigation, but I'm not sure I want to attempt that via bug commentary.
Comment 23 Mike Gilbert gentoo-dev 2025-02-16 23:13:40 UTC
(In reply to Joey Dumont from comment #21)
> Both are symlinks to $EPREFIX/usr/bin/x86_64-pc-linux-gnu-pkgconf

Are you absolutely certain of that? It's really behaving like an entirely different program.
Comment 24 Mike Gilbert gentoo-dev 2025-02-16 23:18:39 UTC
I just noticed this:

Triplet: x86_64-pc-linux-gnu

Do you have a personality override file under one of these locations?

${EPREFIX}/etc/pkgconfig/personality.d
${EPREFIX}/usr/share/pkgconfig/personality.d
Comment 25 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-02-17 18:00:09 UTC
(In reply to Mike Gilbert from comment #22)
> Ah, my apologies for skimming comment 0.
> 
> I think this weird pkgconf behavior warrants additional investigation, but
> I'm not sure I want to attempt that via bug commentary.

Joey, could you perhaps come onto IRC?
Comment 26 Joey Dumont 2025-02-21 15:37:32 UTC
Sorry for disappearing, I was dealing with personal issues.

Yes, I can jump onto IRC. I'm usually available 2030-2200EST on weekdays, and EST afternoons on weekends. What's a convenient time for you?
Comment 27 Mike Gilbert gentoo-dev 2025-02-21 16:26:52 UTC
Please have a look at comment 24 first.
Comment 28 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-02-26 06:38:05 UTC
Reopening for visibility for now as someone else hit it on IRC.
Comment 29 Mike Gilbert gentoo-dev 2025-02-26 15:54:39 UTC
Reopening the bug without any additional info does not seem useful.