Re: Problem with linux-c7-devtoolset - seem to use FreeBSD ld

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Mon, 25 Mar 2024 10:27:21 UTC
On Fri, 22 Mar 2024 19:34:35 -0400 Martin Cracauer wrote:
> If you make a fresh install of linux-c7-devtoolset right now (on a
> system with no /compat/linux yet) you can't make executables.  It
> seems to invoke the FreeBSD ld.
> 
> This doesn't work:
> % /compat/linux/opt/rh/devtoolset-11/root/usr/bin/g++ -o l l.cc
> /usr/local/bin/ld: /mnt/part2/compat/linux/opt/rh/devtoolset-11/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/11/liblto_plugin.so: error loading plugin: Shared object "libc.so.6" not found, required by "liblto_plugin.so"
> collect2: error: ld returned 1 exit status
> % 
> 
> But it works if you separately invoke compiler and linker:
> % /compat/linux/opt/rh/devtoolset-11/root/usr/bin/g++ -c l.cc 
> % /compat/linux/opt/rh/devtoolset-11/root/usr/bin/ld.gold -o l l.o
> % 
> 

Probably something to do with your PATH variable.  Try this:
env PATH=/opt/rh/devtoolset-11/root/usr/bin:/usr/bin /compat/linux/opt/rh/devtoolset-11/root/usr/bin/g++ -o l l.cc