C/C++ on the CLSP grid

From CLSP Wiki
Jump to: navigation, search

Dynamic Libraries

Compiling and executing programs often makes use of dynamic libraries. This is especially true of C and C++ programs and also true of many Python programs that link to C and C++ libraries (like numpy). In a shared environment sometimes you may want to control or inspect the shared libraries that are being linked in your job. Setting the following flags as hinted by the following code block and/or printing your environment at the beginning of your job, and running ldd on your program or shared library(ies), can help debug SGE jobs that go awry.

  export LD_TRACE_LOADED_OBJECTS=1
  export LD_DEBUG=libs
  export LD_PRELOAD=PATH_TO_LIBRARY_YOU_WANT_TO_FORCE
  export LD_LIBRARY_PATH=/path123/:  # paths to search for shared objects.
  printenv
  ldd ./binary_name  # prints all the shared objects which are referenced by this program