1

我在我们这里的一个集群上成功地用 c++ 编译了一个程序,并带有 boost。我需要运行 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

谢谢

4

2 回答 2

2

最简单的选择是编译静态二进制文件。(使用gcc,使用-static。对于其他编译器,RTFM。)

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

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

如果您没有自己安装 Boost,您可以使用ldd main.

于 2011-01-19T19:49:02.277 回答
0

您在哪个平台上运行 SGE?所有节点的架构都相同吗?您正在使用哪些编译器?该库需要存在于每个节点上的相同位置,以便动态运行它。@larsmans 建议的选项可能是最好的主意(运行静态编译的二进制文件)。

于 2011-01-19T19:52:17.907 回答