装载集群库(loading library on cluster)

2019-09-29 09:07发布

我成功编译的C ++程序,具有推动作用,我们这里有一个集群上。 我需要运行一个脚本SGE运行仿真。 我得到的错误是这个

./main:错误而载入共享库:libboost_thread.so.1.45.0:无法打开共享对象文件:没有这样的文件或目录

我是否需要指定库的名字,当我启动程序? 我使用的脚本如下

#!/bin/sh
# (c) 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
# This is a simple example of a SGE batch script

# request Bourne shell as shell for job
#$ -S /bin/sh

#$ -N cr_number       # this name shows in qstat
#$ -S /bin/bash      # run with this shell
#$ -l h_rt=50:00:00  # need 50 hour runtime
#$ -pe mpich 4       # define parallel env
#$ -cwd     # run the job in the directory specified.
#$ -o cr_number.out
#$ -e cr_number.err
# (-j will merge stdout and stderr)

#$ -notify
#$ -M user@abc.com - send mail about this job to the given email address.
#$ -m beas          # send a mail to owner when the job
#                       begins (b), ends (e), aborted (a),
#                       and suspended(s).         and suspended(s).

./main

谢谢

Answer 1:

最简单的办法是编译静态二进制。 (配gcc ,使用-static 。对于其它的编译器,RTFM。)

另一种选择是设置LD_LIBRARY_PATH环境变量设置为包含Boost库,作业脚本里面的目录:

LD_LIBRARY_PATH=/where/ever/you/installed/boost

如果您没有安装升压你自己,你能找出你的程序正在寻找与库ldd main



Answer 2:

什么平台你在运行SGE? 是否所有节点的相同的架构? 其编译器您使用? 图书馆将需要存在,在每个节点上的相同位置的你要动态地运行它。 通过@larsmans建议的选项可能是最好的办法(运行静态编译的二进制)。



文章来源: loading library on cluster