Is it possible to have multiple gcc versions installed on a unix system? If yes, how to find which all versions are installed? Also, is it possible to specify at runtime which gcc version to use?
Here's a step by step that works on Linux, and will probably work on unix.
First verify you have a gcc available:
greg#greg-mint ~ $ gcc
gcc: fatal error: no input files
compilation terminated.
Yep. Didn't like the fact I didn't supply anything to compile.
If you get something like no command gcc found or command or file not recognised: gcc then you might have a problem.
Now, find where that gcc is:
greg#greg-mint ~ $ which gcc
/usr/bin/gcc
Great. It's in /usr/bin/gcc but that's not telling us about alternative versions.
Let's find out a bit about that:
greg#greg-mint ~ $ ls -l /usr/bin/gcc
lrwxrwxrwx 1 root root 7 Mar 28 2013 /usr/bin/gcc -> gcc-4.7
On my machine (Linux Mint) that' show it shows a symbolic link. What it means is that when I run the gcc command it's running /usr/bin/gcc-4.7
Ok. I'm guessing it's usually in /usr/bin, so, lets see if there are any others:
greg#greg-mint ~ $ ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 7 Mar 28 2013 /usr/bin/gcc -> gcc-4.7
-rwxr-xr-x 1 root root 275952 Jul 3 2012 /usr/bin/gcc-4.5
-rwxr-xr-x 1 root root 578808 Sep 22 2012 /usr/bin/gcc-4.7
-rwxr-xr-x 1 root root 22832 Sep 22 2012 /usr/bin/gcc-ar-4.7
-rwxr-xr-x 1 root root 22832 Sep 22 2012 /usr/bin/gcc-nm-4.7
-rwxr-xr-x 1 root root 22832 Sep 22 2012 /usr/bin/gcc-ranlib-4.7
-rwxr-xr-x 1 root root 220968 Oct 9 2012 /usr/bin/gccxml
-rwxr-xr-x 1 root root 8606464 Oct 9 2012 /usr/bin/gccxml_cc1plus
So it turns out I have gcc version 4.7 and 4.5 on my machine. I don't know what the other ones are.
You can specify the version number by sending the full path:
greg#greg-mint ~ $ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
greg#greg-mint ~ $ /usr/bin/gcc-4.5 --version
gcc-4.5 (Ubuntu/Linaro 4.5.4-1ubuntu2) 4.5.4
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
greg#greg-mint ~ $ /usr/bin/gcc-4.7 --version
gcc-4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
An alternative, and I recommend that you DO NOT do this, is to use find. (be warned: on a shared machine it's not necessarily good manners).
find / -name "gcc*"
This will look for all files that start with gcc on your machine. It's going to scan the entire disk, so it will take a while, and you'll be affecting performance for all the other users on your system (which given you've said 'unix' and 'University Server' may come with an impact).
Yes, it is fairly common to have multiple versions of gcc installed, usually named gcc-version. For example, on my machine, I have gcc-4.4, gcc-4.5, and gcc-4.6. You can usually see what versions you have installed by typing gcc-tab -- using the shell's autocomplete to tell you which versions are available.
Related
I connect to a remote computer thru VNC and use Konsole for my work. Konsole is version 2.3.3 using KDE 4.3.4. I have these two aliases:
alias ll 'ls -haltr; pwd'
alias cd 'cd \!*; ll'
which I observed to have the following behavior:
When path exists, it will cd to it and also do the ll alias
When path doesn't exist, it will simply say the path doesn't exist and won't do the ll anymore
Example:
Path exists
[10] % cd foo
total 14K
-rw-r----- 1 user group 913 Jun 3 2014 readme
-rw-r----- 1 user group 1.2K Dec 3 2020 report.txt
drwxr-x--- 2 user group 4.0K Jan 12 17:50 ./
drwx------ 77 user group 8.0K Jun 24 11:57 ../
/home/user/foo
[11] %
Path doesn't exist
[10] % cd nowhere
nowhere: No such file or directory.
[11] %
Now our department has transferred to another division and we've just started to connect remotely thru Exceed TurboX. I still use Konsole but the version is now 2.10.5 using KDE 4.10.5. I copied over the same two aliases, but I'm now observing a different behavior:
When path exists, it will cd to it and also do the ll alias (basically same as #1 above)
When path doesn't exist, it will attempt to cd AND still do the ll (different as #2 above)
So for #2, here's how it looks like:
[10] % cd nowhere
nowhere: No such file or directory.
total 120K
-rw-r----- 1 user group 272 Jan 6 2021 .cshrc
-rw-r----- 1 user group 1.2K Jan 6 2021 .alias
drwxr-x--- 2 user group 4.0K Jan 12 17:50 ./
drwx------ 77 user group 8.0K Jun 24 11:57 ../
/home/user
[11] %
I would like to know how to get behavior #2 of the previous working environment to this current working environment.
I've added the information on the Konsole and KDE versions because if the behavior is due to the version and there's no workaround, then I'll just be sad for the rest of my life working in this new remote desktop env. ^_^
I'm currently exploring a "check first if the path exists before doing ll" but to no avail. :'(
Edit:
The shell I'm using is tcsh
% printenv SHELL in both environments showed /bin/tcsh
And in addition:
Old environment
% echo $version
tcsh 6.17.00 (Astron) 2009-07-10 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
New environment
% echo $version
3
The information in the question is still not sufficient to find out why tcsh behaves differently in the two working environments.
The alias defines a sequence of commands (cd followed by ll) without any condition.
alias cd 'cd \!*; ll'
On one system the execution of the alias seems to stop if the cd command reports an error for currently unknown reasons.
The correct way to prevent the execution of ll after a failed cd command would be the conditional execution of the ll command, e.g.
alias cd 'cd \!* && ll'
The decade long advice is: do not use aliases, use functions.
ll() { ls -haltr "$#" && pwd; }
cd() { cd "$#" && ll; }
I have both mpich and openmpi in my Ubuntu 20.04.
$ dpkg -l | grep mpi | grep lib
...
ii libmpich-dev:amd64 3.3.2-2build1 amd64 Development files for MPICH
ii libmpich12:amd64 3.3.2-2build1 amd64 Shared libraries for MPICH
...
ii libopenmpi-dev:amd64 4.0.3-0ubuntu1 amd64 high performance message passing library -- header files
ii libopenmpi3:amd64 4.0.3-0ubuntu1 amd64 high performance message passing library -- shared library
...
ii openmpi-bin 4.0.3-0ubuntu1 amd64 high performance message passing library -- binaries
ii openmpi-common 4.0.3-0ubuntu1 all high performance message passing library -- common files
..
$ dpkg -l | grep mpich
...
ii mpich 3.3.2-2build1 amd64 Implementation of the MPI Message Passing Interface standard
The default (probably because it was installed later) appears to be mpich.
How would I change to openmpi?
I want to make sure that everything that needs to be changed actually is.
So far, I am thinking about headers, executable, libraries.
I do not know which are all directories, links, etc., that have to change.
For instance, here it is suggested cmake -DMPI_CC_COMPILER=/.../mpicc.
And it was mentioned in comments that it worked. But:
I am not sure it actually fixes all headers, etc.
I need a method that:
2.1. Works for all users in the system
2.2. Does not require those macros
2.3. Works also for other compilation methods other than cmake
As for 2.3, I tried now to configure petsc
$ ./configure --with-cc=mpicc --with-fc=mpif90 -with-cxx=mpicxx --with- make-np=10 --with-shared-libraries --download-f2cblaslapack --download-mumps --download-scalapack --with-debugging=0 COPTFLAGS="-O -O3 -march=native -mtune=native" FOPTF LAGS="-O -O3 -march=native -mtune=native" CXXOPTFLAGS="-O -O3 -march=native -mtune=native"
and I got
Your libraries are from MPICH but it appears your mpiexec is from OpenMPI
Can this be fixed with update-alternatives?
I found this, which makes me think it can, but in my system it is not correctly configured:
$ type mpiexec
mpiexec is hashed (/usr/bin/mpiexec)
$ ll /usr/bin/mpiexec
lrwxrwxrwx 1 root root 25 Jan 21 11:11 /usr/bin/mpiexec -> /etc/alternatives/mpiexec
$ ll /etc/alternatives/mpiexec
lrwxrwxrwx 1 root root 24 Jan 21 11:11 /etc/alternatives/mpiexec -> /usr/bin/mpiexec.openmpi
$ ll /usr/bin/mpiexec.openmpi
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/mpiexec.openmpi -> orterun
$ type mpirun
mpirun is /usr/bin/mpirun
$ ll /usr/bin/mpirun
lrwxrwxrwx 1 root root 24 Jan 21 11:11 /usr/bin/mpirun -> /etc/alternatives/mpirun
$ ll /etc/alternatives/mpirun
lrwxrwxrwx 1 root root 23 Jan 21 11:11 /etc/alternatives/mpirun -> /usr/bin/mpirun.openmpi
$ ll /usr/bin/mpirun.openmpi
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/mpirun.openmpi -> orterun
$ type mpicc
mpicc is hashed (/usr/bin/mpicc)
$ ll /usr/bin/mpicc
lrwxrwxrwx 1 root root 21 Feb 25 18:54 /usr/bin/mpicc -> /etc/alternatives/mpi
$ ll /etc/alternatives/mpi
lrwxrwxrwx 1 root root 20 Feb 25 18:54 /etc/alternatives/mpi -> /usr/bin/mpicc.mpich
Related
Replace MPICH Installation by OpenMPI
CMake : Selecting mpich over openmpi
https://unix.stackexchange.com/questions/413099/flip-between-openmpi-and-mpich-as-default-using-linux-terminal
Difference between mpi and mpich2 folder?
CMake : Selecting mpich over openmpi
Switch from MPICH to OpenMPI
This? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896189
This? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912437
https://unix.stackexchange.com/questions/81992/better-way-to-add-alternative-using-update-alternatives
https://askubuntu.com/questions/964600/how-to-add-slave-to-existing-update-alternatives-link-group
It seems all alternatives, except for one (link group mpi), were already set for openmpi
$ update-alternatives --get-selections | grep mpi
h5pcc auto /usr/bin/h5pcc.openmpi
mpi auto /usr/bin/mpicc.mpich
mpi-x86_64-linux-gnu auto /usr/lib/x86_64-linux-gnu/openmpi/include
mpirun auto /usr/bin/mpirun.openmpi
To set link group mpi properly (and avoiding error-prone individual link operations)
sudo apt-get install --reinstall openmpi-bin
(the package owning mpicc.openmpi).
This apparently fixed everything.
So far it is working fine.
"Historical" note:
I had found that (strangely) mpicc.openmpi was not in update-alternatives, as opposed to the other 3 link groups
$ update-alternatives --list mpirun
/usr/bin/mpirun.mpich
/usr/bin/mpirun.openmpi
$ update-alternatives --list h5pcc
/usr/bin/h5pcc.mpich
/usr/bin/h5pcc.openmpi
$ update-alternatives --list mpi-x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/mpich
/usr/lib/x86_64-linux-gnu/openmpi/include
$ update-alternatives --list mpi
/usr/bin/mpicc.mpich
even if it was installed in my system
$ ll /usr/bin/mpicc*
lrwxrwxrwx 1 root root 21 Feb 25 18:54 /usr/bin/mpicc -> /etc/alternatives/mpi
-rwxr-xr-x 1 root root 11K Mar 22 2020 /usr/bin/mpicc.mpich
lrwxrwxrwx 1 root root 12 Apr 15 2020 /usr/bin/mpicc.openmpi -> opal_wrapper
Why would it not be in the first place? I still don't know.
I decided to go with the reinstall, since handling the link group manually might have been a mess
$ update-alternatives --query mpi
Name: mpi
Link: /usr/bin/mpicc
Slaves:
mpiCC /usr/bin/mpiCC
mpiCC.1.gz /usr/share/man/man1/mpiCC.1.gz
mpic++ /usr/bin/mpic++
mpic++.1.gz /usr/share/man/man1/mpic++.1.gz
mpicc.1.gz /usr/share/man/man1/mpicc.1.gz
mpicxx /usr/bin/mpicxx
mpicxx.1.gz /usr/share/man/man1/mpicxx.1.gz
mpif77 /usr/bin/mpif77
mpif77.1.gz /usr/share/man/man1/mpif77.1.gz
mpif90 /usr/bin/mpif90
mpif90.1.gz /usr/share/man/man1/mpif90.1.gz
mpifort /usr/bin/mpifort
mpifort.1.gz /usr/share/man/man1/mpifort.1.gz
Status: auto
Best: /usr/bin/mpicc.mpich
Value: /usr/bin/mpicc.mpich
Alternative: /usr/bin/mpicc.mpich
Priority: 40
Slaves:
mpiCC /usr/bin/mpicxx.mpich
mpiCC.1.gz /usr/share/man/man1/mpicxx.mpich.1.gz
mpic++ /usr/bin/mpicxx.mpich
mpic++.1.gz /usr/share/man/man1/mpicxx.mpich.1.gz
mpicc.1.gz /usr/share/man/man1/mpicc.mpich.1.gz
mpicxx /usr/bin/mpicxx.mpich
mpicxx.1.gz /usr/share/man/man1/mpicxx.mpich.1.gz
mpif77 /usr/bin/mpifort.mpich
mpif77.1.gz /usr/share/man/man1/mpif77.mpich.1.gz
mpif90 /usr/bin/mpifort.mpich
mpif90.1.gz /usr/share/man/man1/mpif90.mpich.1.gz
mpifort /usr/bin/mpifort.mpich
mpifort.1.gz /usr/share/man/man1/mpifort.mpich.1.gz
I'm attempting to build a package and install R packages that use Rccp. These are failing because files in /tmp are not executable.
These problems arose after switching to a new Dell xps 13 pre-installed with Ubuntu 18.04. For the build, I've been using pkgbuild::compile_dll to compile some C code with Rccp. I only found out about the problem installing new packages while troubleshooting the problem with compile_dll. This confirmed that its not a problem with pkgbuild.
Here is the error message from compile_dll:
> pkgbuild::compile_dll()
Registered S3 methods overwritten by 'ggplot2':
method from
[.quosures rlang
c.quosures rlang
print.quosures rlang
Re-compiling spstan
─ installing *source* package ‘spstan’ ...
** using staged installation
ERROR: 'configure' exists but is not executable -- see the 'R
Installation and Administration Manual'
─ removing
‘/home/connor/tmp/RtmpC0EMxX/devtools_install_570e38f2a7e3/spstan’
Error in (function (command = NULL, args = character(),
error_on_status = TRUE, :
System command error
There's plenty of help out there for this it seems, except that none of the solutions are working for me. Here is what I've tried.
Remount /tmp as in
https://github.com/r-lib/devtools/issues/32
Remount /tmp and enable executable files be entering the following in the terminal:
sudo mount -o remount,exec /tmp
Which gives the following error message: mount point not mounted or bad option. Since /tmp isn't mounted separately on my computer, its part of the root filesystem, the above solution fails because /tmp can't be remounted.
Following the instructions from the R Installation and Administration Manual, make sure TMPDIR points to some temporary file system in which scripts are allowed to be executed. So I made a new tmp folder called ~/Rtmp and mounted it:
mkdir ~/Rtmp
mount -t tmpfs -o exec ~/Rtmp
Also adding the following line to my ~/.Renviron file:
TMPDIR=/home/connor/Rtmp
and adding the following line to /etc/fstab:
tmpfs /home/connor/Rtmp tmpfs exec 0 0
and then rebooting the computer before running pkgbuild::compile_dll() again. I get the same error message but I could confirm that R was using /Rtmp folder I directed it to.
Following some advice here https://ubuntuforums.org/showthread.php?t=2421441 change permissions on the /tmp folder recursively with
sudo chmod -R 777 ~/tmp
This also fails. The problem seems to be that compile_dll is creating a new script that it wants to run and the permissions on the folder aren't the default for new files that get added to it.
When I print out the permissions for /tmp, the script that is failing with compile_dll is listed without the same permissions as all the older files:
drwx------ 3 connor connor 4096 Jun 23 15:20 RtmpC0EMxX
drwxrwxrwx 9 root root 4096 Jun 23 09:53 RtmpGb3QiA
drwxrwxrwx 3 connor connor 4096 Jun 23 10:44 RtmpI9hu1U
drwxrwxrwx 2 connor connor 4096 Jun 23 10:41 RtmpIgi5su
drwxrwxrwx 2 connor connor 4096 Jun 23 10:07 RtmpK4p4Od
drwxrwxrwx 4 root root 4096 Jun 23 09:17 RtmppdbqeT
drwxrwxrwx 10 root root 4096 Jun 23 09:54 RtmpR4Cc9c
drwxrwxrwx 14 root root 4096 Jun 23 10:13 Rtmpuweyxz
drwxrwxrwx 2 connor connor 4096 Jun 23 10:07 RtmpwN9SbT
drwxrwxrwx 2 connor connor 4096 Jun 23 10:04 RtmpY7g0NK
So I'm still stuck. Am I doing something wrong here? Or do I need to start looking somewhere else for the source of the problem?
I'm trying to write my first formula, for the Rserve package in R: https://www.rforge.net/Rserve/ .
So far I have this:
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://www.rubydoc.info/github/Homebrew/brew/master/Formula
class Rserve < Formula
desc "Rserve acts as a socket server (TCP/IP or local sockets) which allows binary requests to be sent to R."
homepage "http://www.rforge.net/Rserve/"
url "https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz"
sha256 "f6d636c736c3f16487d9987e54554fe0c55257b9bc0671b43e536d832e513027"
depends_on "r"
depends_on "gettext"
def install
system("whoami")
system("#{HOMEBREW_PREFIX}/bin/R CMD install --configure-args=\"CPPFLAGS=-L#{HOMEBREW_PREFIX}/opt/gettext/lib LDFLAGS=-I#{HOMEBREW_PREFIX}/opt/gettext/include\" .")
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! For Homebrew/homebrew-core
# this will need to be a test that verifies the functionality of the
# software. Run the test with `brew test Rserve`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"
end
end
The error I get is:
==> Downloading https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz
Already downloaded: /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz
==> Verifying 690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz checksum
tar xf /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz -C /private/tmp/d20190114-99089-11isfza
cp -pR /private/tmp/d20190114-99089-11isfza/Rserve/. /private/tmp/rserve-20190114-99089-b57ji6/Rserve
chmod -Rf +w /private/tmp/d20190114-99089-11isfza
==> whoami
kwilliams
==> /usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" .
* installing to library ‘/usr/local/lib/R/3.5/site-library’
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/3.5/site-library’
==> Formula
Path: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rserve.rb
==> Configuration
HOMEBREW_VERSION: 1.9.2-5-g44f4f36
ORIGIN: https://github.com/Homebrew/brew
HEAD: 44f4f36c0db693000410fe664b250a90325f4e32
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: de1ecc1d981de9d5165ea9e96242c32023d14d7c
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
HOMEBREW_LOGS: /Users/kwilliams/Library/Logs/Homebrew
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.1, 1.8.0_192
macOS: 10.13.6-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
The permissions on /usr/local/lib/R/3.5/site-library should allow me to install there, though:
% ls -al /usr/local/lib/R/3.5/site-library
total 0
drwxr-xr-x 2 kwilliams admin 64 Jan 14 13:38 ./
drwxr-xr-x 3 kwilliams admin 96 Jan 14 13:38 ../
If I put myself in a directory where the Rserve tarball has been freshly expanded, then manually run the command /usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" ., I don't get the error about "no permission to install to directory".
What's different about the environment that Homebrew is running that command, compared to me running it in a shell, that causes it to fail when run automatically?
My brew doctor output is clean, except for a warning that my docker keg is unlinked, which I assume is unrelated.
Figured it out - there's a sandbox (sandbox-exec, I think) in place that restricts writing to the filesystem outside the prefix directory:
https://discourse.brew.sh/t/potential-permission-issues-in-a-formula-im-writing/3707
I'll need to figure out the correct way to write files to /usr/local/lib/R/3.5/site-library, or symlink them to there from the Cellar directory, or whatever it is.
my os is debian6,there is a libR.pc after i compile to install R
root#debian:/home/tiger# cat /home/tiger/R-2.15.1/lib/pkgconfig/libR.pc
rhome=/home/tiger/R-2.15.1/lib/R
rlibdir=${rhome}/lib
rincludedir=/home/tiger/R-2.15.1/lib/R/include
Name: libR
Description: R as a library
Version: 2.15.1
Libs: -L${rlibdir} -lR
Cflags: -I${rincludedir} -I${rincludedir}
Libs.private:
when set R environment in /etc/profile:
R_HOME= /home/tiger/R-2.15.1
or
R_HOME= /home/tiger/R-2.15.1/lib/R
which line will i choose to write in /etc/profile?
On a Debian (or derivative such as Ubuntu system) you have /etc/R/ to set variable which R uses:
edd#max:~$ ls -l /etc/R/
total 28
-rw-r--r-- 1 root root 602 Jun 17 20:29 ldpaths
-rw-r--r-- 1 root root 5461 Jun 17 20:29 Makeconf
-rw-r--r-- 1 root root 1868 Mar 31 13:50 Renviron
-rw-r--r-- 1 root root 608 Sep 25 2009 Renviron.site
-rw-r--r-- 1 root root 1159 Mar 31 08:03 repositories
-rw-r--r-- 1 root root 792 Oct 28 2009 Rprofile.site
edd#max:~$
and the files in R_HOME/etc/ should be softlinks --- at least if you use the prebuilt binaries. If you build you own binaries, it's your problem.
The file you quote is installed as /usr/lib/pkgconfig/libR.pc on a Debian / Ubuntu system. Setting R_HOME is not needed as R finds its own values (see #flodel's answer).
On my system:
cat $R_HOME
gives nothing, but inside an R session, I get:
> Sys.getenv("R_HOME")
[1] "/usr/lib/R"
This should tell you two things:
that R_HOME is set at R's startup, so unless you know exactly what you are doing, maybe you don't need to set it up in your /etc/profile.
you can use Sys.getenv to find out the exact path to your R_HOME.