在 RHEL 6 上构建和 运行 一个 C++17/boost 程序

Building and running a C++17/boost program on RHEL 6

有一组正在构建的 C++98 程序和 运行 在 RHEL 6 上使用默认工具和提升版本 1.6。构建过程使用特定帐户下的一组 makefile 和 shell 脚本和 运行s。

我想在该过程中包含一个 C++17 程序,该程序使用 Developer's Toolset 8 提供的较新工具和最新版本的 boost。

问题 #1:如何在不干扰使用默认工具的其他程序的情况下执行此操作。将它们转换为也使用新工具不是一种选择。

问题#2:构建后,它也需要在 RHEL 6 下 运行,但它会使用不同版本的共享库(c++ 运行time、boost 等)从其他程序。我如何让它加载非默认的?

How do I do it without interfering with the other programs that use the default tools. Converting them to also use the new tools is not an option.

您更改此程序的 Makefile 以使用不同的编译器:

CC = /path/to/new/gcc
CXX = /path/to/new/g++
... etc.

After it is built, it needs to run under RHEL 6 as well, but it would use different versions of shared libraries (c++ runtime, boost, etc) from the other programs. How do I make it load the non-default ones?

您将新程序的 -rpath 更改为指向备用共享库安装目录

LDFLAGS = -Wl,-rpath=/path/to/alternate/installation/lib