icaro
January 30, 2018, 7:21pm
1
Hi
When I try to run a python shell script, like:
subprocess.call('./DumpWCDataCluster_pr ' + pr_files[i] + ' T_charge_cluster > pr_cluster.txt', shell= True)
I get the following error:
dyld: Library not loaded: @rpath/libCore.so
Referenced from: /Users/ivan/Work/Cosmic_discriminator/./DumpWCDataCluster_pr
Reason: image not found
/bin/sh: line 1: 13182 Abort trap: 6 ./DumpWCDataCluster_pr pr_files/pr_8556_8_438.root T_charge_cluster > pr_cluster.txt
Within my script I call upon the apparently missing library by doing,
os.getenv('$DYLD_LIBRARY_PATH')
I am running macOS High Sierra 10.13.3 with Root version 6.12/04.
I’ve also tried what was suggested in this post without any results.
Regards,
Ivan
Danilo
January 31, 2018, 7:50am
2
Hi,
it’s not clear to me what you mean by “calling upon the apparently missing library”.
Is the environment set correctly before invoking python or are you trying to set it for the invocation of your executable only from within the Python script?
D
amadio
January 31, 2018, 10:22am
3
If which python
points to /usr/bin/python
, then there is a “feature” of Mac OS that strips DYLD_LIBRARY_PATH
for you. See https://stackoverflow.com/a/35570229/1034717 for more details. You may have to set the variable from within your script for it to work, as suggested in the link.
icaro
February 1, 2018, 12:24am
4
Hi,
What I mean is that outside of the python shell (before running my script), the enviromental variable is defined. I can verify this by doing,
$ echo $DYLD_LIBRARY_PATH
/Applications/root_v6.12.04/lib
It does not load $DYLD_LIBRARY_PATH when running my root program within python shell script.
suhl
February 1, 2018, 8:31am
5
But the environment variable is not defined in python, you could try
$ python
>>> import os
>>> print os.getenv("DYLD_LIBRARY_PATH")
None
So any subprocess of python will not know about this variable.
You could try to add the required rpath during the linking stage of DumpWCDataCluster_pr
with -Wl,-rpath,${ROOTSYS}/lib
(or similar).
amadio
February 1, 2018, 8:50am
6
Inside Python the variable is not defined because Mac OS strips its value when running things from /usr
.
1 Like
ksmith
February 1, 2018, 5:02pm
7
If you compile the outside process with the correct rpath, then DYLD_LIBRARY_PATH
is not necessary. For example these flags to the gcc
compiler:
-Wl,-rpath,$ROOTLIBDIR
system
Closed
February 15, 2018, 5:02pm
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.