Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
124 stars 49 forks source link

Conda: librt.so needed #96

Open aosterthun opened 3 years ago

aosterthun commented 3 years ago

Hello,

I wanted to use conan at one point (#91), since I couldn't get it to work on my own, I used a global netcdf-cxx4 install for now. I recently started to use conda for python dependencies and found out that one can use conda for c++ as well. So I found that there is a netcdf-cxx4 package in conda-forge.

I tried using that, and it kinda works in regards to finding the headers and lib files, but I get another error when compiling my executable: make[2]: *** No rule to make target '/x86_64-conda_cos6-linux-gnu/sysroot/usr/lib/librt.so', needed by 'netcdf_cxx'. Stop.

My cmake file looks like this:

cmake_minimum_required(VERSION 3.14)

project(raframe)

find_package(netCDF)

include_directories(~/miniconda3/envs/raframe/include)

add_executable(netcdf_cxx examples/netcdf_cxx.cpp)
target_link_libraries(netcdf_cxx netCDF::netcdf)

And my conda environment contains the following packages:

# packages in environment at /home/arneo/miniconda3/envs/raframe:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
binutils_impl_linux-64    2.31.1               h6176602_1  
binutils_linux-64         2.31.1               h6176602_9  
bzip2                     1.0.8                h516909a_2    conda-forge/label/cf202003
ca-certificates           2019.11.28           hecc5488_0    conda-forge/label/cf202003
curl                      7.68.0               hf8cf82a_0    conda-forge/label/cf202003
gcc_impl_linux-64         7.3.0                habb00fd_1  
gcc_linux-64              7.3.0                h553295d_9  
gxx_impl_linux-64         7.3.0                hdf63c60_1  
gxx_linux-64              7.3.0                h553295d_9  
hdf4                      4.2.13            hf30be14_1003    conda-forge/label/cf202003
hdf5                      1.10.5          nompi_h3c11f04_1104    conda-forge/label/cf202003
jpeg                      9c                h14c3975_1001    conda-forge/label/cf202003
krb5                      1.16.4               h2fd8d38_0    conda-forge/label/cf202003
libcurl                   7.68.0               hda55be3_0    conda-forge/label/cf202003
libedit                   3.1.20170329      hf8c457e_1001    conda-forge/label/cf202003
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_5    conda-forge/label/cf202003
libnetcdf                 4.7.3           nompi_h9f9fd6a_101    conda-forge/label/cf202003
libssh2                   1.8.2                h22169c7_2    conda-forge/label/cf202003
libstdcxx-ng              9.1.0                hdf63c60_0  
ncurses                   6.1               hf484d3e_1002    conda-forge/label/cf202003
netcdf-cxx4               4.3.1           nompi_h6006711_102    conda-forge/label/cf202003
openssl                   1.1.1e               h516909a_0    conda-forge/label/cf202003
tk                        8.6.10               hed695b0_0    conda-forge/label/cf202003
zlib                      1.2.11            h516909a_1006    conda-forge/label/cf202003

Any hints on why I get this error ? Since the conda package for netcdf-cxx4 has been downloaded over 30000 times I guess this is a system specific issue ?

WardF commented 3 years ago

Interesting. It looks like the librt library (system runtime library) is missing from the environment. I'm not sure if this is something that conda would install or if it is assumed it would be part of the system-wide development kit. I've done a little bit of searching, and I see it is related to libc. I'm not entirely certain why there is a dependency on librt for netcdf-cxx4.

A little more searching turned up that librt contains functions for Real Time Solaris. Are you working on Solaris, and if so are you able to install librt using the system (or conda) package manager?

aosterthun commented 3 years ago

I'm working on Manjaro with the XFCE desktop environment. I havn't been able to find librt in either conda nor pacman or the AUR.

WardF commented 3 years ago

This is very interesting, then; everything I can find suggests that librt.so is a Solaris-specific library. I will keep digging to see if I can figure out what's going on.

On Tue, Sep 8, 2020 at 1:38 PM Arne Osterthun notifications@github.com wrote:

I'm working on a Manjaro with the XFCE desktop environment. I havn't been able to find librt in either conda nor pacman or AUR.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Unidata/netcdf-cxx4/issues/96#issuecomment-689092965, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABA74UV27BUYQXIA4H3456LSE2B4TANCNFSM4RAFPSUA .

aosterthun commented 3 years ago

Yeah it's really weird. Would it help if I tried to build netcdf from source to see if I can reproduce the error when building the library myself ? But since I'm able to install the lib through pamac install netcdf-cxx there shouldn't be a problem building the lib in general.

aosterthun commented 3 years ago

I found that there exists a similar error in conan: https://github.com/conan-io/conan/issues/3972. Maybe this is the same underlying issue.

WardF commented 3 years ago

Interesting, thanks for the link, I'm reading through that now. If you're able to try building from source and willing to report back if you encounter the same error, I would very much appreciate it. Also, what is the output if you run ldd on the netcdf-cxx4 library installed by conda, out of curiosity?

aosterthun commented 3 years ago

I had to change OS I'm now on:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

But I get the same error. For Ubuntu I don't need to test building manually because I already did that once and had no problem with that.

ldd output for libnetcdf_c++4.so:

linux-vdso.so.1 (0x00007ffca8fc7000)
        libnetcdf.so.18 => /home/arne/miniconda3/lib/./libnetcdf.so.18 (0x00007fa5e32b6000)
        libstdc++.so.6 => /home/arne/miniconda3/lib/./libstdc++.so.6 (0x00007fa5e30bf000)
        libgcc_s.so.1 => /home/arne/miniconda3/lib/./libgcc_s.so.1 (0x00007fa5e32a2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa5e2cce000)
        libmfhdf.so.0 => /home/arne/miniconda3/lib/././libmfhdf.so.0 (0x00007fa5e325e000)
        libdf.so.0 => /home/arne/miniconda3/lib/././libdf.so.0 (0x00007fa5e2c1f000)
        libhdf5_hl.so.100 => /home/arne/miniconda3/lib/././libhdf5_hl.so.100 (0x00007fa5e2bfa000)
        libhdf5.so.103 => /home/arne/miniconda3/lib/././libhdf5.so.103 (0x00007fa5e2876000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa5e2657000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa5e22b9000)
        libcurl.so.4 => /home/arne/miniconda3/lib/././libcurl.so.4 (0x00007fa5e222a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa5e3233000)
        libjpeg.so.9 => /home/arne/miniconda3/lib/./././libjpeg.so.9 (0x00007fa5e21ec000)
        libz.so.1 => /home/arne/miniconda3/lib/./././libz.so.1 (0x00007fa5e21cc000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa5e1fc4000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa5e1dc0000)
        libnghttp2.so.14 => /home/arne/miniconda3/lib/./././libnghttp2.so.14 (0x00007fa5e1d98000)
        libssh2.so.1 => /home/arne/miniconda3/lib/./././libssh2.so.1 (0x00007fa5e1d52000)
        libssl.so.1.1 => /home/arne/miniconda3/lib/./././libssl.so.1.1 (0x00007fa5e1cc2000)
        libcrypto.so.1.1 => /home/arne/miniconda3/lib/./././libcrypto.so.1.1 (0x00007fa5e19f6000)
        libgssapi_krb5.so.2 => /home/arne/miniconda3/lib/./././libgssapi_krb5.so.2 (0x00007fa5e19a7000)
        libkrb5.so.3 => /home/arne/miniconda3/lib/./././libkrb5.so.3 (0x00007fa5e18ce000)
        libk5crypto.so.3 => /home/arne/miniconda3/lib/./././libk5crypto.so.3 (0x00007fa5e18af000)
        libcom_err.so.3 => /home/arne/miniconda3/lib/./././libcom_err.so.3 (0x00007fa5e18a9000)
        libkrb5support.so.0 => /home/arne/miniconda3/lib/././././libkrb5support.so.0 (0x00007fa5e1898000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fa5e167d000)

And ldd output for libnetcdf.so:

linux-vdso.so.1 (0x00007ffe96290000)
        libmfhdf.so.0 => /home/arne/miniconda3/lib/./libmfhdf.so.0 (0x00007f776e9a4000)
        libdf.so.0 => /home/arne/miniconda3/lib/./libdf.so.0 (0x00007f776e84f000)
        libhdf5_hl.so.100 => /home/arne/miniconda3/lib/./libhdf5_hl.so.100 (0x00007f776e97f000)
        libhdf5.so.103 => /home/arne/miniconda3/lib/./libhdf5.so.103 (0x00007f776e4cb000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f776e2ac000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f776df0e000)
        libcurl.so.4 => /home/arne/miniconda3/lib/./libcurl.so.4 (0x00007f776de7f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f776da8e000)
        libjpeg.so.9 => /home/arne/miniconda3/lib/././libjpeg.so.9 (0x00007f776e927000)
        libz.so.1 => /home/arne/miniconda3/lib/././libz.so.1 (0x00007f776da6e000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f776d866000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f776d662000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f776e8fe000)
        libnghttp2.so.14 => /home/arne/miniconda3/lib/././libnghttp2.so.14 (0x00007f776d63a000)
        libssh2.so.1 => /home/arne/miniconda3/lib/././libssh2.so.1 (0x00007f776d5f6000)
        libssl.so.1.1 => /home/arne/miniconda3/lib/././libssl.so.1.1 (0x00007f776d566000)
        libcrypto.so.1.1 => /home/arne/miniconda3/lib/././libcrypto.so.1.1 (0x00007f776d29a000)
        libgssapi_krb5.so.2 => /home/arne/miniconda3/lib/././libgssapi_krb5.so.2 (0x00007f776d24b000)
        libkrb5.so.3 => /home/arne/miniconda3/lib/././libkrb5.so.3 (0x00007f776d172000)
        libk5crypto.so.3 => /home/arne/miniconda3/lib/././libk5crypto.so.3 (0x00007f776d151000)
        libcom_err.so.3 => /home/arne/miniconda3/lib/././libcom_err.so.3 (0x00007f776d14b000)
        libkrb5support.so.0 => /home/arne/miniconda3/lib/./././libkrb5support.so.0 (0x00007f776d13c000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f776cf21000)

I'm not sure, but I had problems in conan with using a wrong gcc/g++ when linking a SQLite library. Maybe the netcdf library in conda is build with a different gcc/g++ version.

I'm using gcc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 and g++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0.