LoginSignup
3
6

More than 5 years have passed since last update.

CentOS6.7(32bit)でVSCodeを起動

Last updated at Posted at 2017-01-19

…これが初投稿。


背景

CentOSでRubyをやることになり、開発どーしよっかなーと思ったときにVSCodeを入れてみようと思ったのが事の発端。

実行1:ダウンロードし実行

https://code.visualstudio.com/docs/setup/linux
読むとバイナリが用意されてるとのこと。
https://code.visualstudio.com/Download
面倒なんでtar.gzをダウンロードして解凍して実行

./code: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.5` not found
./code: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15` not found
./code: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14` not found
./code: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15` not found

動かん…。
libstdc++を確認

strings /usr/lib/libstdc++.so.6 | grep GLIBCXX

GLIBCXX_3.4
GLIBCXX_3.4.1
…(省略)
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

はい、ないですね^^;

実行2:libstdc++更新

参考:https://www.saintsouth.net/blog/update-libstdcpp-on-centos6/

libstdc++はgccに含まれているのでgccをビルドして取り出す。
このサイトは4.8.4ですが、4.9.4でやってみました。

yum install gmp-devel mpfr-devel libmpc-devel
yum install glibc-devel.i686
mkdir -p ~/src
cd ~/src
curl -LO http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.gz
tar fxz gcc-4.9.4.tar.gz
cd gcc-4.9.4
./configure
make

※かなり時間かかります。

makeし終わったら置き換え。

ls -l /usr/lib/libstd*
cp ${HOME}/src/gcc-4.9.4/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.19 /usr/lib
cd /usr/lib
mv libstdc++.so.6 libstdc++.so.6.bak
ln -s libstdc++.so.6.0.20 libstdc++.so.6

これでlibstdc++が更新されました。
これは元々GLIBCXXを更新するためなので、先程のコマンドで確認。

strings /usr/lib/libstdc++.so.6 | grep GLIBCXX

GLIBCXX_3.4.15があることを確認してください。

これでVSCode動くだろ?と思ったら今度はこんなエラー

./code: symbol lookup error: ./code: undefined symbol: g_bytes_unref

はい?

実行3:glib更新

glibのバージョンが2.12だったので、これを2.32に更新してみる。

cd /root/
mkdir glib-source
cd glib-source/
wget http://ftp.gnome.org/pub/GNOME/sources/glib/2.32/glib-2.32.4.tar.xz
tar -xf glib-2.32.4.tar.xz
cd glib-2.32.4/
./configure --prefix=/usr/local/glib-2.32

No package 'libffi' found

libffiがない?
公式サイト(https://sourceware.org/libffi/ )からダウンロード。

./configure
make
make install
export LIBFFI_CFLAGS=-I/usr/local/lib/libffi-3.2.1/include
export LIBFFI_LIBS="-L/usr/local/lib -lffi"

これでようやくglibに戻れます。

./configure --prefix=/usr/local/glib-2.32
make
make install

終了、これでもう一回codeが動くか確認。

./code: symbol lookup error: ./code: undefined symbol: g_bytes_unref

なんで動かないんだ!

実行4:glib更新2

参考:http://xpb8dqx.blogspot.jp/2012/09/glib232.html

このサイト見るとglibのconfigureが違うことに気付く

./configure --with-libiconv

よしっ、これでやってみるか。

./configure --with-libiconv
…(略)
configure: error: *** No iconv() implementation found in C library or libiconv

はいはい、入れればいいんでしょ。
公式サイト(https://www.gnu.org/software/libiconv/ )からダウンロードして、
configure->make->make install

でどうだ!
configureは通った、makeもうまくいった、make installは…、

libtool: install: error: cannot install `libgthread-2.0.la' to a directory not ending in /usr/local/glib-2.32/lib

なんで?

make clean
./configure --with-libiconv
make
make install

あれ、できた。
どうやら前のゴミが残ってたようで…^^;

後はパス書き換え

echo "/usr/local/lib" >> /etc/ld.so.conf
/sbin/ldconfig

実行5:起動完了

アイコンのVSCode内のcodeを実行するとようやく起動できました。


参考サイト

3
6
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6