0

I have been trying to reproduce a framework from a paper where it uses Kinect Fusion library.

When I am running a test script, I got the errors:

(darnn) weizhang@long:~/DA-RNN$ sudo ./experiments/scripts/test_kinect_fusion.sh 0
+ set -e
+ export PYTHONUNBUFFERED=True
+ PYTHONUNBUFFERED=True
+ export CUDA_VISIBLE_DEVICES=0
+ CUDA_VISIBLE_DEVICES=0
++ date +%Y-%m-%d_%H-%M-%S
+ LOG=experiments/logs/test_kinect_fusion.txt.2018-06-17_12-44-13
+ exec
++ tee -a experiments/logs/test_kinect_fusion.txt.2018-06-17_12-44-13
+ echo Logging output to experiments/logs/test_kinect_fusion.txt.2018-06-17_12-44-13
Logging output to experiments/logs/test_kinect_fusion.txt.2018-06-17_12-44-13
+ ./tools/test_kinect_fusion.py --gpu 0 --imdb rgbd_scene_trainval --cfg experiments/cfgs/rgbd_scene.yml --rig data/RGBDScene/camera.json
Traceback (most recent call last):
  File "./tools/test_kinect_fusion.py", line 15, in <module>
    from kinect_fusion import kfusion
ImportError: libkfusion.so: cannot open shared object file: No such file or directory

It simply says that it cannot find a shared object, which does exist. It is included as well, which can be checked by echo $LD_LIBRARY_PATH as :

/home/weizhang/Pangolin/build/src:/usr/local/cuda-8.0/lib64::/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/home/weizhang/DA-RNN/lib/kinect_fusion/build

This might be a too specified question but I am curious why this happened and what might be able to solve it.

Appreciate any comments!

Eric
  • 95,302
  • 53
  • 242
  • 374
Wei
  • 305
  • 5
  • 18

1 Answers1

4

Any environment variables set in your local environment are lost when you run sudo. For example, if my local environment includes:

LD_LIBRARY_PATH=/some/path

Then running env as myself, I see:

$ env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/some/path
$

But using sudo the variable is not visible, because sudo creates a new, sanitized environment:

$ sudo env | grep LD_LIBRARY_PATH
$

The best solution for you is probably to set LD_LIBRARY_PATH inside your ./experiments/scripts/test_kinect_fusion.sh script.

larsks
  • 277,717
  • 41
  • 399
  • 399