Is patchelf available on RHEL 9/Rocky 9 distributions? - runpath

I am trying to set RUNPATH within executables, including shared libraries, which will run on Rocky Linux 9. Using patchelf on Centos 7 works fine, but I am having trouble finding a version to use on Rocky 9.
On Rocky 9, when I perform $ sudo dnf provides patchelf, I get Error: No Matches found.
On Centos 7, I am able to install patchelf on Centos 7 successfully - sudo yum provides patchelf returns patchelf-0.12-1.el7.x86_64.
Alternatively, is there another tool available on Rocky 9 to change RUNPATH in a Linux executable?
My next step is to clone https://github.com/NixOS/patchelf and build on Rocky 9, but I am wondering why patchelf is not available on Rocky 9 in the first place.

Related

install llvm binaries without version number

When I install llvm using command
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
The binaries that get installed looks like following
All the binaries have version number. For e.g. llvm-objdump-15.
But the tools I use are looking for llvm-objdump, while installer installed it as llvm-objdump-15. I can create a symbolic link with name llvm-obdump, but I want to know how to install it correctly and not have version numbers in all these binaries?
I fixed it by using apt-get install
sudo apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang
It did install an older version, but it was fine for my needs
The names without version numbers are controlled by the llvm-defaults package on your distribution. It picks a specific version to make the default, and only that one has un-versioned symlinks installed into the system PATH.
As a consequence, on Debian based systems only one version (controlled by the distro) is going to be available there and it may not be the one from https://apt.llvm.org/. On these systems, the recommended way to use a specific version is to add the suffix.
If you can't do that, you should install the distro-provided version using the normal process rather than the versions on https://apt.llvm.org/.
To read more details about how all of this works, you can check out the documentation for the llvm-defaults package set here: https://salsa.debian.org/pkg-llvm-team/llvm-defaults/-/blob/experimental/debian/README.Debian

How to build g++ 10/C++20 on WSL2?

I would like to try out the new features of C++20 on Windows 10 & WSL2. Since my ubuntu on WSL2 was very old (16), I followed these instructions:
sudo apt update -y # makes apt system itself up-to-date
sudo apt dist-upgrade -y # updates Ubuntu 18.04 packages to latest
sudo do-release-upgrade # performs the upgrade to Ubuntu 20.04
Midway thru these directions for building g++ 10, I execute
contrib/download_prerequisites
and I get this error:
error: You must run this script in the top-level GCC source directory
The problem line of code seems to be
[ -e ./gcc/BASE-VER ] \
|| die "You must run this script in the top-level GCC source directory"
The problem is that while there is a gcc directory, there is no BASE-VER directory.
Is there a better set of instructions I should use? Is there a bug in this script?
Thanks
Siegfried
Being unfamiliar with WSL2 I cannot be sure, but this looks to me like...
[ -e ./gcc/BASE-VER ] should be referring to gcc/$BASE_VER or some such. Does it look like such a directory exists?
Also those apt commands updated you to version 18.04 of Ubuntu. do-release-upgrade goes one version at a time, roughly speaking. Assuming (?) you are on a LTS release (16.04) it will bump yu up one major version to the 18.04 version (major version numbers are even - a fact I only just noticed and I have been using Ubuntu since vit started....)

Cannot install llvm-9 or clang-9 on Ubuntu 16.04

I have not been able to install either llvm version 9 or clang version 9 on Ubuntu. We have installed them on Windows.
I have tried a command and saw this response.
sudo apt-get install llvm-9
Reading package lists... Done
Building dependency tree
Reading state information...
Done E: Unable to locate package llvm-9
I have also tried and saw this response.
sudo apt-get install clang-9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package clang-9
My /etc/apt/sources.list file contains
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9.0 main
I found the website and saw that the folder was llvm-toolchain-xenial-9. Trying that version did not work either.
What else can I do?
I have looked at downloading the binaries but am not sure what installation steps I might be missing. I am not interested in compiling source code.
The Clang/LLVM project provides Nightly build packages for Ubuntu and Debian.
See the https://apt.llvm.org
The goal is to provide Debian and Ubuntu [Clang and LLVM] packages ready to be installed with minimal impact on the distribution.
Packages are available for amd64 and i386 (except for recent Ubuntu) and for both the stable, old-stable and development branches (currently 8, 9 and 10).
Packages are built using stage2 and extremely similar to the one shipping in Debian & Ubuntu.
To use:
Add the appropriate repositories to the /etc/apt/sources.list file; there are distinct repos for different Debian and Ubuntu versions.
Add the apt key (shown in the link).
Run an apt update to refresh the cache.
Add packages with apt install clang-9 (or other package as desired).
If something "did not work" using the vetted package system, diagnose that issue directly. Xenial has Clang/LLVM 9 packages, and I've recently installed the packages into Disco.
The described symptom ("Unable to locate package") sounds as though one neglected to run apt update, in which case the packages from the newly-added sources would not be visible to apt. This is a tool-usage issue, not a lack of available packages.
LLVM INSTALLATION STEPS
-----------------------
LLVM Compiler Prerequisites:
OPERATING SYSTEM : Ubuntu 16.04 LTS
RAM : Minimum 16GB to 32GB
SWAP MEMORY : Minimum 10GB to 20GB
MEMORY NEEDED : Minimum 70GB
Install CMake version 3.5.1:
$sudo apt install cmake
LLVM Compiler Installation Steps
Step1:
#download llvm from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
#download clang from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
#extract files into folders:
tar -xf cfe-8.0.1.src.tar.xz
tar -xf llvm-8.0.1.src.tar.xz
#change directory names to llvm8 and clang
mv cfe-8.0.1.src clang
mv llvm-8.0.1.src llvm8
Step2 : #change present working directory to llvm_source_directory here it is llvm8
$cd llvm8
##create build directory
$mkdir build
##change pwd to build directory
$cd build
#Build (PATH =/llvm8/build)
#execute following command in build directory:
$cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../
Step3: #execute make command in pwd:
/llvm8/build$ make
Step4 : #after 100% of linking process execute following command in build directory:
$sudo make install
$ sudo reboot
step5 : #after installation restart your system!
#for checking llvm installation type
$llvm-config --version #it shows 8.0.1
$clang --version #it shows 8.0.1
Here are the commands for LLVM 9:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-9 libclang-9-dev llvm-9-dev

Deno on CentOS 7: 'GLIBC_2.18' not found

How to run Deno on Webfaction's CentOS 7 (64-bit)?
It gives an error:
deno: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by deno)
Current Deno release 1.0.0 (latest today) is not compatible with CentOS 7.
I tried on the latest distribution released on 27 April 2020:
$ cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
This issue 7 GLIBC_2.18 not found suggests that there should be a way to solve this problem, but the thread seems to be abandoned for a year.
As of today Deno requires GLIBC_2.18, but unfortunately CentOS 7 is running 2.17, an old version of the gclib which is not enough:
$ ldd --version
ldd (GNU libc) 2.17
If you need to run Deno on CentOS you'll need to use CentOS 8. Tested it and it works.
From How to fix “/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found”:
That means the program was compiled against glibc version 2.14, and it
requires that version to run, but your system has an older version
installed. You'll need to either recompile the program against the
version of glibc that's on your system, or install a newer version of
glibc (the "libc6" package in Debian).
It will not happen for CentOS 7. From glibc_2.18 on Centos 7:
No. Never going to happen. We ship glibc 2.17 as part of CentOS 7 and
that will never change. It's part of the basic RHEL standards that
stuff like this does not change within a major version.
I wouldn't count on Deno — which is a new technology — to backport with old compilers. Consider upgrading your servers to CentOS 8.
For me, I have no way to upgrade the OS as it's managed by IT department. Seems there's a workaround. I found the link on the following thread does work.
https://github.com/denoland/deno/issues/1658#issuecomment-632986792

Installing gcc on linux

How to install gcc version 4.8 on centos or scientific linux operating systems which require yum for installing.
I tried to download gcc from https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/ and then ran ./configure and then make. After running make it gives me the error: configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Is there some way by which I may install gcc version 4.8 on linux using yum install
I tried:
1). I tried with yum --enablerepo=testing-2-devtools-6 install devtoolset-2-gcc devtoolset-2-gcc-c++ it gives me repository not found
2). yum group install "Development Tools". It gives me Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
3). building it from scratch, you'll have to do ./contrib/download_prerequisites first to get MPFR, GMP and MPC in the GCC source tree, then make a separate directory and run /path/to/gcc/source/configure.
It gives:
configure: error: building out of tree but /home/Softwares/gcc-4.8.2
contains host-x86_64-unknown-linux-gnu
https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3/html/3.0_Release_Notes/DTS3.0_Release.html#Features
Install the Red Hat Developer Toolset 3.0 (or 2.X) in a way similar to what is described here. (Basically you use a repo someone else built for CentOS).
Google says to try
yum group install "Development Tools"
check out: http://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/