I have a project with CMake, devtoolset-6 and standart gcc 4.8.2 installed. CMake correctly finds correct gcc:
-- The C compiler identification is GNU 6.2.1
-- The CXX compiler identification is GNU 6.2.1
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-6/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-6/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
PATH and LD_LIBRARY_PATH are set
echo $PATH
/opt/rh/devtoolset-6/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
echo $LD_LIBRARY_PATH
/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib
The project builds correctly but lings against wrong libgcc and libstd++ from /usr/lib64
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f60b47bf000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007f60b45a8000)
What is wrong?