# Is it possible to run compiled standalone application from anywhere on a system?

**URL:** <https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566>\
**Category:** Cling\
**Tags:** cling\
**Created:** [January 14, 2020, 5:06pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566 "2020-01-14T17:06:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![p73](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/p73/32/14141_2.png) [@p73](https://root-forum.cern.ch/u/p73)\
**Post date:** [January 14, 2020, 5:06pm UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/1 "2020-01-14T17:06:08Z")

</div>

Hi, ROOTers

I have compiled a standalone GUI application _successully_. However, there is a problem which I describe below.

# Preliminaries

The structure of the working directory is the following

### Before `make`

```auto
.
├── DummyLinkDef.h
├── inc
│ ├── Dummy.h
│ └── Includes.h
├── Makefile
└── src
    ├── Dummy.cpp
    └── Main.cpp

```

Where `make` is the following lines

```auto
g++ -I./inc -c src/Dummy.cpp `root-config --cflags --glibs` 
g++ -I./inc -c src/Main.cpp `root-config --cflags --glibs`
rootcling -f Dummy.cxx inc/Dummy.h inc/Includes.h DummyLinkDef.h 
g++ -I./inc Dummy.o Main.o Dummy.cxx `root-config --cflags --glibs` -o Dummy 

```

### After `make`:

```auto
.
├── Dummy
├── Dummy.cxx
├── DummyLinkDef.h
├── Dummy.o
├── Dummy_rdict.pcm
├── inc
│ ├── Dummy.h
│ └── Includes.h
├── Main.o
├── Makefile
└── src
    ├── Dummy.cpp
    └── Main.cpp

```

# The Problem

I can run `Dummy` executable successfully only in the working directory. However, If I add it to stanard `PATH` (e.g. `/usr/bin`) and try to execute it, say, from a directory above I get the following message:

```auto
Error in <TCling::RegisterModule>: cannot find dictionary module Dummy_rdict.pcm

```

However, it seems that slots, for example, work fine. Anyway my question is _is there a way to run `Dummy` from anywhere properly_?

I attach full directory if it is needed. [Test.zip](https://root-forum.cern.ch/uploads/short-url/iFRPzHoZIA5ugWcNOIzZCkDQBBo.zip) (2.4 KB)

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [January 15, 2020, 8:44am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/2 "2020-01-15T08:44:38Z")

</div>

You probably need to copy the `.pcm` file to the same `PATH` as the binary, as the binary searches for it in the same directory. This is a restriction that started with ROOT 6.18 as far as I know (pcms have to be in the same directory as libraries or binaries that make use of them).

---

<div class="post-metadata">

**Author:** ![p73](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/p73/32/14141_2.png) [@p73](https://root-forum.cern.ch/u/p73)\
**Post date:** [January 15, 2020, 9:53am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/3 "2020-01-15T09:53:09Z")

</div>

> [@amadio](#):
>
> You probably need to copy the `.pcm` file to the same `PATH` as the binary

No, it doesn’t work. I copied `*.pcm` to the `/usr/bin/` but nothing changed. The same error. BTW, I cannot see any errors in my program. All works fine but at the start of execution I see errors:

```auto
Error in <TCling::RegisterModule>: cannot find dictionary module Dialogs_rdict.pcm
Error in <TCling::RegisterModule>: cannot find dictionary module CaenGUI_rdict.pcm

```

It seems it is not a problem but I don’t like mysterious errors anyway. Is it a possibility to extend the path for searching \*.pcm files?

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [January 15, 2020, 10:00am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/4 "2020-01-15T10:00:12Z")

</div>

It is not the same error, now you are missing other dictionaries (Dialogs\_rdict.pcm and CaenGUI\_rdict.pcm instead of Dummy\_rdict.pcm). If the dictionaries are in the same place as their respective libraries/binaries, and you have LD\_LIBRARY\_PATH set to contain the path to the libraries, it should work.

---

<div class="post-metadata">

**Author:** ![p73](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/p73/32/14141_2.png) [@p73](https://root-forum.cern.ch/u/p73)\
**Post date:** [January 15, 2020, 10:06am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/5 "2020-01-15T10:06:59Z")

</div>

> [@amadio](#):
>
> It is not the same error, now you are missing other dictionaries (Dialogs\_rdict.pcm and CaenGUI\_rdict.pcm instead of Dummy\_rdict.pcm).

Sorry for the confusion. The original post was a simple example in order to other users could reproduce the error. But I am working on a more complicated example. So the last errors are from it.

---

<div class="post-metadata">

**Author:** ![p73](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/p73/32/14141_2.png) [@p73](https://root-forum.cern.ch/u/p73)\
**Post date:** [January 15, 2020, 11:02am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/6 "2020-01-15T11:02:06Z")

</div>

> [@amadio](#):
>
> If the dictionaries are in the same place as their respective libraries/binaries, and you have LD\_LIBRARY\_PATH set to contain the path to the libraries, it should work.

Affirmative. Thank you. However, I also had to extend `CPLUS_INCLUDE_PATH`. Otherwise, I had errors. But I am not sure this problem is relevant here.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [January 29, 2020, 11:02am UTC](https://root-forum.cern.ch/t/is-it-possible-to-run-compiled-standalone-application-from-anywhere-on-a-system/37566/7 "2020-01-29T11:02:07Z")

</div>

Closed on January 29, 2020, 11:02am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
