On 2 June 2011 15:20, Marc Glisse wrote: > On Thu, 2 Jun 2011, Jonathan Wakely wrote: > >> I have a handful of versions installed in ~/gcc/ and invoke them via a >> script like >> >> #!/bin/bash >> : ${ver:=4.7} >> : ${libdir:=lib64} >> $HOME/gcc/$ver/bin/g++ -Wl,-rpath,$HOME/gcc/$ver/$libdir -Wall -g "$@" > > When you have many versions, it may be more convenient to add a spec file > that does the rpath thing. This way you can call any g++ in any way without > bothering with wrappers and without risk. I often don't want to use -rpath at all. Now and then I need to compile with one version and run against a different libstdc++.so to ensure I haven't broken the ABI, so I mix and match g++ and libstdc++.so versions. But that's not something most people will ever need to do. So optional wrapper scripts work for me. YMMV.