Squidをコンパイルしたらエラー

Squidの新しいバージョンがでていたので、ソースをダウンロードしてコンパイル
そうするとこんなエラーがでました。

g++ -march=native -g -O2 -march=native -o cf_gen ./cf_gen.cc -I. -I../include/ -I../src
./cf_gen cf.data ./cf.data.depend
./cf_gen: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./cf_gen)
./cf_gen: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./cf_gen)
./cf_gen: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./cf_gen)
make[1]: *** [cf_parser.cci] エラー 1
make[1]: ディレクトリ `/home/hoge/squid/squid-4.0.17/src' から出ます
make: *** [all-recursive] エラー 1

どうもgccと、gccが参照しているlibstdc++.so.6のバージョンが一致していない模様。
そういえば、このマシンにはgccの最新版をソースからインストールしたんでした。

$ which gcc
/usr/local/bin/gcc
$ /usr/local/bin/gcc -v
組み込み spec を使用しています。
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-redhat-linux/6.2.0/lto-wrapper
ターゲット: x86_64-redhat-linux
configure 設定: ../configure --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++ --disable-dssi --enable-libgcj-multifile --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --disable-multilib
スレッドモデル: posix
gcc バージョン 6.2.0 (GCC) 

/usr/local/bin/に入れているので対応するglibcは/usr/local/lib64に入っています。

 ls -l /usr/local/lib64/libstdc++*
-rw-r--r-- 1 root root 28870184 11月 18 15:53 2016 /usr/local/lib64/libstdc++.a
-rwxr-xr-x 1 root root      965 11月 18 15:53 2016 /usr/local/lib64/libstdc++.la
lrwxrwxrwx 1 root root       19 11月 18 15:53 2016 /usr/local/lib64/libstdc++.so -> libstdc++.so.6.0.22
lrwxrwxrwx 1 root root       19 11月 18 15:53 2016 /usr/local/lib64/libstdc++.so.6 -> libstdc++.so.6.0.22
-rwxr-xr-x 1 root root 11175732  6月 10 10:48 2016 /usr/local/lib64/libstdc++.so.6.0.21
-rw-r--r-- 1 root root     2397  6月 10 10:48 2016 /usr/local/lib64/libstdc++.so.6.0.21-gdb.py
-rwxr-xr-x 1 root root 11512853 11月 18 15:53 2016 /usr/local/lib64/libstdc++.so.6.0.22
-rw-r--r-- 1 root root     2397 11月 18 15:53 2016 /usr/local/lib64/libstdc++.so.6.0.22-gdb.py
-rw-r--r-- 1 root root 10807726 11月 18 15:53 2016 /usr/local/lib64/libstdc++fs.a
-rwxr-xr-x 1 root root      905 11月 18 15:53 2016 /usr/local/lib64/libstdc++fs.la

なので、/usr/local/lib64以下をldconfigで認識させる。
名前は適当につけて、以下の一行を書いたファイルを/etc/ld.so.conf.dにおく。

/usr/local/lib64

でもって、rootでldconfigをたたく。
これで上記のエラーはでなくなりました。別のエラーがでてSquidはmakeできませんでしたが。
それは別の日のエントリで。