Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 778200 - sci-libs/netcdf-cxx-4.3.1 undefined reference to `nc_inq_attlen' when using rlibtool
Summary: sci-libs/netcdf-cxx-4.3.1 undefined reference to `nc_inq_attlen' when using...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
Depends on:
Blocks: slibtool
  Show dependency tree
Reported: 2021-03-25 17:29 UTC by Alessandro Barbieri
Modified: 2021-09-08 05:06 UTC (History)
2 users (show)

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

emerge_info (emerge_info,17.62 KB, text/plain)
2021-03-25 17:29 UTC, Alessandro Barbieri
netcdf-cxx-4.3.1:20210325-153453.log (netcdf-cxx-4.3.1:20210325-153453.log,173.39 KB, text/plain)
2021-03-25 17:29 UTC, Alessandro Barbieri
Details (netcdf-cxx-undefined.patch,1.97 KB, patch)
2021-03-25 19:34 UTC, orbea
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Barbieri 2021-03-25 17:29:15 UTC
This package fails to compile on an unstable system. Attached relevant logs and emerge --info
Comment 1 Alessandro Barbieri 2021-03-25 17:29:32 UTC
Created attachment 693456 [details]

emerge --info
Comment 2 Alessandro Barbieri 2021-03-25 17:29:34 UTC
Created attachment 693459 [details]

build log
Comment 3 Alessandro Barbieri 2021-03-25 17:38:16 UTC
rlibtool: compile: x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I.. -Os -pipe -march=native -fdiagnostics-color=always -Os -pipe -march=native -fdiagnostics-color=always -c ncString.cpp -DPIC -fPIC -o .libs/ncString.o                     
rlibtool  --tag=CXX   --mode=link x86_64-pc-linux-gnu-g++  -Os -pipe -march=native -fdiagnostics-color=always -Os -pipe -march=native -fdiagnostics-color=always -version-info 2:0:1 -no-undefined -Wl,-O1 -Wl,--as-needed -o libnetcdf_c++4.l
a -rpath /usr/lib64 ncAtt.lo ncCheck.lo ncCompoundType.lo ncDim.lo ncEnumType.lo ncException.lo ncFile.lo ncGroup.lo ncGroupAtt.lo ncOpaqueType.lo ncType.lo ncVar.lo ncVarAtt.lo ncVlenType.lo ncByte.lo ncChar.lo ncShort.lo ncInt.lo ncFloat.lo ncDouble.lo ncUbyte.lo ncUshort.lo ncUint.lo ncInt64.lo ncUint64.lo ncString.lo                                                                                                                                                          
rlibtool: lconf: {.name="libtool"}.                                                                                                                                                                                                           
rlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/var/tmp/portage/sci-libs/netcdf-cxx-4.3.1/work/netcdf-cxx4-4.3.1/cxx4"}.                                                                                                                       rlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 40, .st_ino = 28362}.                                                                                                                                                               
rlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].                                                                                                                                                                         
rlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 5.                                                                                                                                                                                    
rlibtool: lconf: fstat(5,...) = 0 {.st_dev = 40, .st_ino = 28342}.                                                                                                                                                                            
rlibtool: lconf: openat(5,"libtool",O_RDONLY,0) = 6.                                                                                                                                                                                          
rlibtool: lconf: found "/var/tmp/portage/sci-libs/netcdf-cxx-4.3.1/work/netcdf-cxx4-4.3.1/libtool".                                                                                                                                           
rlibtool: link: ln -s /dev/null .libs/libnetcdf_c++4.a.disabled                                                                                                                                                                               
rlibtool: link: x86_64-pc-linux-gnu-g++ .libs/ncAtt.o .libs/ncCheck.o .libs/ncCompoundType.o .libs/ncDim.o .libs/ncEnumType.o .libs/ncException.o .libs/ncFile.o .libs/ncGroup.o .libs/ncGroupAtt.o .libs/ncOpaqueType.o .libs/ncType.o .libs/
ncVar.o .libs/ncVarAtt.o .libs/ncVlenType.o .libs/ncByte.o .libs/ncChar.o .libs/ncShort.o .libs/ncInt.o .libs/ncFloat.o .libs/ncDouble.o .libs/ncUbyte.o .libs/ncUshort.o .libs/ncUint.o .libs/ncInt64.o .libs/ncUint64.o .libs/ncString.o -Os
 -pipe -march=native -fdiagnostics-color=always -Os -pipe -march=native -fdiagnostics-color=always -Wl,-O1 -Wl,--as-needed -shared -fPIC -Wl,--no-undefined -Wl,-soname -Wl, -o .libs/              
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/ncAtt.o: in function `netCDF::NcAtt::getAttLength() const':                                                                                             
ncAtt.cpp:(.text+0x1c0): undefined reference to `nc_inq_attlen'                                                                                                                                                                               
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/ncAtt.o: in function `netCDF::NcAtt::getValues(void*) const':                                                                                           
ncAtt.cpp:(.text+0x205): undefined reference to `nc_get_att'                                                                                                                                                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/ncAtt.o: in function `netCDF::NcAtt::getType() const':                                                                                                  
ncAtt.cpp:(.text+0x24d): undefined reference to `nc_inq_atttype'                                                                                                                                                                              
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/ncAtt.o: in function `netCDF::NcAtt::getValues(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const':                
ncAtt.cpp:(.text+0x39c): undefined reference to `nc_get_att'                                                                                                                                                                                  
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ncAtt.cpp:(.text+0x3aa): undefined reference to `nc_get_att_text'                                                                                             
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/ncAtt.o: in function `netCDF::NcAtt::getValues(char*) const':                                                                                           
ncAtt.cpp:(.text+0x538): undefined reference to `nc_get_att'
Comment 4 orbea 2021-03-25 18:37:50 UTC
This seems like a regression in netcdf-cxx since 4.3.0 which builds fine, their git repo is also affected.
Comment 5 orbea 2021-03-25 18:54:34 UTC
I did a git bisect.

6b6716eebc0a6291d104bb4228b8848a08d5187f is the first bad commit
commit 6b6716eebc0a6291d104bb4228b8848a08d5187f
Author: Julien Schueller <>
Date:   Tue Jun 13 20:18:41 2017 +0200

    Add mandatory -no-undefined dll LDFLAG

 cxx4/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

So another case that GNU libtool failed the developer...
Comment 6 orbea 2021-03-25 19:34:19 UTC
Created attachment 693669 [details, diff]

Patches to fix the undefined references.
Comment 7 orbea 2021-03-28 14:03:50 UTC
The issue in this report seems to not occur in their git repo.
Comment 8 orbea 2021-03-28 14:04:51 UTC
Ignore my above comment, wrong issue...
Comment 9 orbea 2021-05-10 20:46:54 UTC
An updated version of the patch was merged upstream.
Comment 10 Larry the Git Cow gentoo-dev 2021-09-08 05:06:39 UTC
The bug has been closed via the following commit(s):

commit df3e6bd9f56dd0d323e19abe242182f37fe802a2
Author:     Sam James <>
AuthorDate: 2021-09-08 05:06:15 +0000
Commit:     Sam James <>
CommitDate: 2021-09-08 05:06:32 +0000

    sci-libs/netcdf-cxx: fix build with slibtool
    Thanks-to: orbea <>
    Signed-off-by: Sam James <>

 .../files/netcdf-cxx-4.3.1-slibtool.patch          | 42 ++++++++++++++++++++++
 sci-libs/netcdf-cxx/netcdf-cxx-4.3.1.ebuild        |  4 +++
 2 files changed, 46 insertions(+)