Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 827188

Summary: sci-libs/netcdf-4.7.4: hardcodes path to libdl.so in CMake files (was: sci-libs/vtk-9.0.3-r1 fails to build with sys-libs/glibc-2.34-r2 -- missing /usr/lib64/libdl.so symlink)
Product: Gentoo Linux Reporter: Michelangelo Scopelliti <kernelpanic>
Component: Current packagesAssignee: Gentoo Science Related Packages <sci>
Status: RESOLVED FIXED    
Severity: normal CC: dan, dflogeras2, egorr.berd, gustav.schaffter, ian, jaak, jouni.kosonen, koprut, posting, proxy-maint, sam, sargastic, waebbl-gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.archlinux.org/task/73898
https://bugs.gentoo.org/show_bug.cgi?id=839954
Whiteboard: Workaround: rebuild netcdf
Package list:
Runtime testing required: ---
Bug Depends on: 851468    
Bug Blocks: 803482, 843602    
Attachments: build log
netCDFTargets.cmake

Description Michelangelo Scopelliti 2021-11-24 19:33:39 UTC
Created attachment 756115 [details]
build log

Building sci-libs/vtk-9.0.3-r1 fails in the compile phase with the message

ninja: error: '/usr/lib64/libdl.so', needed by 'lib64/libvtkIONetCDF-9.0.so.9.0.3', missing and no known rule to make it

In older glibc versions, /usr/lib64/libdl.so is a symlink pointing to "../../lib64/libdl.so.2"; in glibc-2.34-r2 the link is missing.

Build log attached.

emerge --info

Portage 3.0.28 (python 3.9.9-final-0, default/linux/amd64/17.1, gcc-11.2.0, glibc-2.34-r2, 5.15.4 x86_64)
=================================================================
System uname: Linux-5.15.4-x86_64-Intel-R-_Core-TM-_i7-7700_CPU_@_3.60GHz-with-glibc2.34
KiB Mem:    32587276 total,  18978984 free
KiB Swap:   33554428 total,  33547960 free
Timestamp of repository gentoo: Wed, 24 Nov 2021 18:51:38 +0000
Head commit of repository gentoo: 27c20df9bc6546ee87c1a002c44c8e7e86a013b2

sh bash 5.1_p12
ld GNU ld (Gentoo 2.37_p1 p1) 2.37
app-shells/bash:          5.1_p12::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0-r5::gentoo
dev-lang/python:          2.7.18_p13::gentoo, 3.9.9::gentoo, 3.10.0_p1::gentoo
dev-lang/rust:            1.56.1::gentoo
dev-util/cmake:           3.22.0::gentoo
sys-apps/baselayout:      2.8::gentoo
sys-apps/openrc:          0.44.8::gentoo
sys-apps/sandbox:         2.29::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:       1.16.5::gentoo
sys-devel/binutils:       2.37_p1-r1::gentoo
sys-devel/gcc:            11.2.0::gentoo
sys-devel/gcc-config:     2.5-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.34-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000

kernelpanic
    location: /var/db/repos/kernelpanic
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -mtune=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -mtune=native -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -march=native -mtune=native -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg cgroup clean-logs compress-build-logs config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native -mtune=native -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="it_IT.UTF8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 amr ao avif blas bluray boost branding brotli bzip2 cairo cdda clang cli crypt cups curl dbus djvu dri dvb dvd elogind encode eselect-ldso exif ffmpeg fftw flac fontconfig fortran fribidi gdbm gif gimp gmp gpm gsm gtk harfbuzz heif iconv icu imlib inotify ipv6 jbig jemalloc jit jpeg jpeg2k lapack lcms libass libglvnd libnotify libsamplerate libtirpc llvm lto luajit lvm lz4 lzma lzo mms mng mp3 mpeg multilib natspec ncurses nls nptl offensive ogg openal opencv openexr opengl openmp opus pam pango pcre pcre16 pdf png policykit postproc postscript printsupport pulseaudio raw readline rubberband scanner seccomp smp sndfile sox speex spell split-usr ssl svg tbb theora threads tiff truetype udev udisks unicode usb v4l vaapi vdpau vidstab vim-syntax vorbis vpx vulkan wavpack webp wmf x264 x265 xattr xcb xcomposite xdg xetex xml xpm xv xvid zeroconf zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2019" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput wacom" KERNEL="linux" L10N="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" QEMU_SOFTMMU_TARGETS="aarch64 arm x86_64" RUBY_TARGETS="ruby30" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="intel i965 iris" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 1 GoGoOtaku 2021-11-25 01:15:36 UTC
I had the same issue on vtk-9.0.3-r2 but was able to resolve this by reemerging sci-libs/netcdf. 

In my case /usr/lib64/cmake/netCDF/netCDFTargets.cmake added a hard dependency to /usr/lib64/libdl.so instead of /usr/lib64/libdl.a. Recompiling fixed this (manually changing might also work but I rather have the package manager handle this)
Comment 2 Larry the Git Cow gentoo-dev 2021-11-25 01:45:12 UTC
The bug has been closed via the following commit(s):

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

commit 03e409f30d966755e399c476cc7bf2f508cafae4
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-11-25 01:44:46 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-25 01:45:05 +0000

    sci-libs/netcdf: add 4.8.1
    
    Doesn't seem to hardcode libdl path anymore which avoids glibc-2.34 issues.
    
    Closes: https://bugs.gentoo.org/827188
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-libs/netcdf/Manifest                           |  1 +
 .../files/netcdf-4.8.1-big-endian-build.patch      | 24 +++++++
 sci-libs/netcdf/netcdf-4.8.1.ebuild                | 74 ++++++++++++++++++++++
 3 files changed, 99 insertions(+)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 14:18:54 UTC
*** Bug 828020 has been marked as a duplicate of this bug. ***
Comment 4 tonich 2021-12-02 14:50:27 UTC
please add '-r1' to current stable netcdf-4.7.4
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 14:52:45 UTC
(In reply to tonich from comment #4)
> please add '-r1' to current stable netcdf-4.7.4

Yeah, that seems like a good workaround, but this is kind of tricky. It's not going to fix things unless this new version (not just -r1) is stabled before glibc-2.34 is.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-02 14:55:39 UTC
(In reply to Sam James from comment #5)
> (In reply to tonich from comment #4)
> > please add '-r1' to current stable netcdf-4.7.4
> 
> Yeah, that seems like a good workaround, but this is kind of tricky. It's
> not going to fix things unless this new version (not just -r1) is stabled
> before glibc-2.34 is.

Actually, I'm.. inclined to say this is self-inflicted? We should stable the newer netcdf once it's had more time to soak, but a revbump is only going to help users who keyworded the new glibc up to the point I revbump. It won't help folks who did it after.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-07 07:07:53 UTC
I also can't reproduce this anymore (I think I could in the past) -- I don't see any libdl reference in /usr/$(get_libdir)/cmake/netCDF/*, so I'm guessing it's fixed in 4.8.1.

Please shout if you think it isn't.
Comment 8 Scott Alfter 2022-03-28 04:50:45 UTC
I was having problems building FreeCAD 0.19.4 this evening which I traced to a similar error with a missing /usr/lib64/libdl.so.  Rebuilding netcdf got the FreeCAD ebuild working again, AFAICT (it's compiling now, while earlier it failed at the beginning of compilation).
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-07 15:06:14 UTC
*** Bug 837071 has been marked as a duplicate of this bug. ***
Comment 10 Jouni Kosonen 2022-04-07 15:09:40 UTC
(In reply to Sam James from comment #7)
> I also can't reproduce this anymore (I think I could in the past) -- I don't
> see any libdl reference in /usr/$(get_libdir)/cmake/netCDF/*, so I'm
> guessing it's fixed in 4.8.1.
> 
> Please shout if you think it isn't.

Not to libdl.so, but the INTERFACE_LINK_LIBRARIES in netCDFTargets.cmake now contains a reference to /usr/lib64/libdl.a instead. It's an empty static library so I'm not entirely sure if it even needs to be there but I suppose it takes care of anyone using -ldl now that those symbols are in the glibc-2.34 itself.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-07 23:21:27 UTC
(In reply to Jouni Kosonen from comment #10)
> (In reply to Sam James from comment #7)
> > I also can't reproduce this anymore (I think I could in the past) -- I don't
> > see any libdl reference in /usr/$(get_libdir)/cmake/netCDF/*, so I'm
> > guessing it's fixed in 4.8.1.
> > 
> > Please shout if you think it isn't.
> 
> Not to libdl.so, but the INTERFACE_LINK_LIBRARIES in netCDFTargets.cmake now
> contains a reference to /usr/lib64/libdl.a instead. It's an empty static
> library so I'm not entirely sure if it even needs to be there but I suppose
> it takes care of anyone using -ldl now that those symbols are in the
> glibc-2.34 itself.

# grep -rsin "libdl" /usr/lib64/cmake/netCDF
# grep -rsin "libdl" /usr/lib64/cmake/netCDF/netCDFTargets.cmake
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-07 23:22:23 UTC
Can you attach your bad CMake* files and I can see about just stripping them at install time for now?
Comment 13 Bernd 2022-04-08 06:38:22 UTC
(In reply to Sam James from comment #11)
> (In reply to Jouni Kosonen from comment #10)
> > (In reply to Sam James from comment #7)
> > > I also can't reproduce this anymore (I think I could in the past) -- I don't
> > > see any libdl reference in /usr/$(get_libdir)/cmake/netCDF/*, so I'm
> > > guessing it's fixed in 4.8.1.
> > > 
> > > Please shout if you think it isn't.
> > 
> > Not to libdl.so, but the INTERFACE_LINK_LIBRARIES in netCDFTargets.cmake now
> > contains a reference to /usr/lib64/libdl.a instead. It's an empty static
> > library so I'm not entirely sure if it even needs to be there but I suppose
> > it takes care of anyone using -ldl now that those symbols are in the
> > glibc-2.34 itself.
> 
> # grep -rsin "libdl" /usr/lib64/cmake/netCDF
> # grep -rsin "libdl" /usr/lib64/cmake/netCDF/netCDFTargets.cmake

$ grep libdl /usr/lib64/cmake/netCDF/*
/usr/lib64/cmake/netCDF/netCDFTargets.cmake:  INTERFACE_LINK_LIBRARIES "/usr/lib64/libhdf5_hl.so;/usr/lib64/libhdf5.so;/usr/lib64/libsz.so;/usr/lib64/libz.so;/usr/lib64/libdl.a;/usr/lib64/libm.so;/usr/lib64/libcurl.so;/usr/lib64/libzip.so"
$ ls -l /usr/lib64/libdl.a
-rw-r--r-- 1 root root 8  2. Apr 13:04 /usr/lib64/libdl.a
$ ar t /usr/lib64/libdl.a
$ 

I just re-emerged netcdf before posting, after I have discovered this as well, to ensure all is up-to-date.
Comment 14 Bernd 2022-04-08 06:39:20 UTC
Created attachment 769325 [details]
netCDFTargets.cmake

netCDFTargets.cmake for netcdf-4.8.1-r1

# emerge -pqv --usepkg=n netcdf
[ebuild   R   ] sci-libs/netcdf-4.8.1-r1  USE="dap hdf5 szip tools -doc -examples -hdf -mpi -test"
Comment 15 Stephen Bosch 2022-04-21 21:46:25 UTC
I encountered this problem also.

With sci-libs/netcdf-4.8.1-r1 built on 10.02.2022:

stephen@t470 2022-04-21 23:28:12 ~ $ grep -rsin "libdl" /usr/lib64/cmake/netCDF/netCDFTargets.cmake
67:  INTERFACE_LINK_LIBRARIES "/usr/lib64/libhdf5_hl.so;/usr/lib64/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so;/usr/lib64/libcurl.so;/usr/lib64/libzip.so"

After rebuilding sci-libs/netcdf-4.8.1-r1 on 21.04.2022:

stephen@t470 2022-04-21 23:29:55 ~ $ grep -rsin "libdl" /usr/lib64/cmake/netCDF/netCDFTargets.cmake
67:  INTERFACE_LINK_LIBRARIES "/usr/lib64/libhdf5_hl.so;/usr/lib64/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libdl.a;/usr/lib64/libm.so;/usr/lib64/libcurl.so;/usr/lib64/libzip.so"

sci-libs/vtk-9.0.3-r4 seems to be building normally now.
Comment 16 Egor 2022-04-22 13:18:12 UTC
*** Bug 839954 has been marked as a duplicate of this bug. ***
Comment 17 Michael Moon 2022-04-27 13:23:05 UTC
I ran into this bug today, simply rebuilding netcdf-4.8.1-r1 as Stephen Bosch notes in comment #15 seems to help.

My netcdf-4.8.1-r1 was previously built on 2022-01-12 with the errant libdl.so listing in /usr/lib64/cmake/netCDF/netCDFTargets.cmake
Comment 18 sargastic 2022-05-04 10:59:21 UTC
*** Bug 840728 has been marked as a duplicate of this bug. ***
Comment 19 Jernej Jakob 2022-05-21 00:24:52 UTC
I ran into this bug today too, 'emerge -1 netcdf' fixed vtk compilation.
Comment 20 Jordi PM 2022-05-21 12:17:17 UTC
I've got:

'''
ninja: error: '/usr/lib64/libdl.so', needed by 'lib64/libvtkexodusII-9.1.so.9.1.0', missing and no known rule to make it
 * ERROR: sci-libs/vtk-9.1.0-r2::gentoo failed (compile phase):
 *   ninja -v -j40 -l32 failed
'''

rebuilding netcdf fixed this as Bernd said. (#13)

Thank you.
Comment 21 Larry the Git Cow gentoo-dev 2022-06-08 05:25:13 UTC
The bug has been closed via the following commit(s):

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

commit d80313248373f4ba7b2ff7ddb940cac16476129e
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-08 05:18:39 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-08 05:19:38 +0000

    sci-libs/netcdf: avoid broken libdl hardcoding
    
    Closes: https://bugs.gentoo.org/827188
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-libs/netcdf/netcdf-4.8.1-r2.ebuild | 83 ++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)