[CMake] selecting correct g++/libstdc++.so pair

Michael Hertling mhertling at online.de
Thu Nov 18 17:49:50 EST 2010


On 11/18/2010 11:01 PM, Russell L. Carter wrote:
> Hi all,
> I have three g++ versions installed.  Debian's native g++-4.3 and
> g++-4.4 both use /usr/lib/libstdc++.so.6.13, while
> /usr/local/bin/g++-4.5 needs /usr/local/lib64/libstdc++.so.6.14.
> 
> If I use CXX=/usr/local/bin/g++-4.5 at configure time, executables
> are linked against /usr/lib/libstdc++.so.6.13, which is not what
> I want.  What is the approved Cmake Way for insuring that executables
> using g++-4.5 link against libstdc++.so.6.14?

The selection of libstdc++ takes place by the usual library searching
mechanism, so you must ensure that /usr/local/lib64/libstdc++.so.6.14
takes precedence over /usr/lib/libstdc++.so.6.13 for runtime linking.
Use ldconfig in connection with /etc/ld.so.conf, the LD_LIBRARY_PATH
environment variable et al., or pass appropriate rpath settings to
the linker, whatever suits your needs best.

Regards,

Michael


More information about the CMake mailing list