Cygwin+CMakeビルド
Cygwin portsのwxWidgets+Gtk2で元気に動く。
ただし、CygwinのwxWidgetsのwx-configはwx-config-2.8という名前になっているので、手で指定してやる必要がある。
cmake -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config-2.8 -DCMAKE_BUILD_TYPE=RelWithDebInfo ~/repos/mosh
また、CMakeがなぜかglibのインクルードパスを適切に設定してくれない。。(/usr/lib/glib-2.0/includeにも設定しないといけない。)
Cygwinビルドの特殊性
Cygwinビルドは微妙に特殊な設定になっているので、nmoshをビルドするには多少のワークアラウンドが必要になる。
- wchar_tがUTF-16
CygwinはABIをWin32と揃えている都合上、wchar_tが16bit幅になっている。なので、MinGWと同様に-fwide-exec-charset=ucs-4leする必要がある。
Win32(や、.net)以外でwchar_tが16bit幅というのはほぼ無いし、CygwinのようにいわゆるPOSIXで16bit幅などというのは非常に珍しい。。
- BoehmGCがpthreadとWin32 threadの両方を必要とする
BoehmGCはCygwinに対応しているが、pthreadだけでなくWin32 threadの方もビルドに含めないと:
CMakeFiles/nmosh.dir/extlibs/gc/typd_mlc.c.o: In function `GC_add_ext_descriptor': /home/oku/repos/mosh/extlibs/gc/typd_mlc.c:122: undefined reference to `_GC_need_to_lock' /home/oku/repos/mosh/extlibs/gc/typd_mlc.c:140: undefined reference to `_GC_need_to_lock' /home/oku/repos/mosh/extlibs/gc/typd_mlc.c:141: undefined reference to `_GC_need_to_lock' /home/oku/repos/mosh/extlibs/gc/typd_mlc.c:140: undefined reference to `_GC_allocate_ml'
のように出てビルドに失敗する。