Error resolution: libcudart.so and libprotobuf.so link libraries not found

Error resolution: libcudart.so and libprotobuf.so link libraries not found

  • libcudart.so link library not found
    • reason
    • Solution
  • libprotobuf.so link library not found
    • reason
    • Solution

This blog introduces two errors encountered by bloggers when compiling software packages. The main problem is that the two dynamic link libraries libcudart and libprotobuf are not found. The reasons are analyzed and the solutions are given. The blogger’s software and hardware environment is as follows (for reference):

  • Linux
  • NVIDIA GeForce RTX 3080Ti
  • CUDA Driver Version 525.105.17
  • CUDA 11.1
  • gcc (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0

libcudart.so link library not found

libprotobuf.so is the dynamic link library file of the Google Protocol Buffers library. It is used for serialization and deserialization operations using Protocol Buffers data in computer systems.

The error is reported as follows:

/usr/bin/ld: warning: libcudart.so.11.0, needed by XXX, not found.

Reasons

cuda is not installed or there is a problem with the cuda version, or the version is too low, or the version is too high, you need to install CUDA >= 11.0 and CUDA <= 12.0.

Solution

Go to the official website, download the corresponding version of cuda and install it. For example, I chose to install cuda11.1, and then selected Linux-x86_64-Ubuntu-18.04-runfile (local), as shown in the figure below.

Note that if I choose deb (local) to install, the following error will be reported, so I choose runfile (local) to install.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 cuda : Depends: cuda-12-1 (>= 12.1.1) but it is not going to be installed
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and / etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and / etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list :1 and /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:1 and /etc/apt/ sources.list.d/borglab-ubuntu-gtsam-release-4_0-bionic.list:3
E: Unable to correct problems, you have held broken packages.

Run the following command to install successfully:

wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
sudo sh cuda_11.1.0_455.23.05_linux.run

For more detailed installation process, such as: how to check options after running the .run file, etc., you can refer to my other blog CUDA installation.

libprotobuf.so link library not found

libcudart.so is the dynamic link library file of the CUDA runtime library. CUDA (Compute Unified Device Architecture) is a platform and programming model for parallel computing developed by NVIDIA. This library provides the runtime support required when using CUDA for GPU programming.

The error is reported as follows:

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindProtobuf.cmake:624 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:31 (find_package)

or

/usr/bin/ld: warning: libprotobuf.so.17, needed by XXX, not found.

Reasons

protobuf is not installed or the system default installed protobuf version is lower, you need to follow the higher version of protobuf.

Solution

If running the command sudo apt install libprotobuf-dev fails to install the corresponding version of protobuf, you can install it as follows:

  1. Go to protobuf’s github official website to download the corresponding version (libprotobuf-dev==3.6.1 is installed here).
git clone https://github.com/protocolbuffers/protobuf.git
git checkout v3.6.1
  1. Run the following command to install:
./autogen.sh
./configure --prefix=/usr/local/protobuf #For easy management in the future
make -j4 #Multi-core compilation speeds up
sudo make install
  1. After installation, the location of the dynamic library is /usr/local/protobuf/lib/, and a soft link is created (or modified):
sudo ln -s /usr/local/protobuf/lib/libprotoc.so.17.0.0 /usr/lib/libprotoc.so
sudo ln -s /usr/local/protobuf/lib/libprotobuf.so.17.0.0 /usr/lib/libprotobuf.so
sudo ln -s /usr/local/protobuf/lib/libprotobuf-lite.so.17.0.0 /usr/lib/libprotobuf-lite.so

Please note this: If the original protobuf library location of your computer is not in /usr/local/protobuf/lib/, you need to modify it accordingly.