OS X EI Capitan 10.11.2に最新版のGCCをBuildした作業ログ
最新版のファイルをダウンロード、解凍、整理。
$ wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-6.1.0/gcc-6.1.0.tar.gz $ tar zxvf gcc-6.1.0* $ rm gcc*tar.gz && cd gcc-*
依存パッケージのインストールとシンボリックリンクを張る作業。
$ ./contrib/download_prerequisites
makefile作成
$ ../gcc*/configure --prefix=/usr/local/gcc-6.1.0 --enable-languages=c,c++,objc,fortran --disable-multilib --disable-bootstrap
make
$ make -j 4
...すると/usr/includeディレクトリがないエラーが見えたため確認するとなんとLionからアップグレードした際にXcodeのコマンドラインツールが引き継がれていない事に気付く。
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
コマンドラインツールをインストールし再度makeをし直してmake install。並列処理が効いたのか5分程で処理完了。
いくつかC++1zのサポートを確認したりしてインストールが無事に行われた事を確認できた。
$ g++ -v 組み込み spec を使用しています。 COLLECT_GCC=/usr/local/gcc-6.1.0/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc-6.1.0/libexec/gcc/x86_64-apple-darwin15.2.0/6.1.0/lto-wrapper ターゲット: x86_64-apple-darwin15.2.0 configure 設定: ../gcc-6.1.0/configure --prefix=/usr/local/gcc-6.1.0 --enable-languages=c,c++,objc,fortran --disable-multilib --disable-bootstrap スレッドモデル: posix gcc バージョン 6.1.0 (GCC) $ cat test.cpp #include<vector> #include<type_traits> #include<iterator> #include<iostream> namespace N::N1{ // N4243:Nested namespace definition (Revision 2) template<template<class ...>typename Container> // N4051:Allow typename in a template template parameter struct A{Container<unsigned int> a;}; } int main() { N::N1::A<std::vector> v; constexpr unsigned int a(0); constexpr unsigned int b(0); static_assert(a==b); // static_assert(std::is_integral_v<decltype(a)>); // Unimplemented. // P0006R0:Adopt Type Traits Variable Templates from Library Fundamentals TS for C++17 static_assert(std::is_integral<decltype(a)>::value); std::vector<unsigned int> vec{1,2,3,4,5,}; for(unsigned int i=0; i<std::size(vec); ++i) // N4280 Non-member size() and more (Revision 2) std::cout<<vec[i]<<std::endl; } $ g++ -std=c++1z test.cpp
一応、最新のGCCでのC++1zがどの程度Availableなのかは以下で確認できる。
C++ Standards Support in GCC - GNU Project - Free Software Foundation (FSF)
P0006R0についてなんかはまずリストにすら上がってきていないけど...これからなのかな。 まあ結構僕はGCC信者のようなところが少しあるので、のんびりどうぞって感じではある。
取り敢えず、無事インストールできて良かった。
OS X EI CapitanでGCC6.1.0を並列makeなう。 pic.twitter.com/cqkwiPaxeS
— 五味拓樹 (@530506) 2016年6月5日
make installも無事完了し晴れて現段階のC++1zコードが通るようになりました😁(今頃) pic.twitter.com/NK3flIoGKB
— 五味拓樹 (@530506) 2016年6月5日