Seen that RHEL 9.1 is now out https://www.phoronix.com/news/Red-Hat-E ... -Linux-9.1 and that it now includes GCC 12.
Does anyone know if this refers to gcc-toolset-12-gcc or should I be able to use it form the "dnf module list". I'm currently using CentOS Stream 9 and thought this was a bit of a testing ground for some of this suff so should be there but only the toolset version is.
Gcc verson stream 9
Re: Gcc verson stream 9
The gcc-toolset-12 is a collection of packages that contains build tools, including GCC 12.
It is not a separate "stream", but continues the "Software Collection" style.
You can install them without removing the corresponding system packages.
You have to use the 'scl' command, e.g.
scl enable gcc-toolset-12 bash
(or something like that) to get bash session, where you can use tools from the toolset.
It is not a separate "stream", but continues the "Software Collection" style.
You can install them without removing the corresponding system packages.
You have to use the 'scl' command, e.g.
scl enable gcc-toolset-12 bash
(or something like that) to get bash session, where you can use tools from the toolset.
-
- Posts: 21
- Joined: 2018/11/29 14:29:36
Re: Gcc verson stream 9
Is there a way to have scl enabled for a service ? The boss has written a http server that you can issue commands to execute scripts that build our code. I could never get it to actually use the scl version so gave up.
Re: Gcc verson stream 9
Yes.
As example, CentOS 7 has package 'rh-mariadb105-mariadb-server'.
It does supply files, like:
It is thus possible to systemctl start rh-mariadb105-mariadb without calling 'scl'.
The rh-mariadb105-mariadb.service contains (among other things):
In other words, systemd does not simply run "mysqld", it runs
(I won't dig into 'mysqld-scl-helper' to see haw it differs from 'scl'.)
The crucial point is that the EnvironmentFile is sourced in order to modify the environment.
The 'scl' does source a file too, the /opt/rh/rh-mariadb105/enable that contains:
In principle, one could set all those in EnvironmentFile of a service, rather than call 'scl',
but then one has to maintain that file.
The /opt/rh/gcc-toolset-12/enable (in AlmaLinux 9) has:
That is, something is prepended into PATH, MANPATH, INFOPATH, PCP_DIR, LD_LIBRARY_PATH, and PKG_CONFIG_PATH.
Your automation does not run 'man' or 'info', does it? Therefore, the service won't need those two paths.
The httpd.service (on CentOS 7) does set EnvironmentFile=/etc/sysconfig/httpd. The version on el9 might not.
RHEL documentation about systemd does tell how to override bits of existing unit file.
PS: You are not running CentOS Stream on production, are you?
I'd rather (well, I do) run AlmaLinux 9 (although Rocky Linux 9 is just as good).
As example, CentOS 7 has package 'rh-mariadb105-mariadb-server'.
It does supply files, like:
Code: Select all
/opt/rh/rh-mariadb105/service-environment
/usr/lib/systemd/system/rh-mariadb105-mariadb.service
/opt/rh/rh-mariadb105/enable
The rh-mariadb105-mariadb.service contains (among other things):
Code: Select all
[Service]
# Load collections set to enabled for this service
EnvironmentFile=/opt/rh/rh-mariadb105/service-environment
# We want to start server only inside "scl enable" invocation
ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mariadb105
ExecStart=/opt/rh/rh-mariadb105/root/usr/libexec/mysqld-scl-helper enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mariadb105/root/usr $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
ExecStartPost=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-upgrade
Code: Select all
and the /opt/rh/rh-mariadb105/service-environment explains a bit:
# Services are started in a fresh environment without any influence of user's
# environment (like environment variable values). As a consequence,
# information of all enabled collections will be lost during service start up.
# If user needs to run a service under any software collection enabled, this
# collection has to be written into RH_MARIADB105_SCLS_ENABLED variable
# in /opt/rh/rh-mariadb105/service-environment.
RH_MARIADB105_SCLS_ENABLED="rh-mariadb105"
Code: Select all
mysqld-scl-helper enable rh-mariadb105 mysqld
The crucial point is that the EnvironmentFile is sourced in order to modify the environment.
The 'scl' does source a file too, the /opt/rh/rh-mariadb105/enable that contains:
Code: Select all
# For binaries
export PATH="/opt/rh/rh-mariadb105/root/usr/bin:/opt/rh/rh-mariadb105/root/usr/sbin${PATH:+:${PATH}}"
# For header files
export CPATH="/opt/rh/rh-mariadb105/root/usr/include${CPATH:+:${CPATH}}"
# For libraries during build
export LIBRARY_PATH="/opt/rh/rh-mariadb105/root/usr/lib64${LIBRARY_PATH:+:${LIBRARY_PATH}}"
# For libraries during linking
export LD_LIBRARY_PATH="/opt/rh/rh-mariadb105/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
# For man pages; empty field makes man to consider also standard path
export MANPATH="/opt/rh/rh-mariadb105/root/usr/share/man:${MANPATH:-}"
# For Java Packages Tools to locate java.conf
export JAVACONFDIRS="/etc/opt/rh/rh-mariadb105/java${JAVACONFDIRS:+:}${JAVACONFDIRS:-}"
# For XMvn to locate its configuration file(s)
export XDG_CONFIG_DIRS="/etc/opt/rh/rh-mariadb105/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}"
# For systemtap
export XDG_DATA_DIRS="/opt/rh/rh-mariadb105/root/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
# For pkg-config
export PKG_CONFIG_PATH="/opt/rh/rh-mariadb105/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
but then one has to maintain that file.
The /opt/rh/gcc-toolset-12/enable (in AlmaLinux 9) has:
Code: Select all
# General environment variables
export PATH=/opt/rh/gcc-toolset-12/root/usr/bin${PATH:+:${PATH}}
export MANPATH=/opt/rh/gcc-toolset-12/root/usr/share/man${MANPATH:+:${MANPATH}}
export INFOPATH=/opt/rh/gcc-toolset-12/root/usr/share/info${INFOPATH:+:${INFOPATH}}
# ??? We probably don't need this anymore.
export PCP_DIR=/opt/rh/gcc-toolset-12/root
# bz847911 workaround:
# we need to evaluate rpm's installed run-time % { _libdir }, not rpmbuild time
# or else /etc/ld.so.conf.d files?
rpmlibdir=$(rpm --eval "%{_libdir}")
# bz1017604: On 64-bit hosts, we should include also the 32-bit library path.
# bz1873882: On 32-bit hosts, we should include also the 64-bit library path.
# bz2027377: Avoid unbound variables
if [ "$rpmlibdir" != "${rpmlibdir/lib64/}" ]; then
rpmlibdir32=":/opt/rh/gcc-toolset-12/root${rpmlibdir/lib64/lib}"
rpmlibdir64=
else
rpmlibdir64=":/opt/rh/gcc-toolset-12/root${rpmlibdir/lib/lib64}"
rpmlibdir32=
fi
# Prepend the usual /opt/.../usr/lib{64,}.
export LD_LIBRARY_PATH=/opt/rh/gcc-toolset-12/root$rpmlibdir$rpmlibdir64$rpmlibdir32${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PKG_CONFIG_PATH=/opt/rh/gcc-toolset-12/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
Your automation does not run 'man' or 'info', does it? Therefore, the service won't need those two paths.
The httpd.service (on CentOS 7) does set EnvironmentFile=/etc/sysconfig/httpd. The version on el9 might not.
RHEL documentation about systemd does tell how to override bits of existing unit file.
PS: You are not running CentOS Stream on production, are you?
I'd rather (well, I do) run AlmaLinux 9 (although Rocky Linux 9 is just as good).
-
- Posts: 21
- Joined: 2018/11/29 14:29:36
Re: Gcc verson stream 9
Thanks for the in depth response, will give that a try and see if i can make it work.