Qt OSS版をMac OS Xにソースコードからインストールしてみた
Mac OS X 10.11.6, Qt 5.8.0, Xcode 7.2
Qtはデュアルライセンスなので、必ずしもGPLで開発しなければならないわけではないが、ここではGPLのプロジェクトとして開発する環境を前提とする。
【ポイント】
- GPL, LGPLライセンス
- GCCではなくclang(Xcode)のmakeでコンパイルする
- GNUのlibtoolのパスを通しておかないこと(Xcodeコマンドラインツールのlibtoolが使われるようにしておく)
- インストール先を指定する場合、
--prefix=path
ではなく、-prefix path
とする - make時に複数コアを使わせてはいけない
- コンパイルにめっちゃ時間がかかる(私の環境で5時間くらい)
以下、作業ログ
(事前にXcodeとコマンドラインツール、wgetコマンドはインストール済み)
$ export QT_HOME=$HOME/path/to/somewhere # Install Qt by clang with Xcode. (not GCC and GNU softwares.) $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer $ sudo xcodebuild -license agree # And path of the GNU libtool must not be passed. # https://bugreports.qt.io/browse/QTBUG-42835 # It must be Xcode libtool, That is what the following state is correct. $ which libtool /usr/bin/libtool $ libtool -V Apple Inc. version cctools-877.8 # Now, Let's start installing Qt. $ cd $QT_HOME/download $ wget http://download.qt.io/official_releases/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz $ tar xf qt-everywhere-opensource-src-5.8.0.tar.gz $ cd qt-everywhere-opensource-src-5.8.0 # http://doc.qt.io/qt-5/configure-options.html # Caution: `--prefix=path` is not correct, `-prefix path` is correct here. $ ../configure -prefix $QT_HOME # Type 'o' to install Open Source Edition. # Type 'yes' to accept LGPL3 and GPL2 license offer. # > Note: There is a potential race condition when running make install with multiple jobs. # > It is best to only run one make job (-j1) for the install. $ make -j1 # Wait for compile, quite a long time. (about 4-5h) $ make install