Closed charleswilmot closed 2 years ago
Hello @charleswilmot, we have very little experience with PyRep. From my understanding, CoppeliaSim V4.1 is still the reference version to work with PyRep.
If you are having difficulties with Qt library versions being used, recompiling everything from scratch is quite an endeavour, since it is not just CoppeliaSimLib, but most items around it too (plugins, etc.).
Maybe a better approach would be to adjust the rpaths of all executables, instead of using the coppeliaSim.sh launch script. e.g:
patchelf --set-rpath '$ORIGIN' execOrLib
And using several rpath for items in sub-folders, to make sure the correct item is found e.g.:
patchelf --set-rpath '$ORIGIN:$ORIGIN/..:$ORIGIN/../..' folder1/folder2/execOrLib
Also make sure you keep existing rpaths and just append to them, when they are relative. Following Python script could be useful, it will work on a CoppeliaSim folder:
import os
import re
import sys
l=len(sys.argv)
dirName = sys.argv[1]
def getFilesAndDirs(d):
for (dirpath, dirnames, filenames) in os.walk(d,followlinks=False):
retFiles = []
retDirs = []
for filename in filenames:
retFiles.append(os.path.join(dirpath,filename))
for dd in dirnames:
retDirs.append(os.path.join(dirpath,dd))
return retFiles,retDirs
def handleFile(f,l):
fn,extent = os.path.splitext(f.lower())
if ((f.endswith(".so") == True) or (re.search("\.so\.([^/])+",f) != None) or ((extent == '') and (l == 0)) ) and (re.search("libtbb",f) == None):
toAdd = ""
for i in range(l+1):
x = "$ORIGIN"
for j in range(i):
x = x + "/.."
if i > 0:
toAdd = toAdd + ":"
toAdd = toAdd + x
stream = os.popen("readelf -d "+f+" |head -20")
txt = stream.read()
x = re.search("\(RUNPATH\) *Library runpath: \[(([^\]])*)\]",txt)
toKeep = ''
if x and x.group(1):
x = x.group(1)
if x[0] == '/':
if re.search("/home",x) == None:
toKeep=x # absolute and apparently generic path. Keep it!
if toKeep[len(toKeep)-1] == ':':
toKeep = toKeep[:-1]
rpath = toKeep
if len(rpath) != 0:
rpath = rpath + ':' + toAdd
else:
rpath = toAdd
stream = os.popen("patchelf --set-rpath '"+rpath+"' "+f,'w')
def handleFiles(d,l):
files,dirs=getFilesAndDirs(d)
for f in files:
handleFile(f,l)
for f in dirs:
handleFiles(f,l+1)
handleFiles(dirName,0)
Thank you very much for your help! Actually I had to implement a very similar script a few weeks ago to be able to run PyRep
on Fedora.
I will check if tweaking the rpaths can help in the present case.
BTW, as far as I can tell, PyRep
works flawlessly with CoppeliaSim
4.3 as well, I never experienced any issue.
I found a workaround for now, so I will close this issue.
What I'm doing is that I'm using PyQt6
instead of PyQt5
, which does not conflict with CoppeliaSim's version of Qt.
Hello,
For a Reinforcement Learning research project, I'm trying to use
CoppeliaSim
in conjunction withPyRep
andPyQt
.A problem arises within python when importing both
PyRep
andPyQt5
at the same time, due to different Qt versions being at play.I've been trying to recompile
CoppeliaSim
, linking it to my local install of Qt (eg. Qt 5.12.2 in/usr/lib64
) however, after two days of progress, I came to a dead end.At this point, I can compile
libcoppeliaSim.so
but starting thecoppeliaSim.sh
script ends in a segmentation fault.What is the best approach to using
CoppeliaSim
+PyRep
+PyQt
?For anyone who would like to recompile
CoppeliaSim 4.3.0
, here is the script that I used: