General hints for compiling and installing in a user folder (no root access required)
A good source of information is: https://www.linuxfromscratch.org/
Set environment variables such that everything can be found:
- Make sure the new binaries are found and used with priority:
- export PATH=/home/fphysics/smeuren/bin/:$PATH
- Test: which xyx → should now point to the home directory
- export CFLAGS='-I/home/fphysics/smeuren/include/ -L/home/fphysics/smeuren/lib -L/home/fphysics/smeuren/lib64'
export CPPFLAGS='-I/home/fphysics/smeuren/include/ -L/home/fphysics/smeuren/lib/ -L/home/fphysics/smeuren/lib64'
- export CXXFLAGS='-I/home/fphysics/smeuren/include/ -L/home/fphysics/smeuren/lib/ -L/home/fphysics/smeuren/lib64'
- Make sure that the local libraries are used:
https://stackoverflow.com/questions/13367025/how-to-force-using-local-shared-libraries-over-system-librariesexport LDFLAGS='-L/home/fphysics/smeuren/lib/ -L/home/fphysics/smeuren/lib64'
export LD_LIBRARY_PATH=/home/fphysics/smeuren/lib64/:/home/fphysics/smeuren/lib/:$LD_LIBRARY_PATH
- sh configure --prefix=/home/fphysics/smeuren/
- Parallel building: make all -j 40
- IMPORTANT: if you use a script to set all variables: "source set_env.sh"
Show current system info
- uname -r
- glibc version: https://dev.to/0xbf/how-to-get-glibc-version-c-lang-26he
Update May 19, 2024
- https://github.com/gflags/gflags
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/ -DCMAKE_POSITION_INDEPENDENT_CODE=ON
- https://github.com/google/glog
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/ -DCMAKE_POSITION_INDEPENDENT_CODE=ON
Libraries compiled May 16, 2024
- https://github.com/nfs-ganesha/ntirpc
- mkdir mybuild, cd mybuild
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/
- https://github.com/nfs-ganesha/nfs-ganesha
- mkdir mybuild, cd mybuild
cmake .. -DUSE_GSS=OFF -DUSE_NLM=OFF -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/
- gave up on nfs-utils
- https://www.linuxfromscratch.org/blfs/view/cvs/basicnet/libtirpc.html
- https://www.linuxfromscratch.org/blfs/view/cvs/basicnet/rpcsvc-proto.html
- https://www.linuxfromscratch.org/blfs/view/svn/basicnet/libevent.html
- https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release
- https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
- sh ./autogen.sh --prefix=/home/fphysics/smeuren/
sh ./configure --prefix=/home/fphysics/smeuren/ --disable-all-programs --enable-libmount --enable-libblkid
Libraries compiled Feb 24, 2024
- Latest Release of https://github.com/DrTimothyAldenDavis/SuiteSparse (7.6.0)
I had to disable fortran to be able to compile:CMAKE_OPTIONS="-DBLA_VENDOR=OpenBLAS -DSUITESPARSE_USE_FORTRAN=OFF -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/" make -j50
- https://github.com/google/glog/archive/refs/tags/v0.7.0.tar.gz
cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/ - https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz
Additional libraries Feb 13, 2024
- pango-1.39.0 (later versions had issues with glib)
- https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.htmlCMAKE_LIBRARY_PATH
- create extra build directory
- cmake: this worked: "cmake .. -DBUILD_JAVA=OFF -DBUILD_FAT_JAVA_LIB=OFF -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_opencv_apps=OFF -DBUILD_opencv_videoio=OFF -DCMAKE_LIBRARY_PATH=/home/fphysics/smeuren/lib -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/ -DWITH_GSTREAMER=OFF -DBUILD_opencv_gapi=OFF
- build: cmake --build . -j40
- make install
Attempt Nov 24, 2023 (successful)
Unless otherwise specified, all packages are configured using:
configure --prefix=/home/fphysics/smeuren/
- https://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.gz
sh configure --prefix=/home/fphysics/smeuren/ --disable-nls --enable-gprofng=no - https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz
- https://ftp.gnu.org/gnu/libtool/libtool-2.4.7.tar.gz
- https://ftp.gnu.org/gnu/bison/bison-3.8.tar.gz
- https://ftp.gnu.org/gnu/texinfo/texinfo-7.1.tar.gz
- gcc (see below)
- https://curl.se/download/curl-8.4.0.tar.gz
./configure --prefix=/home/fphysics/smeuren/ --with-openssl - https://cmake.org/files/v3.16/cmake-3.16.9.tar.gz
- https://cmake.org/files/v3.28/cmake-3.28.0-rc5.tar.gz
- https://gitlab.com/libeigen/eigen/-/archive/3.4-rc1/eigen-3.4-rc1.tar.gz
mkdir build, cd build
cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/
make install - https://github.com/xianyi/OpenBLAS/releases/download/v0.3.24/OpenBLAS-0.3.24.tar.gz
make USE_THREAD=0 USE_LOCKING=1 (ATTENTION: no multi-threading enabled at the level of open blas itself, read documentation)
make PREFIX=/home/fphysics/smeuren install - https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.gz
- https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v7.3.1.tar.gz
CMAKE_OPTIONS="-DLOCAL_INSTALL=true -DCMAKE_INSTALL_PREFIX=/home/fphysics/smeuren/ -DCMAKE_BUILD_PARALLEL_LEVEL=40" make - https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/
make install - https://sourceforge.net/projects/math-atlas/files/Stable/3.10.3/atlas3.10.3.tar.bz2/download
- https://www.swig.org/
- https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
./bootstrap.sh --prefix=/home/fphysics/smeuren/
./b2 install
Installing GCC
- Read:
- Install required libraries:
- Create a separate build directory outside of the source directory
- Configure flags (update 2024, Feb. 13):
- sh ../gcc-10.4.0/configure --prefix=/home/fphysics/smeuren/ --build=x86_64-linux-gnu --enable-languages=c,c++,fortran --with-mpfr-include=/home/fphysics/smeuren/include/ --with-gmp-include=/home/fphysics/smeuren/include/ --with-mpc-include=/home/fphysics/smeuren/include/ --with-mpfr-lib=/home/fphysics/smeuren/lib/ --with-gmp-lib=/home/fphysics/smeuren/lib/ --with-mpc-lib=/home/fphysics/smeuren/lib/ --disable-multilib --enable-static --disable-nls --disable-lto --disable-ce
- Before, this worked (apparently):
sh ../gcc-10.4.0/configure --prefix=/home/fphysics/smeuren/ --build=x86_64-linux-gnu --enable-languages=c,c++,fortran --with-mpfr=/home/fphysics/smeuren/software/ --with-gmp=/home/fphysics/smeuren/software/ --with-mpc=/home/fphysics/smeuren/software/ --disable-multilib --enable-static --disable-nls --disable-lto --disable-ce - If there are some issues with loading libraries: make sure "export LD_LIBRARY_PATH=/home/fphysics/smeuren/lib64/:/home/fphysics/smeuren/lib/:$LD_LIBRARY_PATH"
If there is interference with a previous build: load profile "0" after login
- First: 10.4, then 13.2 (maybe 13.2 immediately would have worked too)
- Errors:
- objalloc_free_block (struct objalloc *o, PTR block)
https://www.spinics.net/lists/gcchelp/msg54231.html
Something created a "ansidecl.h" file in my local include directory that was weird. I renamed it and it fixed this issue
- objalloc_free_block (struct objalloc *o, PTR block)
Installing Python
Prerequisites:
- https://www.zlib.net/zlib-1.3.tar.gz
- https://sourceware.org/pub/bzip2/bzip2-latest.tar.gz
make -f Makefile-libbz2_so
cp *.so* ~/smeuren/lib/ - https://ftp.gnu.org/gnu/texinfo/texinfo-7.1.tar.gz
- https://ftp.gnu.org/gnu/readline/readline-8.2-rc4.tar.gz
- https://www.sqlite.org/2023/sqlite-autoconf-3440200.tar.gz
- https://ftp.gnu.org/gnu/ncurses/ncurses-6.4.tar.gzhttps://ftp.gnu.org/gnu/texinfo/texinfo-7.1.tar.gz
- https://www.openssl.org/source/openssl-3.1.4.tar.gz
./config --prefix=/home/fphysics/smeuren/
Installing Python 3.12:
- https://docs.python.org/3/using/configure.html
- https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
configure --prefix=/home/fphysics/smeuren --with-ensurepip=install --enable-optimizations
make -j48
Bug Fixes:
- Initially, the build failed because I had include paths to a local python installation. They need to be removed
- export LIBS="-lgcov" needed
Packages
- use tinyproxy and port forwarding, then pip3 install as usual (set https_proxy=xyz properly!)
Recent version of Eigen
- https://eigen.tuxfamily.org/
- cmake ../eigen-3.4.0 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=/home/fphysics/smeuren/
Recent version of cmake
Recent version of gdb (not needed so far)
- https://ftp.gnu.org/gnu/gdb/
sh ../gdb-12.1/configure --prefix=/home/fphysics/smeuren/
Recent version of python3
- https://www.python.org/downloads/release/python-3104/
../Python-3.10.4/configure --prefix=/home/fphysics/smeuren/ --enable-optimizations
Recent version of libffi
Recent version of openssl
- https://www.openssl.org/source/
./config --prefix=/home/fphysics/smeuren/ --openssldir=/home/fphysics/smeuren/local/ssl/
Recent version of binutils
- https://ftp.gnu.org/gnu/binutils/
sh ../binutils-2.38/configure --prefix=/home/fphysics/smeuren/
Recent version of texinfo
- https://ftp.gnu.org/gnu/texinfo/
sh ../texinfo-6.8/configure --prefix=/home/fphysics/smeuren/
Recent version of make
- https://ftp.gnu.org/gnu/make/
sh ../make-4.3/configure --prefix=/home/fphysics/smeuren/
Recent version of libtool
- https://www.gnu.org/software/libtool/
sh ../libtool-2.4.6/configure --prefix=/home/fphysics/smeuren/
Recent version of bison
Recent version of gcc
- GMP: https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz (compiled fine)
- MPFR: https://www.mpfr.org/ (compiled fine)
- MPC: https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz (compiled fine)
- GCC: https://bigsearcher.com/mirrors/gcc/releases/
https://superuser.com/questions/986949/upgrading-gcc-for-a-specific-user-account
https://stackoverflow.com/questions/9450394/how-to-install-gcc-piece-by-piece-with-gmp-mpfr-mpc-elf-without-shared-libra
https://stackoverflow.com/questions/11502045/gcc-compilation-cannot-compute-suffix-of-object-files-cannot-compile
sh ../configure --prefix=/home/fphysics/smeuren/ --enable-static --build=x86_64-linux-gnu --enable-languages=c,c++,fortran --disable-multilib - sh ../gcc-6.5.0/configure --prefix=/home/fphysics/smeuren/ --build=x86_64-linux-gnu --enable-languages=c,c++,fortran --with-mpfr=/home/fphysics/smeuren/ --with-gmp=/home/fphysics/smeuren/ --with-mpc=/home/fphysics/smeuren/
Not needed, ignore
Recent version of glibc (better not to change, ignore this section)
TLDR: I followed the advice to 'install' to a tmp directory, and erase all files from my actual home directory, to get back to the version provided by the system. To do this, I used:
from os import walk import sys from os.path import exists import os erasepath = ".." path = '/home/fphysics/smeuren/' for (dirpath, dirnames, filenames) in walk('.'): for name in filenames: tempfile = dirpath+"/"+name print('file: ',tempfile, 'test: ', path+tempfile[2:]) if(exists(path+tempfile)== True): os.remove(path+tempfile[2:])
gcc was recompiled afterwards, no issues.
- http://ftp.gnu.org/gnu/glibc/
The latest version that is still compatible with the 2.6.32 kernel is:
add "-O3 and -w" flags to CFLAGS and CPPFLAGS
export LD_LIBRARY_PATH=/home/fphysics/smeuren/lib
sh ../glibc-2.23/configure --prefix=/home/fphysics/smeuren/ --enable-kernel=2.6.32 - In case something goes wrong: login with a different profile (e.g., 0) and remove the corrupted files
- How to 'uninstall':
https://stackoverflow.com/questions/33070135/how-to-remove-a-broken-installation-of-glibc - General hints:
https://stackoverflow.com/questions/68828494/building-glibc-from-source-causes-an-error
https://unix.stackexchange.com/questions/9705/can-new-glibc-versions-be-used-with-an-old-kernel
Recent Kernel Headers (better not to mess with this, ignore this section)
- It seems to be recommended to use the latest kernel headers even if the running kernel is older
- https://cdn.kernel.org/pub/linux/kernel/v5.x/