Reputation: 285
I am trying to build libxml2 on a high performance cluster where I don't have root privileges.
I do this with (first loading possible dependencies as instructed by someone who managed to install libxml2 on the same hpc using the same dependencies, many/all are probably not required but they are for other things that I will run)
module load gcc/10.3.0-gcc-9.4.0 cmake/3.23.1-gcc-10.3.0 openmpi/4.1.3-gcc-10.3.0-python3+-chk-version openblas/0.3.20-gcc-10.3.0 python/3.8.12-gcc-9.4.0
module unload libxml2/2.9.12-gcc-10.3.0 libiconv/1.16-gcc-10.3.0
followed by:
wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.9.10.tar.gz
tar -xvzf libxml2-sources-2.9.10.tar.gz libxml2-2.9.10/
cd libxml2-2.9.10/
./configure --prefix=$HOME/install
make
make install
This produces the following error:
Making install in python
make[2]: Entering directory '/users/anonymous/libxml2-2.9.10/python'
make install-recursive
make[3]: Entering directory '/users/anonymous/libxml2-2.9.10/python'
Making install in .
make[4]: Entering directory '/users/anonymous/libxml2-2.9.10/python'
make[5]: Entering directory '/users/anonymous/libxml2-2.9.10/python'
make[5]: Nothing to be done for 'install-exec-am'.
/usr/bin/mkdir -p '/users/anonymous/install/share/doc/libxml2-python-2.9.10'
/usr/bin/install -c -m 644 TODO '/users/anonymous/install/share/doc/libxml2-python-2.9.10'
/usr/bin/mkdir -p '/usr/lib/python3/dist-packages'
/usr/bin/install -c -m 644 drv_libxml2.py libxml2.py '/usr/lib/python3/dist-packages'
/usr/bin/install: cannot create regular file '/usr/lib/python3/dist-packages/drv_libxml2.py': Permission denied
/usr/bin/install: cannot create regular file '/usr/lib/python3/dist-packages/libxml2.py': Permission denied
make[5]: *** [Makefile:667: install-dist_pythonDATA] Error 1
make[5]: Leaving directory '/users/anonymous/libxml2-2.9.10/python'
make[4]: *** [Makefile:860: install-am] Error 2
make[4]: Leaving directory '/users/anonymous/libxml2-2.9.10/python'
make[3]: *** [Makefile:694: install-recursive] Error 1
make[3]: Leaving directory '/users/anonymous/libxml2-2.9.10/python'
make[2]: *** [Makefile:854: install] Error 2
make[2]: Leaving directory '/users/anonymous/libxml2-2.9.10/python'
make[1]: *** [Makefile:1479: install-recursive] Error 1
make[1]: Leaving directory '/users/anonymous/libxml2-2.9.10'
make: *** [Makefile:1786: install] Error 2
It seems weird that it is trying to write to a directory /usr/lib/python3/
where I don't have write permissions even though I specified a different prefix directory.
Any idea what I could do to resolve this error?
Upvotes: 0
Views: 146
Reputation: 181199
It seems weird that it is trying to write to a directory /usr/lib/python3/ where I don't have write permissions even though I specified a different prefix directory.
It is very likely trying to write there because that's the library directory of the Python installation it located and used at build time.
Supposing that you do not want to, or cannot, disable building the Python components in the first place, a reasonably good alternative would be to install to a staging area that is writable to you, then move the files from there to the appropriate places. You can do this by specifying a suitable DESTDIR
variable to make install
:
mkdir -p ~/staging
make install DESTDIR=~/staging
You then can (and should) move files and folders from ~/staging
to the appropriate places in $HOME/install
or elsewhere.
Note well that DESTDIR
serves a different purpose than do configure's
installation-location options such as --prefix
. They are not interchangeable. The latter indicate where files are meant to be installed, and that can affect how they are built. DESTDIR
does not affect how files are built, just where make install
actually puts them. If they are sensitive to installation location -- and some software is -- then the software will not work correctly there.
Upvotes: 1