-
Notifications
You must be signed in to change notification settings - Fork 23
Portable binaries
The well-known LD_PRELOAD
trick can be used to provide somewhat portable
DICOMautomaton
binaries for Linux
systems. Binaries from the
system-installed or locally-built DICOMautomaton
will be automatically
gathered by building and then invoking:
$> ./scripts/dump_portable_dcma_bundle.sh /tmp/portable_dcma/
If successful, the portable outputs will be dumped to /tmp/portable_dcma/
. A
convenience script that performs the preload trick and forwards all user
arguments is portable_dcma
.
Note that this trick works only on Linux
systems, and a similar Linux
system must be used to generate the binaries. The interactive Debian
Docker
container will likely suffice. Additionally this technique only provides the
dicomautomaton_dispatcher
binary. All shared libraries needed to run it are
bundled, including glibc
and some other intrinsic libraries in case the host
and target glibc
differ. If the patchelf
program is available, the binary
can be patched to use the bundled ld-linux.so
interpreter and glibc
using
the included adjusting_dcma
script, otherwise the system interpreter will be
used. If patchelf
is not available it is best to remove ld-linux
, libm
,
and libc
from the bundle and rely fully on the target glibc
. Mixing and
matching bits of different glibc
installations will almost certainly result in
segmentation faults or silent failures so it is not recommended in any
circumstances. Also note that compilation arguments and architecture-specific
tunings will likely ruin portability.
Alternatively, a third wrapper script (emulate_dcma
) uses qemu-x86_64
to
emulate a 64 bit x86 system and preload bundled libraries. This script may work
when the native LD_PRELOAD
trick fails, but emulation may be slow. The cpu can
be emulated, so it may be possible to support architecture-specific tunings this
way.
Portability, validity of the program, and full functionality are NOT
guaranteed using either script! They should all be considered experimental. The
preload trick is best run in a controlled environment, and targetting the same
controlled environment and architecture. This method of distributing
DICOMautomaton
is not officially supported, but can simplify distributing
custom builds in some situations.