# Distributing ROOT binaries with my program

**URL:** <https://root-forum.cern.ch/t/distributing-root-binaries-with-my-program/59549>\
**Category:** ROOT\
**Tags:** root\
**Created:** [June 5, 2024, 11:42am UTC](https://root-forum.cern.ch/t/distributing-root-binaries-with-my-program/59549 "2024-06-05T11:42:33Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![pmanek](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pmanek/32/11692_2.png) [@pmanek](https://root-forum.cern.ch/u/pmanek)\
**Post date:** [June 15, 2024, 8:33am UTC](https://root-forum.cern.ch/t/distributing-root-binaries-with-my-program/59549/29 "2024-06-15T08:33:43Z")

</div>

@ferhue Yes, precisely. Having a minimalist `libCore` without cling would be ideal for small self-contained applications like mine, which just want to be compatible with ROOT file format.

In other news, I integrated and tested my `execv()` workaround from yesterday. Using strace I can now confirm that `libCling` honors `ROOTSYS` and loads `allDict.cxx.pch` from my packaged ROOT directory. What I do not understand is why headers are still scanned even when the pre-compiled header is found and loaded.

See the following strace snippet, where `/app` is the working directory and `ROOTSYS=/app/usr/share/foo/root`:

```cxx
stat("/app/usr/share/foo/root/etc//allDict.cxx.pch", {st_mode=S_IFREG|0644, st_size=79863920, ...}) = 0
openat(AT_FDCWD, "/app/usr/share/foo/root/etc//allDict.cxx.pch", O_RDONLY|O_CLOEXEC) = 15
readlink("/proc/self/fd/15", "/app/usr/"..., 4096) = 71
fstat(15, {st_mode=S_IFREG|0644, st_size=79863920, ...}) = 0
mmap(NULL, 79863920, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, 15, 0) = 0x7623e5c9b000
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
close(15) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
munmap(0x7623e5c9b000, 79863920) = 0
getcwd("/", 4097) = 28
stat("/", {st_mode=S_IFDIR|0755, st_size=200, ...}) = 0
brk(0x3dbef000) = 0x3dbef000
stat("<<< cling interactive line includer >>>", 0x7ffc8618ca28) = -1 ENOENT (No such file or directory)
mmap(NULL, 200704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7623fda4a000
openat(AT_FDCWD, "/app/usr/share/foo/root/etc//allDict.cxx.pch", O_RDONLY|O_CLOEXEC) = 15
readlink("/proc/self/fd/15", "/app/usr/"..., 4096) = 71
fstat(15, {st_mode=S_IFREG|0644, st_size=79863920, ...}) = 0
mmap(NULL, 79863920, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, 15, 0) = 0x7623e5c9b000
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
close(15) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
munmap(0x7623e5c9b000, 79863920) = 0
stat("/app/usr/share/foo/root/etc", {st_mode=S_IFDIR|0755, st_size=520, ...}) = 0
stat("/app/usr/share/foo/root/etc//cling", {st_mode=S_IFDIR|0755, st_size=100, ...}) = 0
stat("/app/usr/share/foo/root/etc//cling/plugins/include", 0x7ffc8618c0a8) = -1 ENOENT (No such file or directory)
stat("/app/usr/share/foo/root/etc//cling/plugins", 0x7ffc8618be98) = -1 ENOENT (No such file or directory)
stat("/app/usr/share/foo/root/include", {st_mode=S_IFDIR|0755, st_size=29700, ...}) = 0
stat("/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/x86_64-pc-linux-gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/backward", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/app/usr/share/foo/root/etc//cling/lib/clang/16/include", {st_mode=S_IFDIR|0755, st_size=3340, ...}) = 0
stat("/usr/local/include", {st_mode=S_IFDIR|0755, st_size=53248, ...}) = 0
stat("/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../x86_64-pc-linux-gnu/include", 0x7ffc8618c0a8) = -1 ENOENT (No such file or directory)
stat("/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../x86_64-pc-linux-gnu", 0x7ffc8618be98) = -1 ENOENT (No such file or directory)

...

lstat("/", {st_mode=S_IFDIR|0755, st_size=200, ...}) = 0
lstat("/app/usr", {st_mode=S_IFDIR|0755, st_size=160, ...}) = 0
lstat("/app/usr/bin", {st_mode=S_IFDIR|0755, st_size=80, ...}) = 0
lstat("/app/usr/share", {st_mode=S_IFDIR|0755, st_size=180, ...}) = 0
lstat("/app/usr/share/foo", {st_mode=S_IFDIR|0755, st_size=80, ...}) = 0
lstat("/app/usr/share/foo/root", {st_mode=S_IFDIR|0755, st_size=180, ...}) = 0
lstat("/app/usr/share/foo/root/lib", {st_mode=S_IFDIR|0755, st_size=3320, ...}) = 0
lstat("/app/usr/share/foo/root/lib/libCling.so", {st_mode=S_IFREG|0644, st_size=105949208, ...}) = 0
openat(AT_FDCWD, "/app/usr/share/foo/root/lib/libCling.so", O_RDONLY|O_CLOEXEC) = 15
fstat(15, {st_mode=S_IFREG|0644, st_size=105949208, ...}) = 0
mmap(NULL, 105949208, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, 15, 0) = 0x7623e43bb000
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
close(15) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
munmap(0x7623e43bb000, 105949208) = 0
brk(0x3dc74000) = 0x3dc74000
openat(AT_FDCWD, "/app/usr/share/foo/root/etc//allDict.cxx.pch", O_RDONLY|O_CLOEXEC) = 15
readlink("/proc/self/fd/15", "/app/usr/"..., 4096) = 71
fstat(15, {st_mode=S_IFREG|0644, st_size=79863920, ...}) = 0
fstat(15, {st_mode=S_IFREG|0644, st_size=79863920, ...}) = 0
mmap(NULL, 79863920, PROT_READ, MAP_PRIVATE|MAP_NORESERVE, 15, 0) = 0x7623e5c9b000
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
close(15) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
brk(0x3dc95000) = 0x3dc95000
stat("/tmp/root/root-6.32.00/build", 0x7ffc8618d7b8) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/<<< cling interactive line includer >>>", 0x7ffc8618d958) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/input_line_1", 0x7ffc8618d908) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/input_line_1", 0x7ffc8618d958) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/input_line_2", 0x7ffc8618d908) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/input_line_2", 0x7ffc8618d958) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/etc/cling/Interpreter", 0x7ffc8618d7b8) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/etc/cling/Interpreter/RuntimeUniverse.h", 0x7ffc8618d958) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/etc/cling/Interpreter/RuntimeOptions.h", 0x7ffc8618d908) = -1 ENOENT (No such file or directory)
stat("/tmp/root/root-6.32.00/build/etc/cling/Interpreter/RuntimeOptions.h", 0x7ffc8618d958) = -1 ENOENT (No such file or directory)

```

Then there are several thousand more `stat()` probes for headers in `/tmp/root/root-6.32.00/build`, which is where my ROOT package was built originally. Is it possible that even with `-Dgnuinstall=OFF` the build path was somehow persisted in the binaries?

---

_[View the full topic](https://root-forum.cern.ch/t/distributing-root-binaries-with-my-program/59549)._
