码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Resolving Protobuf Configuration Issue Without Sudo Access


    Resolving Protobuf Configuration Issue Without Sudo Access

    When compiling projects that depend on the Protocol Buffers (protobuf) library, you may encounter configuration errors if the library is not found. In environments where you don’t have sudo privileges, the solution requires a bit more effort.

    Problem Description

    During the CMake build configuration process, you might encounter an error like:

    Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
    
    • 1

    This suggests that CMake is unable to locate the protobuf libraries and include directories.

    Solution

    1. Download Protobuf Source

    First, obtain the Protobuf source code from the official repository:

    wget https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-all-3.17.3.tar.gz
    
    • 1

    Note: Adjust the version number and URL based on the version you need.

    2. Extract and Build Protobuf

    Extract the downloaded source and build it:

    tar xvf protobuf-all-3.17.3.tar.gz
    cd protobuf-3.17.3
    ./configure --prefix=$HOME/local
    make
    make install
    
    • 1
    • 2
    • 3
    • 4
    • 5

    This compiles and installs protobuf in a local directory within your home directory.

    3. Adjust Environment Variables

    Update your environment variables to ensure tools and libraries can find your local protobuf installation:

    export PATH=$HOME/local/bin:$PATH
    export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
    export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig:$PKG_CONFIG_PATH
    
    • 1
    • 2
    • 3

    To make these changes permanent, add the above lines to your .bashrc or .bash_profile.

    4. Re-run CMake

    Navigate back to your project’s build directory and run CMake:

    cd /path/to/your/build/directory
    cmake ..
    
    • 1
    • 2

    If CMake is still unable to find Protobuf, you can specify the paths manually:

    cmake -DProtobuf_INCLUDE_DIR=$HOME/local/include -DProtobuf_LIBRARIES=$HOME/local/lib ..
    
    • 1
  • 相关阅读:
    基于混合整数遗传算法的最优成分选择(Matlab代码实现)
    C++ “引用”究竟是什么?(代码实测)
    idea导入eclipse项目,不能直接open!
    生产型企业中采购管理系统的优势有哪些?
    03UEc++【打飞艇:导弹与飞艇的碰撞事件】
    点云从入门到精通技术详解100篇-基于点云数据的工件三维重建
    MS Access 教程之 如何在不覆盖标题字段的情况下将 Excel 数据导入 MS Access 现有表?
    第2周学习:卷积神经网络基础
    扩散模型:DDPM代码的学习(基于minist数据集)
    Hive3 单机版(含Derby 多用户及Spark on Hive)
  • 原文地址:https://blog.csdn.net/weixin_38396940/article/details/133572539
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号