On Thu, 24 Aug 2023 at 21:19, Brian Groose <brian@xxxxxxxxxx> wrote: > > On Thu, Aug 24, 2023 at 2:06 PM Jonathan Wakely via Gcc-help < > gcc-help@xxxxxxxxxxx> wrote: > > > > On Thu, 24 Aug 2023, 18:16 Shubham Srivastava via Gcc-help, < > > gcc-help@xxxxxxxxxxx> wrote: > > > > > Hi, > > > > > > When building gcc-12.3 with sources the libgfortran.so generated had > > > issignaling*@GLIBC_2.18 symbols. > > > We need to avoid these GLIBC_2.18 symbols so that our apps/products can > be > > > supported on platforms like rhel7 that doesn't support these GLIBC > symbols. > > > Is there any configuration option available that would help us avoid > > > generation of these symbols in libgfortran.so > > > Any other suggestions or thoughts on how to avoid these symbols? > > > > > > > Build on RHEL 7. > > > The other option that I've used is to build a cross compiler targeting the > oldest OS that you need to support. The nice thing about this is that you > can target a very old distro without having to run that disto and deal with > ancient versions of make, openssl, unpatched security vulnerabilities, etc. > > You need to: > > 1. Build a sysroot that contains the headers and libraries from the target > OS (CentOS7/RHEL7 in this case, if that's the oldest distro you need to > support). You can do this by copying files from a live system or unpacking > the appropriate RPMs such as glibc, glibc-devel, glibc-headers, > kernel-headers, etc. depending on which libraries you use in your code. > Generally these files are all found in /lib[64], /usr/lib[64], and > /usr/include. > > 2. Build binutils from source with "--target=x86_64-linux-gnu" and > "--with-sysroot=/path/to/sysroot" options. And probably > "--prefix=/path/to/new/cross-compiler" to place it somewhere else. > > 3. Build the compiler from source with similar options. In my case I use > "--target=x86_64-linux-gnu --disable-multilib --with-gnu-lc --with-gnu-lm > --with-gnu-as --with-gnu-ld --prefix=/path/to/new/cross-compiler > --with-sysroot=/path/to/sysroot --enable-languates=c,c++" > You'll have to change the languages to add fortran, and likely don't need > the "--with-gnu..." options which I had because sometimes my target isn't > Linux/GNU stuff. > > 4. When building the software, invoke the cross compiler instead and it > should Just Work. My own setup passes "--sysroot=/path/to/sysroot" to gcc, > g++ and ld but I suspect that is not required if the sysroot is in the same > path during compilation as it was when building gcc itself. That will work, but using podman or docker to run a RHEL 7 container seems less effort to me.