Build Issue#
#
Protobuf (protoc) Version Conflict#
Problem#
When installing dependencies like ROS or OpenCV on a system (e.g., UPC), or if an older version of protoc is pre-installed, the following error might occur during pip install or cmake:
Error Message:#
# error This file was generated by an older version of protoc which is
This happens because a lower-priority protoc version is being used instead of the required version.
Solution:#
Download the Correct protoc Version
Visit the Protobuf Releases page and download the appropriate protoc version based on your architecture:
For ARM (e.g., UPC): protoc-21.12-linux-aarch_64.zip
For x86: protoc-21.12-linux-x86_64.zip
Extract the Archive
Extract the downloaded .zip file:
unzip protoc-21.12-linux-YOUR_ARCHITECTURE.zip -d protoc-21.12
Update PATH
Set the extracted protoc binary directory at the beginning of your PATH environment variable:
Replace /path/to/extracted with the actual path where the archive was extracted.
By placing the required protoc version at the start of the PATH environment variable, the system prioritizes it over older versions already installed.
export PATH="/path/to/extracted/protoc-21.12/bin:$PATH"
Verification
Run the following command to confirm the correct version of protoc is being used:
nvidia@tegra-ubuntu:~$ protoc --version
libprotoc 3.21.12
Retry Build or Installation After updating the PATH, retry the cmake or pip command. The issue should now be resolved.
CMake Preset Error#
Problem:#
An error occurs when running CMake with the --preset option: “The source directory does not exist.”
Error Message:#
user@hostname:~/project-directory$ cmake --preset conan-release
CMake Error: The source directory "/home/user/project-directory/conan-release" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Solution:#
Check CMake Version:#
This error is often caused by using an older CMake version. Ensure that your CMake version is 3.23 or higher.
cmake --version
If the version is outdated, refer to the installation process in the CMake installation section to upgrade to the latest version.
In most cases, the issue can be resolved by following the above steps. If the problem persists, review the following items.
Additional Checks:#
Preset Path: Make sure you are running the CMake command from the project’s root directory.
Preset Name: Verify that the preset name defined in the
CMakePresets.jsonfile is correct.Git Submodule: Ensure that the submodules are properly initialized when cloning the project.
git submodule update --init --recursive
References:#
For more detailed information, refer to the Building Projects Using CMake Presets documentation.