在集群上加载库 [英] loading library on cluster
问题描述
我在这里拥有的集群上通过boost成功地用c ++编译了一个程序.我需要运行SGE脚本来运行仿真.我得到的错误是这个
I successfully compiled a program in c++, with boost, on a cluster we have here. I need to run an SGE script to run the simulation. The error I get is this
./main:加载共享时出错 库:libboost_thread.so.1.45.0: 无法打开共享对象文件:否 这样的文件或目录
./main: error while loading shared libraries: libboost_thread.so.1.45.0: cannot open shared object file: No such file or directory
启动程序时是否需要指定库的名称?我使用的脚本如下
Do I need to specify the name of the library when I launch the program? The script I used is below
#!/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
谢谢
推荐答案
最简单的选择是编译静态二进制文件. (对于gcc
,请使用-static
.对于其他编译器,请使用RTFM.)
The easiest option is to compile a static binary. (With gcc
, use -static
. For other compilers, RTFM.)
另一个选择是将LD_LIBRARY_PATH
环境变量设置为作业脚本中包含Boost库的目录:
Another option is to set the LD_LIBRARY_PATH
environment variable to the directory containing the Boost libraries, inside the job script:
LD_LIBRARY_PATH=/where/ever/you/installed/boost
如果您自己没有安装Boost,则可以使用ldd main
找出程序在哪里寻找其库.
If you didn't install Boost yourself, you can find out where your program is looking for its libraries with ldd main
.
这篇关于在集群上加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!