I am following this tutorial on installing ROS Kinetic on Raspbian Jessie and I got stuck Building the Catkin Workspace.
/etc/dphys-swapfile has been configure to
CONF_SWAPFILE=/mnt/sda2/swap.file
CONF_SWAPSIZE=1024
/sda2 is a 1TB external Hard Disk. It does not have a file "swap.file" though. How should I create it?
free -h
now gives me
total used free shared buffers cached
Mem: 859M 778M 81M 48M 84M 381M
-/+ buffers/cache: 312M 547M
Swap: 1.0G 0B 1.0G
Running
sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2
causes me to get stuck and terminal shows
[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
Originally posted by Alsing on ROS Answers with karma: 27 on 2017-07-10
Post score: 0
Original comments
Comment by ahendrix on 2017-07-10:
It can take hours to compile OpenCV and PCL. I recommend that you just let it run. Eventually it will finish or run out of memory and crash.
Comment by Alsing on 2017-07-11:
Hey! Thanks for the prompt reply! Did I do the swap correctly? I did not explicitly create a "swap.file" in sda2. What happens if memory runs out?
Comment by ahendrix on 2017-07-11:
I'm not sure how dphys-swapfile is supposed to work, but your output from free -h
clearly shows 1GB of available swap space, so it's probably working.
Comment by gvdhoorn on 2017-07-11:
@Alsing: if you have the opportunity, I would really look into cross-compilation combined with distributed compilation. For the latter you could look into distcc
. If you have any hosts available, building things like OpenCV and PCL will be much faster than just using the rpi alone.
Comment by Alsing on 2017-07-11:
@gvdhoorn Thanks for that suggestion! I might spend the same time figuring out the configuration. @Ahendrix gives a very good solution if only I wasn't stuck with an Eigen3 issue. I'll have to figure out that one for now.
Comment by Alsing on 2017-07-18:
@ahendrix What happens if it hangs? Should I reboot it or let it be?
Comment by ahendrix on 2017-07-18:
"hangs" is tricky. It may be working, it just may not show any obvious signs that it's working. I would open another terminal and use top
or htop
to monitor CPU activity to see if any process is using the CPU heavily, or if many small compile processes are running.
Comment by Alsing on 2017-07-18:
It would be completely unresponsive, no mouse or keyboard responses. Display wise, I'm stuck on the activity bar showing 99%. Then again, it could be the display not updating, but I really wouldn't know and can't test.
Comment by ahendrix on 2017-07-18:
That sounds pretty stuck. It might be swapping so much that it seems very slow, or may be completely locked up. If it's swapping it may eventually respond very slowly, and sometimes SSH may work better. If I didn't get any response after a minute I'd probably reboot and try to rebuild with -j1