You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

libpqxx版本升级、卸载、多版本共存及编译链接配置咨询

关于libpqxx版本升级与多版本共存的操作方案

一、安装libpqxx 7.1.1版本

  • 克隆源码仓库(若未保留仓库则执行):git clone https://github.com/jtv/libpqxx.git
  • 切换到7.1.1版本标签:cd libpqxx && git checkout 7.1.1
  • 配置编译参数:
    • 若无需保留旧版本,直接用默认路径(会覆盖6.4版本文件):./configure
    • 若要和旧版本共存,指定独立安装路径:./configure --prefix=/usr/local/libpqxx-7.1.1
  • 编译并安装:make && sudo make install

二、卸载当前6.4版本

分两种场景操作:

  1. 仍保留6.4版本的源码目录:
    • 进入对应源码目录:cd /path/to/libpqxx-6.4
    • 执行卸载命令:sudo make uninstall
  2. 源码已删除,手动清理文件:
    • 删除头文件:sudo rm -rf /usr/local/include/pqxx
    • 删除库文件:sudo rm -rf /usr/local/lib/libpqxx*.so* /usr/local/lib/libpqxx*.a
    • 删除pkg-config配置文件:sudo rm /usr/local/lib/pkgconfig/libpqxx.pc

    注:如果安装6.4时用了自定义prefix,替换上述路径为对应的安装路径即可

三、同时安装两个版本,编译链接时指定版本

可以同时安装,核心是给不同版本指定独立安装路径,编译程序时通过参数锁定目标版本:

  1. 安装阶段分别指定prefix:
    • 6.4版本:./configure --prefix=/usr/local/libpqxx-6.4 && make && sudo make install
    • 7.1.1版本:./configure --prefix=/usr/local/libpqxx-7.1.1 && make && sudo make install
  2. 编译程序时指定版本的两种方法:
    • 方法一:用pkg-config指定配置路径
      使用6.4版本:g++ your_code.cpp -o your_app $(PKG_CONFIG_PATH=/usr/local/libpqxx-6.4/lib/pkgconfig pkg-config --cflags --libs libpqxx)
      使用7.1.1版本:g++ your_code.cpp -o your_app $(PKG_CONFIG_PATH=/usr/local/libpqxx-7.1.1/lib/pkgconfig pkg-config --cflags --libs libpqxx)
    • 方法二:手动指定头文件与库路径
      使用6.4版本:g++ your_code.cpp -o your_app -I/usr/local/libpqxx-6.4/include -L/usr/local/libpqxx-6.4/lib -lpqxx
      使用7.1.1版本:g++ your_code.cpp -o your_app -I/usr/local/libpqxx-7.1.1/include -L/usr/local/libpqxx-7.1.1/lib -lpqxx

四、是否需要重新烧录BeagleBoneBlack系统?

完全不需要。上述所有操作都能在现有系统环境下完成,无需重装系统或从头安装所有组件。

内容的提问来源于stack exchange,提问作者otk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 14:01:05