From simon.urbanek at r-project.org  Wed Aug 26 17:23:32 2009
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Wed, 26 Aug 2009 11:23:32 -0400
Subject: [Rd] Cannot make 3 different R installations for 3 different
	valgrind-instrumentation levels
In-Reply-To: <20090826164358.sxwe3xawyw00ow4k@web.supagro.inra.fr>
References: <20090825183131.19kjcomatupco0wg@web.supagro.inra.fr>
	<D30ADD33-3339-409D-B2E2-9090B4E14CD8@r-project.org>
	<20090826124729.ad1ilt691u880w0w@web.supagro.inra.fr>
	<1AC73CC3-67A9-4800-9B9C-E65525D35152@r-project.org>
	<20090826164358.sxwe3xawyw00ow4k@web.supagro.inra.fr>
Message-ID: <002BCEC3-F5A4-4735-8A18-ACB3CA7D29F1@r-project.org>


On Aug 26, 2009, at 10:43 , pleydell at supagro.inra.fr wrote:

>
>> ^^-- this is really bad form - you should never build/compile  
>> software  as root. The location of the build directory is  
>> irrelevant so use /tmp  or you home or something like that ...  
>> (usualy the fastest disk ;))
>
> OK, thanks for the tip, although I don't understand the configure -  
> make -
> install cycle enough to see how compiling as non-root and installing  
> as root is
> any safer than just doing both as root.
>

configure and make are compiling the product which means compiling and  
running a lot of various code. Since that whole process does various  
probes and is inherently very complex you don't want to expose your  
entire system to it (in the process files are deleted etc. so a bug in  
it could wipe your system for example ...). There is no need to run it  
as root, because you don't need any special privileges to compile it.  
In addition, the root environment is usually different from the user  
environment so it's in general easier to setup your user environment  
if needed (and even temporarily).

The only part that needs root access potentially is installation if  
you decide to install to a system-wide location. That part is just  
copying so it in generally safe to run as root (in fact even that can  
be used in a more safe way without root using DESTDIR instead but  
that's for more paranoid people like me ;)).


>> Why would you do all that?
>
> Well, when you've been trying for hours to get something to work and  
> it doesn't
> and there are no workable examples on the net... is it too much to  
> ask that a
> workable example be placed in the documentation?

Well, you're using an advanced feature (multi-arch support) in a way  
that it was not designed for, so you better really know what you're  
doing ;). But even so - the example from the docs (slightly  
abbreviated by removing the compiler-specific args) says:


tar fxz R-2.9.2.tar.gz
mkdir R-ppc
cd R-ppc
../R-2.9.2/configure r_arch=ppc ...
make
make install
cd ..
# Depending on your permissions, you may need to run sudo make install.

mkdir R-i386
cd R-i386
../R-2.9.2/configure r_arch=i386 ...
make
make install
cd ..

That is known to work  - replace ppc/i386 by your vg names and you're  
all set...



> Finally I have a script that
> has worked for me (writen before I saw Simon's comment about root)
>
> cd /usr/local/lib
> umask 022
> mkdir R-2.9.2
> mkdir build_vg0
> mkdir build_vg1
> mkdir build_vg2
> cd /usr/local/lib/build_vg2
> sudo /usr/local/src/R-2.9.2/configure --enable-memory-profiling
> --with-valgrind-instrumentation=2 r_arch=vg2
> sudo make
> sudo make prefix=/usr/local/lib/R-2.9.2 install
> cd /usr/local/lib/build_vg1
> sudo /usr/local/src/R-2.9.2/configure --enable-memory-profiling
> --with-valgrind-instrumentation=1 r_arch=vg1
> sudo make
> sudo make prefix=/usr/local/lib/R-2.9.2 install
> cd /usr/local/lib/build_vg0
> sudo /usr/local/src/R-2.9.2/configure --enable-memory-profiling
> --with-valgrind-instrumentation=0 r_arch=vg0
> sudo make
> sudo make latex
> sudo make dvi
> sudo make pdf
> sudo make info
> sudo make help
> sudo make html
> sudo make prefix=/usr/local/lib/R-2.9.2 install
> sudo cp /usr/local/lib/R-2.9.2/bin/R /usr/local/bin/R
>
> IMHO, if the surpless newbie chaff was whittled off this example  
> might be useful
> to others in the official documentation.
>

I still don't understand why you are running all the doc makes at the  
end and why you set a prefix and then copy things manually ...

Cheers,
Simon



[Rd] Cannot make 3 different R installations for 3 different valgrind-instrumentation levels
Simon Urbanek