LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   /tmp goes to 100% on compile of opencv (http://www.linuxquestions.org/questions/slackware-14/tmp-goes-to-100-on-compile-of-opencv-4175442558/)

camorri 12-22-2012 08:55 AM

/tmp goes to 100% on compile of opencv
 
As the title states.

Some info. Error messages on failure:

Code:

CMake Error at data/cmake_install.cmake:36 (FILE):
  file INSTALL cannot copy file
  "/tmp/SBo/OpenCV-2.4.3/data/haarcascades/haarcascade_fullbody.xml" to
  "/tmp/SBo/package-opencv/usr/share/OpenCV/haarcascades/haarcascade_fullbody.xml".
Call Stack (most recent call first):
  cmake_install.cmake:56 (INCLUDE)


make: *** [install] Error 1
root@duelie:/home/cliff/src/opencv#

Condition of /tmp

Quote:

root@duelie:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 12396968 10632036 1135188 91% /
/dev/sda6 137412520 44607528 92804992 33% /home
tmpfs 1517456 0 1517456 0% /dev/shm
none 1517456 0 1517456 0% /home/cliff/.thumbnails
none 1517456 0 1517456 0% /root/.thumbnails
none 1517456 0 1517456 0% /root/.mozilla
none 1517456 1517456 0 100% /tmp
As you can see, /tmp is full before the compile of opencv 2.4.3 completes. I have tried several times, using sbopkg and running the slackbuild in a su- terminal. Every try has failed, in different places, but it fails.

How do I increase the size of /tmp ?

I have enough disk space as far as I know.

Alien Bob 12-22-2012 09:05 AM

It looks like you have your /tmp in "tmpfs" i.e. in your RAM (possibly because you thought that would speed up compilations, which it will). However, when setting up a tmnpfs in memory, maximally half of your RAM is allocated to the tmpfs by default. That sounds like a lot but if other processes also require the use of RAM, you may end up with a tmpfs which is too small to be useable.
As you can see you have 1.5 GB of tmpfs and it has all been consumed by your /tmp mount.

If you make /tmp a directory in your root filesystem, then you will have 12 GB of free space for compilations.

Eric

bosth 12-22-2012 09:43 AM

There is an issue with the way that OpenCV is compiled by default in that it uses precompiled headers, which aren't of much use in SlackBuilds. If you add the following to the cmake options, the amount of disk space required will be reduced by about 2GB and your tmp partition will not fill up:
Code:

-DENABLE_PRECOMPILED_HEADERS=OFF
I spoke with the SlackBuild maintainer about this very topic a couple of weeks ago, and the change has been added for the next update.

Mark Pettit 12-22-2012 09:44 AM

I think that putting /tmp in RAM for general use in laptops and desktops has to be classified under "seemed like a good idea at the time". As AlienBob says, you will achieve brilliant performance a few times, but then for the rest of the time that memory will be wasted. Simply leaving it for the O/S to decide what's best to use it for (ie caching reads/writes) is probably a better idea. But that's just my opinion. I wont deny that under certain server workloads, it may well be a good idea to use /tmp in RAM though !

camorri 12-22-2012 10:44 AM

bosth,

I edited the slackbuild script, and added the line you suggested. Now I get an error saying the build dir is does not exist. It does, how ever there is nothing in the dir.

The error:
Quote:

CMake Error: The source directory "/tmp/SBo/OpenCV-2.4.3/build/ " does not exist
Now the cmake section.

Quote:

cd build
cmake \
-DCMAKE_C_FLAGS="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS="$SLKCFLAGS" \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DINSTALL_MAN_DIR=man \
-DINSTALL_DOC_DIR=doc/$PRGNAM-$VERSION \
-DBUILD_SHARED_LIBS=ON \
-DLIB_SUFFIX=$LIBDIRSUFFIX \
-DLIB_INSTALL_DIR=/usr/lib$LIBDIRSUFFIX \
-DENABLE_PRECOMPILED_HEADERS=OFF \
Is this correct?

I also understand the need to move /tmp onto the hard drive, so I don't run out of space. However, the how-to's I found talk about making a separate partition for /tmp. Is that necessary? Is there a way to edit /etc/fstab and stop /tmp from mounting to tmpfs, and simply mount to a directory?

tmpfs has always confused me.

My current fstab.

Quote:

cat /etc/fstab
/dev/sda5 swap swap defaults 0 0
/dev/sda1 / ext4 defaults 1 1
/dev/sda6 /home ext4 defaults 1 2
#/dev/cdrom /mnt/cdrom auto noauto,owner,ro,comment=x-gvfs-show 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
none /home/cliff/.thumbnails tmpfs defaults 0 0
none /root/.thumbnails tmpfs defaults 0 0
none /root/.mozilla tmpfs defaults 0 0
none /tmp tmpfs defaults 0 0
Sorry if these sound like noob questions.

TobiSGD 12-22-2012 12:00 PM

Quote:

Originally Posted by Mark Pettit (Post 4854996)
As AlienBob says, you will achieve brilliant performance a few times, but then for the rest of the time that memory will be wasted. Simply leaving it for the O/S to decide what's best to use it for (ie caching reads/writes) is probably a better idea

A tmpfs is not a static RAM-disk, it will use exactly the amount of RAM that it needs, not more, not less. So you won't have much waste with the use of tmpfs, just clean up from time to time, like removing the temporary directories used by sbopkg, or just reboot the system.

bosth 12-22-2012 12:12 PM

Quote:

Originally Posted by camorri (Post 4855009)
bosth,

I edited the slackbuild script, and added the line you suggested. Now I get an error saying the build dir is does not exist. It does, how ever there is nothing in the dir.

Make sure that you don't have a space after the \ at the end of the newly-added line. A backslash indicates that the command continues on the next line, but it has to be the last character on the line or the single command will be broken into two commands.

Mark Pettit 12-22-2012 12:38 PM

@TobiSGD - That's pretty much my point - you, the user, has to decide what should be left or deleted from /tmp if you want to keep real memory usage low. At my work, we run a mix of Solaris and Slackware servers. With Solaris, /tmp by default is in virtual memory. As a rule, we tend to code around that and use another directory as "tmp". On occasion we've hit memory issues, as a result of /tmp filling up - waiting to reboot is a bad idea as we tend to only reboot our servers when the diesel power generators need to be tested - ie every 6 months. For the Slackware servers, I setup /tmp to be on disk and I never ever have issues. So if you don't reboot frequently, then one has to write scripts to monitor usage of /tmp and delete (carefully) where files are old. My general feeling is that the odd performance issue you benefit from does not outweigh the downsides of /tmp in RAM. But again, that's an opinion. I strongly suspect that Pat's box that rebuilds Slackware from source would strongly benefit from that - possibly to the point where to not use it would be unfeasible.

camorri 12-22-2012 01:09 PM

Update, I refreshed the opencv.SlackBuild, and carefully added the line bosth suggested. I ran the the slackbuild, and oopencv built this time using only about 22% OF /tmp.

I will do some more investigating on having /tmp on disk, instead of ram. Original problem (opencv not building) solved.

Thank-you to every one who contributed.

Merry Christmas to everyone.


All times are GMT -5. The time now is 11:09 PM.