答案在 BLCR 常见问题解答中提到:https ://upc-bugs.lbl.gov/blcr/doc/html/FAQ.html#staticlink
If you can checkpoint and restart a dynamically linked application correctly, but
cannot do so with the same application linked statically, this FAQ entry is for you.
There are multiple reasons why BLCR may have problems with statically executables.
The cr_run utility only supports dynamic executables
If you wish to checkpoint an unmodified executable, the typical recipe is
$ cr_run my_app my_args
However, the cr_run utility does its work using the "LD_PRELOAD" environment variable
to force loading of BLCR's support code into the address space the applications. That
mechanism is only functional for dynamically linked executables. There is no magic we
can perform today that will resolve this (though in the future we'd like to replace
our use of LD_PRELOAD with a kernel-side mechanism). So, you'll need to relink any
statically linked executables to include BLCR support.
** Linking BLCR's libraries statically takes special care **
OK, we've told you why cr_run doesn't work and told you to relink. You tried linking
with -lcr_run and/or -lcr and still can't get a checkpoint to work. What went wrong?
You need a -u option in addition the the -l or the static linking will simply ignore
BLCR's library.
** BLCR doesn't support LinuxThreads **
Ok, what else could go wrong? You've followed the guidance given in the "Cautionary
linker notes" section of the BLCR Users Guide when you linked your application. You
even ran
$ nm my_app | grep link_me
to be sure the symbol you specified with -u is linked in. However, you are seeing
weird crashes of your application when you try to checkpoint.
The culprit might be LinuxThreads. Why? Because at the time this FAQ entry is being
written, there are many Linux distributions that install the static libs for
LinuxThreads in the default library search path, and with the NPTL static libs
elsewhere. The resolution could be as simple as linking your application with -L/usr
/lib/nptl or -L/usr/lib64/nptl, perhaps by setting an "LDFLAGS" variable (though it is
possible that your distribution has picked some other location).
While it is not strictly required due to binary compatibility between LinuxThreads and
NPTL, we'd recommend that you at least consider a recompile with -I/usr/include/nptl
in CFLAGS.
Note, of course, that if BLCR's utilities are statically linked to LinuxThreads, then
they need to be rebuilt too. See the BLCR Admin Guide for more information on that.