Tried to get up and running with Davinci Resolve yesterday, and lets just say it wasn't a smooth experience
. Turns out onetbb
causes it to hang on launch, and one of the recommended fixes is to rename libOpenCL.so temporarily. Thus bringing about the birth of this script.
#!/bin/bash
# /usr/bin/start-resolve.sh
# hacky startup script for bugged davinci resolve on systems running onetbb
# renames libOpenCL.so to bypass davinci hang, then restores
user="kilo" # replace with the username you use resolve with
exec=/opt/resolve/bin/resolve "$@"
dir="/opt/intel/oneapi/compiler/2023.0.0/linux/lib"
file="libOpenCL.so"
delay=2
rename() {
from="$dir/$file"
to="$dir/_$file"
if [ $1 == 1 ]; then
if ! [ -f $from ]; then return 0; fi
echo "renaming $from"
mv $from $to
else
if ! [ -f $to ]; then return 0; fi
echo "restoring $from"
mv $to $from
fi
return 1
}
restore() {
sleep $delay
rename 0
}
launch() {
echo "running $exec as user $user"
sudo -u $user $exec ;
}
cleanup() { rename 0; }
trap cleanup EXIT
rename 1
restore & launch
Unfortunately it requires root to run mv in this location, so chmod +x the file. That means you'll need to type a password to run Resolve. A bit annoying, but not the end of the world.
I tried to slap this into a desktop file, and run in the background, but was unsuccessful. That means I've been running it with the terminal open. So, in it's current state, that's another slight annoyance. Oh well, beats manually renaming the file manually every time, I guess.
[Desktop Entry]
Version=1.0
Type=Application
Name=DaVinci Resolve
GenericName=DaVinci Resolve
Comment=Revolutionary new tools for editing, visual effects, color correction and professional audio post production, all in a single application!
Path=/opt/resolve/
Exec=sudo -i sh -c "/usr/bin/start-resolve %u"
Terminal=true
MimeType=application/x-resolveproj;
Icon=/opt/resolve/graphics/DV_Resolve.png
StartupNotify=true
Name[en_US]=DaVinci Resolve
StartupWMClass=resolve
I'm new to bash, and always open to suggestions and criticisms. If anyone knows how to make this run in the background, I'd gladly update this post with the provided information. I tried Exec=sudo -i sh -c "/usr/bin/start-resolve %u &"
, and a couple other weird things, but it refuses to run.
Edit: Whoops, slight bug in the .sh causing the file not to be renamed back on delay, fixed.
Edit 2: One solution is to use Exec=sudo -i bash -c "nohup /usr/bin/start-resolve %u &"
but I'm not sure if that's ideal since I read it'll persist through logout.