搜索

此内容没有您所选择的语言版本。

3.5. Software Collection Library Support

download PDF
In case you distribute libraries that you intend to use only in the Software Collection environment or in addition to the libraries available on the system, update the LD_LIBRARY_PATH environment variable in the enable scriptlet as follows:
export LD_LIBRARY_PATH="%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}"
The configuration ensures that the version of the library in the Software Collection is preferred over the version of the library available on the system if the Software Collection is enabled.

Note

In case you distribute a private shared library in the Software Collection, consider using the DT_RUNPATH attribute instead of the LD_LIBRARY_PATH environment variable to make the private shared library accessible in the Software Collection environment.

3.5.1. Using a Library Outside of the Software Collection

If you distribute libraries that you intend to use outside of the Software Collection environment, you can use the directory /etc/ld.so.conf.d/ for this purpose.

Warning

Do not use /etc/ld.so.conf.d/ for libraries already available on the system. Using /etc/ld.so.conf.d/ is only recommended for a library that is not available on the system, as otherwise the version of the library in the Software Collection might get preference over the system version of the library. That could lead to undesired behavior of the system versions of the applications, including unexpected termination and data loss.

Procedure 3.4. Using /etc/ld.so.conf.d/ for libraries in the Software Collection

  1. Create a file named %{?scl_prefix}libs.conf and adjust the spec file configuration accordingly:
    SOURCE2: %{?scl_prefix}libs.conf
    
  2. In the %{?scl_prefix}libs.conf file, include a list of directories where the versions of the libraries associated with the Software Collection are located. For example:
    /opt/provider/software_collection_1/root/usr/lib64/
    
    In the example above, the /usr/lib64/ directory that is part of the Software Collection software_collection_1 is included in the list.
  3. Edit the %install section of the spec file, so the %{?scl_prefix}libs.conf file is installed as follows:
    %install
    install -p -c -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/ld.so.conf.d/
    
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.