简体   繁体   English

在 Linux Mint 上使用多个版本的 libboost

[英]Using multiple versions of libboost on Linux Mint

I am recompiling some C++ code on Linux Mint which makes use of libboost.我正在 Linux Mint 上重新编译一些使用 libboost 的 C++ 代码。 The code worked fine before an upgrade from Mint 18 to Mint 19.3.在从 Mint 18 升级到 Mint 19.3 之前,代码运行良好。 Since then, I can get the code to compile, but during execution it fails with an error generated by one or more calls to boost::filesytem::create_directories从那时起,我可以编译代码,但在执行过程中失败,并因一次或多次调用 boost::filesytem::create_directories 生成错误

Searching the 'net, it seemed that the problem could be due to library version incompatibilities and sure enough while 1.65 is installed, there appear to be libraries from 1.58 running around, in this folder for example /usr/lib/x86_64-linux-gnu (or something like that).在网上搜索,似乎问题可能是由于库版本不兼容引起的,并且在安装 1.65 时确实有,似乎有 1.58 的库在运行,例如在这个文件夹中 /usr/lib/x86_64-linux-gnu (或类似的东西)。

When I try a 'net solution like sudo rm -f /usr/lib/x86_64-linux-gnu/libboost_* (and then a reinstall) or sudo rm -f /usr/lib/x86_64-linux-gnu/libboost_*.so.1.5.8.0当我尝试像 sudo rm -f /usr/lib/x86_64-linux-gnu/libboost_*(然后重新安装)或 sudo rm -f /usr/lib/x86_64-linux-gnu/libboost_* 这样的网络解决方案时。 so.1.5.8.0

nothing changes (ie the files seem to remain as do the execution errors).没有任何变化(即文件似乎和执行错误一样保留)。

When I rerun a copy of the compiled code from before, the code doesn't fail.当我重新运行之前编译代码的副本时,代码不会失败。

Can anyone suggest how I can fix this problem?谁能建议我如何解决这个问题? The code I am compiling is massive and not my own, so I don't know where to start in changing the function call.我正在编译的代码很大而且不是我自己的,所以我不知道从哪里开始更改函数调用。 In fact, I don't think that is the problem.事实上,我不认为这是问题所在。 What I think I need to know is how to wipe out the remnants of the older install and/or repoint everything to the latest install.我想我需要知道的是如何清除旧安装的残余和/或将所有内容重新指向最新安装。

FWIW, I've tried the advice here Uninstall boost and install another version and it doesn't seem to move me along. FWIW,我在这里尝试过卸载提升并安装另一个版本的建议,但它似乎并没有让我继续前进。

(Posted a solution on behalf of the question author, in order to move the answer to the answer space) . (代题者贴出解决方案,以便把答案移到答案空间)

This was solved by not removing the system default version but instead installing other versions in different locations and then preferentially selecting them with the EXT_HINT flag for cmake.解决方法是不删除系统默认版本,而是在不同位置安装其他版本,然后优先使用 cmake 的 EXT_HINT 标志选择它们。

The boost site suggests (via the release notes for 1.60) that a fix was made related to create_directories' return value. boost 站点建议(通过 1.60 的发行说明)修复了与 create_directories 的返回值相关的问题。 In any case, I was able to get the code to work "as written" by pointing to version 1.58 during compilation, but not to version 1.60, 1.65 or 1.72.在任何情况下,我都能够通过在编译期间指向版本 1.58 而不是指向版本 1.60、1.65 或 1.72 来让代码“按编写的”工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM