Bug report #21507
Linker failure with undefined reference to `nc_inq_varids'
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Peter Petrik | ||
Category: | Build/Install | ||
Affected QGIS version: | 3.6.0 | Regression?: | No |
Operating System: | GNU/Linux | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29324 |
Description
sci-libs/netcdf-4.6.1-r1
sci-libs/gdal-2.3.1
origin/release-3_6 aff4f23559bc24a6979d35d02b11995a2d4f6bac
make[2]: Entering directory '/run/media//soft/qgis_trunk/build' [ 69%] Linking CXX shared module ../../../output/lib/qgis/plugins/libmdalprovider.so cd /run/media//soft/qgis_trunk/build/src/providers/mdal && /usr/bin/cmake -E cmake_link_script CMakeFiles/mdalprovider.dir/link.txt --verbose=1 /usr/bin/c++ -fPIC -Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing -O2 -g -DNDEBUG -Wl,--no-undefined -shared -o ../../../output/lib/qgis/plugins/libmdalprovider.so CMakeFiles/mdalprovider.dir/qgsmdalprovider.cpp.o CMakeFiles/mdalprovider.dir/qgsmdaldataitems.cpp.o CMakeFiles/mdalprovider.dir/qgsmdalsourceselect.cpp.o CMakeFiles/mdalprovider.dir/moc_qgsmdalprovider.cpp.o CMakeFiles/mdalprovider.dir/moc_qgsmdaldataitems.cpp.o CMakeFiles/mdalprovider.dir/moc_qgsmdalsourceselect.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/mdal.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/mdal_utils.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/mdal_data_model.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/mdal_memory_data_model.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/mdal_driver_manager.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_driver.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_2dm.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_ascii_dat.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_binary_dat.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_hdf5.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_xmdf.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_hec2d.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_flo2d.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_gdal.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_gdal_grib.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_cf.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_3di.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_netcdf.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_sww.cpp.o CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_gdal_netcdf.cpp.o -L/run/media//soft/qgis_trunk/build/src/core -L/run/media//soft/qgis_trunk/build/src/gui -Wl,-rpath,/run/media//soft/qgis_trunk/build/src/core:/run/media//soft/qgis_trunk/build/src/gui:/run/media//soft/qgis_trunk/build/output/lib: ../../../output/lib/libqgis_gui.so.3.6.0 -lhdf5 -lsz -lz -ldl -lm -lgdal -lnetcdf ../../../output/lib/libqgis_core.so.3.6.0 /usr/lib64/libQt5Xml.so.5.11.3 /usr/lib64/libQt5Svg.so.5.11.3 /usr/lib64/libQt5WebKitWidgets.so.5.212.0 /usr/lib64/libQt5PrintSupport.so.5.11.3 /usr/lib64/libQt5WebKit.so.5.212.0 /usr/lib64/libQt5Sql.so.5.11.3 /usr/lib64/libQt5Concurrent.so.5.11.3 -lqca-qt5 -lqt5keychain -lproj -lgeos_c -lspatialindex -lexpat -lsqlite3 -lspatialite -lzip /usr/lib64/libQt5Positioning.so.5.11.3 ../../../output/lib/libqgis_native.so.3.6.0 /usr/lib64/libQt5DBus.so.5.11.3 /usr/lib64/libQt5UiTools.a -lqwt6-qt5 -lqscintilla2_qt5 /usr/lib64/libQt5QuickWidgets.so.5.11.3 /usr/lib64/libQt5Widgets.so.5.11.3 /usr/lib64/libQt5Quick.so.5.11.3 /usr/lib64/libQt5Gui.so.5.11.3 /usr/lib64/libQt5Qml.so.5.11.3 /usr/lib64/libQt5Network.so.5.11.3 /usr/lib64/libQt5Core.so.5.11.3 -lgdal CMakeFiles/mdalprovider.dir/__/__/__/external/mdal/frmts/mdal_netcdf.cpp.o: In function `NetCDFFile::readArrNames[abi:cxx11]() const': /run/media//soft/qgis_trunk/external/mdal/frmts/mdal_netcdf.cpp:90: undefined reference to `nc_inq_varids' /run/media//soft/qgis_trunk/external/mdal/frmts/mdal_netcdf.cpp:96: undefined reference to `nc_inq_varids' collect2: error: ld returned 1 exit status make[2]: *** [src/providers/mdal/CMakeFiles/mdalprovider.dir/build.make:510: output/lib/qgis/plugins/libmdalprovider.so] Error 1
History
#1 Updated by Peter Petrik over 5 years ago
can you please paste me output from the cmake configure command to see if you correctly found netcdf library in cmake?
#2 Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Feedback
#3 Updated by marisn - over 5 years ago
I rm'ed by build directory and started from scratch – still the same. I also ran "make check" on my netcdf install and all tests passed successfully.
You have to be more precise on commands I should run. Here's an output of some of them:
grep -r -i netcdf CMakeFiles/* CMakeFiles/Makefile.cmake: "../external/mdal/cmake/FindNetCDF.cmake"
grep -i netcdf CMakeCache.txt NETCDF_INCLUDE_DIR:PATH=/usr/include NETCDF_LIBRARY:FILEPATH=/usr/lib64/libnetcdf.so mdalprovider_LIB_DEPENDS:STATIC=general;qgis_core;general;qgis_gui;general;/usr/lib64/libhdf5.so;general;/usr/lib64/libsz.so;general;/usr/lib64/libz.so;general;/usr/lib64/libdl.so;general;/usr/lib64/libm.so;general;/usr/lib/libgdal.so;general;/usr/lib64/libnetcdf.so; pkgcfg_lib_PC_NETCDF_netcdf:FILEPATH=/usr/lib/libnetcdf.so //Details about finding NetCDF FIND_PACKAGE_MESSAGE_DETAILS_NetCDF:INTERNAL=[/usr/lib64/libnetcdf.so][/usr/include][v()] PC_NETCDF_CFLAGS:INTERNAL= PC_NETCDF_CFLAGS_I:INTERNAL= PC_NETCDF_CFLAGS_OTHER:INTERNAL= PC_NETCDF_FOUND:INTERNAL=1 PC_NETCDF_INCLUDEDIR:INTERNAL=/usr/include PC_NETCDF_INCLUDE_DIRS:INTERNAL= PC_NETCDF_LDFLAGS:INTERNAL=-lnetcdf PC_NETCDF_LDFLAGS_OTHER:INTERNAL= PC_NETCDF_LIBDIR:INTERNAL=/usr/lib64 PC_NETCDF_LIBRARIES:INTERNAL=netcdf PC_NETCDF_LIBRARY_DIRS:INTERNAL= PC_NETCDF_LIBS:INTERNAL= PC_NETCDF_LIBS_L:INTERNAL= PC_NETCDF_LIBS_OTHER:INTERNAL= PC_NETCDF_LIBS_PATHS:INTERNAL= PC_NETCDF_PREFIX:INTERNAL=/usr PC_NETCDF_STATIC_CFLAGS:INTERNAL= PC_NETCDF_STATIC_CFLAGS_I:INTERNAL= PC_NETCDF_STATIC_CFLAGS_OTHER:INTERNAL= PC_NETCDF_STATIC_INCLUDE_DIRS:INTERNAL= PC_NETCDF_STATIC_LDFLAGS:INTERNAL=-lnetcdf PC_NETCDF_STATIC_LDFLAGS_OTHER:INTERNAL= PC_NETCDF_STATIC_LIBDIR:INTERNAL= PC_NETCDF_STATIC_LIBRARIES:INTERNAL=netcdf PC_NETCDF_STATIC_LIBRARY_DIRS:INTERNAL= PC_NETCDF_STATIC_LIBS:INTERNAL= PC_NETCDF_STATIC_LIBS_L:INTERNAL= PC_NETCDF_STATIC_LIBS_OTHER:INTERNAL= PC_NETCDF_STATIC_LIBS_PATHS:INTERNAL= PC_NETCDF_VERSION:INTERNAL=4.6.1 PC_NETCDF_netcdf_INCLUDEDIR:INTERNAL= PC_NETCDF_netcdf_LIBDIR:INTERNAL= PC_NETCDF_netcdf_PREFIX:INTERNAL= PC_NETCDF_netcdf_VERSION:INTERNAL= __pkg_config_arguments_PC_NETCDF:INTERNAL=QUIET;netcdf __pkg_config_checked_PC_NETCDF:INTERNAL=1
readelf -Ws /usr/lib64/libnetcdf.so.13.1.1 | grep nc_inq 108: 000000000001ee30 104 FUNC GLOBAL DEFAULT 11 nc_inq_attid 227: 0000000000026180 150 FUNC GLOBAL DEFAULT 11 nc_inq_var_filter 297: 000000000001eb40 95 FUNC GLOBAL DEFAULT 11 nc_inq_ndims 300: 0000000000025d30 170 FUNC GLOBAL DEFAULT 11 nc_inq_var 357: 000000000001ec00 103 FUNC GLOBAL DEFAULT 11 nc_inq_dimname 363: 000000000001ea70 104 FUNC GLOBAL DEFAULT 11 nc_inq_dim 414: 0000000000025cd0 96 FUNC GLOBAL DEFAULT 11 nc_inq_varid 521: 000000000001e030 90 FUNC GLOBAL DEFAULT 11 nc_inq_nvars 556: 000000000001edb0 114 FUNC GLOBAL DEFAULT 11 nc_inq_att 575: 0000000000025e40 26 FUNC GLOBAL DEFAULT 11 nc_inq_vardimid 596: 0000000000025fc0 143 FUNC GLOBAL DEFAULT 11 nc_inq_var_chunking 750: 000000000001ef10 95 FUNC GLOBAL DEFAULT 11 nc_inq_natts 782: 000000000001dac0 158 FUNC GLOBAL DEFAULT 11 nc_inq_path 810: 0000000000025e20 26 FUNC GLOBAL DEFAULT 11 nc_inq_varndims 854: 0000000000026220 300 FUNC GLOBAL DEFAULT 11 nc_inq_var_szip 917: 000000000001efe0 106 FUNC GLOBAL DEFAULT 11 nc_inq_attlen 955: 0000000000026170 6 FUNC GLOBAL DEFAULT 11 nc_inq_unlimdims 1002: 000000000001dfb0 113 FUNC GLOBAL DEFAULT 11 nc_inq 1101: 000000000001e090 188 FUNC GLOBAL DEFAULT 11 nc_inq_type 1120: 000000000001fe70 8 FUNC GLOBAL DEFAULT 11 nc_inq_libvers 1133: 000000000001ec70 103 FUNC GLOBAL DEFAULT 11 nc_inq_dimlen 1144: 000000000001def0 83 FUNC GLOBAL DEFAULT 11 nc_inq_format 1145: 0000000000025e00 27 FUNC GLOBAL DEFAULT 11 nc_inq_vartype 1158: 00000000000260e0 136 FUNC GLOBAL DEFAULT 11 nc_inq_var_endian 1163: 000000000001eba0 86 FUNC GLOBAL DEFAULT 11 nc_inq_unlimdim 1200: 000000000001ef70 107 FUNC GLOBAL DEFAULT 11 nc_inq_atttype 1266: 0000000000025e60 40 FUNC GLOBAL DEFAULT 11 nc_inq_varnatts 1279: 0000000000025e90 150 FUNC GLOBAL DEFAULT 11 nc_inq_var_deflate 1291: 0000000000025de0 24 FUNC GLOBAL DEFAULT 11 nc_inq_varname 1322: 000000000001ea10 96 FUNC GLOBAL DEFAULT 11 nc_inq_dimid 1339: 0000000000026050 143 FUNC GLOBAL DEFAULT 11 nc_inq_var_fill 1349: 000000000001df50 93 FUNC GLOBAL DEFAULT 11 nc_inq_format_extended 1352: 000000000001eea0 104 FUNC GLOBAL DEFAULT 11 nc_inq_attname 1355: 000000000001b670 583 FUNC GLOBAL DEFAULT 11 nc_inq_rec 1356: 000000000001de30 83 FUNC GLOBAL DEFAULT 11 nc_inq_base_pe 1371: 0000000000025f30 136 FUNC GLOBAL DEFAULT 11 nc_inq_var_fletcher32
#4 Updated by marisn - over 5 years ago
- Status changed from Feedback to Open
I managed to find the cause of this issue – nc_inq_varids is available only if netcdf is compiled with netcdf-4 support. nc_inq_varids are part of netcdf-4 API and thus not available if netcdf-4 is not enabled (in my case on Gentoo it can be enabled via HDF5 use flag).
Here's a bug report for netcdf: https://github.com/Unidata/netcdf-c/issues/851
QGIS cmake magick must be updated to check for presence of netcdf-4 API instead of a plain netcdf.
#5 Updated by Peter Petrik over 5 years ago
nice catch. it should be fixed here: https://github.com/lutraconsulting/MDAL/blob/master/cmake/FindNetCDF.cmake
as a sidenote, it seems that QGIS from OSGeo4W 3.4.3 has the symbols, but from 3.4.4 it does not. @Jurgen do you know if anything changed in the netcdf build between those versions?