loading library on cluster
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: 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
#开发者_StackOverflow$ -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
Thank you
The easiest option is to compile a static binary. (With gcc
, use -static
. For other compilers, RTFM.)
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
If you didn't install Boost yourself, you can find out where your program is looking for its libraries with ldd main
.
What platform are you running SGE on? Are all of the nodes the same architecture? Which compilers are you using? The library will need to be present, in the same location on each node of you are going to run it dynamically. The option suggested by @larsmans is probably the best idea (running a static compiled binary).
精彩评论