如何在詹金斯上设置LD_LIBRARY_PATH [英] How to set LD_LIBRARY_PATH on Jenkins

查看:85
本文介绍了如何在詹金斯上设置LD_LIBRARY_PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从詹金斯(Jenkins)运行作业时遇到java.lang.UnsatisfiedLinkError问题.

I am having java.lang.UnsatisfiedLinkError problem while running a job from Jenkins.

 <error message="no JSTAF in java.library.path" type="java.lang.UnsatisfiedLinkError">java.lang.UnsatisfiedLinkError: no JSTAF in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
        at java.lang.Runtime.loadLibrary0(Runtime.java:840)
        at java.lang.System.loadLibrary(System.java:1047)

基本上我需要设置LD_LIBRARY_PATH,并且设置它时,它可以从命令行执行中正常工作.例如,当我如下设置LD_LIBRARY_PATH时:

Basically I need to set LD_LIBRARY_PATH and when this is set, it works fine from command line execution. For example, when I set LD_LIBRARY_PATH like following:

export LD_LIBRARY_PATH=</proj/lib>:$LD_LIBRARY_PATH

设置后,可以从命令行正常执行代码.

Upon setting, the code execution works fine from command line.

我尝试使用EnvInjectPlugin设置此LD_LIBRARY_PATH并注入LD_LIBRARY_PATH.

I have tried to set this LD_LIBRARY_PATH using the EnvInjectPlugin and injected the LD_LIBRARY_PATH.

我仍然不确定为什么詹金斯没有拿起这个LD_LIBRARY_PATH.如何进行设置,以使詹金斯的工作执行能够正常进行?

Still I am not sure why Jenkins is not picking up this LD_LIBRARY_PATH. How to set this up so that Jenkins job execution will work?

推荐答案

我昨天在这里发布了一个类似问题的答案:

I posted an answer to a similar question yesterday here: KDevelop4: Error while loading shared libraries

实际上,在许多Linux操作系统中不建议使用LD_LIBRARY_PATH.为此,请使用/etc/ld.so.conf.d中的配置文件,并在启动Jenkins之前运行ldconfig. (请参见以上引用的帖子)

In practice, LD_LIBRARY_PATH is deprecated in many Linux OS. Use config files in /etc/ld.so.conf.d for that and run ldconfig before starting Jenkins. (see the above cited post)

编辑[解决方案]:

在聊天中讨论了该问题后,通过添加以下内容解决了该问题:

after having discussed it in chat, the problem has been solved by adding :

#!/bin/bash
export LD_LYBRARY_PATH=${LD_LIBRARY_PATH}:<myPathForJenkins>

/etc/profile.d/中的简短脚本中,并使用chmod +x

in a short script in /etc/profile.d/ and setting it executable with chmod +x

这篇关于如何在詹金斯上设置LD_LIBRARY_PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆