libreofficeをwindows上でビルドする
DESCRIPTION
第5回関西LibreOffice勉強会の資料です。TRANSCRIPT
1LibreOffice Productivity Suite
LibreOfce を Windows 上でビルドする( LibreOfce 4.2 以降)
Tomofumi Yagi <yagitmknada[at]gmail.com>2013-12-14 第 5 回 関西 LibreOffice 勉強会
2LibreOffice Productivity Suite
今日お話する内容
前置きビルド環境構築手順ビルド手順困っていることなど
The Document Foundation Wiki(TDF Wiki) の内容に習ってWindows 上で LibreOfce をビルドする手順を紹介します
https://wiki.documentfoundation.org/Development/Windows_Build_Dependencies
※LibreOfce 4.2 以降が対象です
3LibreOffice Productivity Suite
前置き
4LibreOffice Productivity Suite
必要な開発ツールについて
1.Cygwin2.GNU Make(LibreOfce patched version)3.Java SE Development Kit 74.Apache Ant5.Visual Studio Express 2012 for Windows Desktop
※ 一部の機能を無効にしてビルドすることで環境構築を簡略化します
5LibreOffice Productivity Suite
ビルドする LibreOfce のバージョンを選ぶ
4.2 か master を選択 (2013 年 12 月時点 )4.2 以降はビルドもデバッグも楽
依存している開発ツール類が減り、ビルド環境構築が楽になった日本語環境でのビルドや日本語 UI のビルドがやりやすい
ビルド環境はどんどん改善される古いバージョンをビルドするのは時間の無駄(?)恐らく、このスライドの内容 (2013 年 12 月時点 ) も、あっという間に古くなります
Building LibreOfce from an IDE,etc...
6LibreOffice Productivity Suite
用意する OS 、ハードウェア
OS は Windows 7 / 8 / 8.1 どれでもビルド可32 ビット OS / 64 ビット OS のどちらもビルド可
ハードウェアは、いまどきの一般的な PC を想定CPU はマルチコア、搭載メモリは 4GB 以上、ストレージの空きも 100GB くらいありますよね ...
7LibreOffice Productivity Suite
ビルド環境構築手順
8LibreOffice Productivity Suite
ビルド環境構築手順の概観
① Cygwin のインストール② GNU Make(LibreOfce patched version) のインストール③ Java SE Development Kit 7 のインストール④ Apache Ant のインストール⑤ Visual Studio Express 2012 for Windows Desktop のイン
ストール⑥ LibreOfce のソースコード取得
9LibreOffice Productivity Suite
① Cygwin のインストール
Cygwin のサイトからインストーラー (setup-x86.exe か setup-x86_64.exe) をダウンロード-P オプションを付けてコマンドプロンプトからインストーラーを実行
インストールするパッケージのリストを指定して楽しますパッケージのリストは TDF Wiki に書かれている方が汎用的かも ...
GUI のインストーラーが起動するので続けて操作
REM コマンドプロンプト上で実行してくださいREM 実際は一行ですC:¥tmp> setup-x86.exe -P autoconf,automake,bison,doxygen,flex,gcc4-g++,git,gperf, make,patch,perl,python,pkg-config,unzip,zip,curl,wget, perl-Archive-ZipC:¥tmp>
10LibreOffice Productivity Suite
② GNU Make(LibreOfce patched version) のインストール
dev-www.libreofce.org で配布されているバイナリをダウンロードして /opt/lo/bin 等へ配置
http://dev-www.libreofce.org/bin/cygwin/makeこのバイナリは 64 ビット版の cygwin で使えないので注意(自分でソースからビルドする)
;; Cygwin Terminal上で実行してください$ mkdir -p /opt/lo/bin$ cd /opt/lo/bin$ curl -O http://dev-www.libreoffice.org/bin/cygwin/make$ chmod +x make$ /opt/lo/bin/make -vGNU Make 4.0…LibreOffice patched version$
11LibreOffice Productivity Suite
③ Java SE Development Kit 7 のインストール
Oracle のサイトから Windows x86 用 ( 必ず 32 ビット版 ) をダウンロードしてインストール
http://www.oracle.com/technetwork/java/javase/downloads/index.html
12LibreOffice Productivity Suite
④ Apache Ant のインストール
Apache のサイトからバイナリをダウンロードして、解凍して適当なフォルダに配置
http://ant.apache.org/
13LibreOffice Productivity Suite
⑤ Visual Studio Express 2012 for Windows Desktop のインストール
マイクロソフトのダウンロードセンターからダウンロードしてインストール
http://www.microsoft.com/ja-jp/download/details.aspx?id=34673Visual Studio 2012 の更新プログラムを適用
ビルドしてできたバイナリを XP 上で実行したいなら必須
なぜ Visual Studio Express 2012 for Windows Desktop ?SDK 類が一緒にインストールされるので楽
Windows SDK 、 DirectX SDK 、 .NET FrameworkExpress 版でもごく一部の機能を除けばビルド可能
14LibreOffice Productivity Suite
⑥ LibreOfce のソースコード取得
dev-www.libreofce.org で配布されているツールを使ってダウンロード (lo-submodules-from-bundles.sh)
もちろん普通に git clone してもよいそれなりに時間が掛かる。4.2 をビルドする場合は、 ./g checkout してブランチを切り替え
$ mkdir /cygdrive/c/lo/$ cd /cygdrive/c/lo/$ wget http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/plain/lo-submodules-from-bundles.sh$ chmod u+x lo-submodules-from-bundles.sh$ ./lo-submodules-from-bundles.sh -t core transrations help dictionaries$ cd core$ ./g pull$ ./g checkout --track remotes/origin/libreoffice-4-2 $
15LibreOffice Productivity Suite
ビルド手順
16LibreOffice Productivity Suite
ビルド手順の概観
① autogen.sh の実行② make③ 実行とデバッグ④ ビルドエラーが発生したら
17LibreOffice Productivity Suite
① autogen.sh の実行
autogen.sh にオプションを指定Windows は他の OS に比べて指定すべき項目が多いVisual Studio Express を使うときは --disable-atl と --disable-activex を追加エラーが解消したら mv autogen.lastrun autogen.input しておく
;;実際は 1行です。私が使っている設定です。$ ./autogen.sh--with-lang=ja--enable-debug--enable-dbgutil--with-distro=LibreOfficeWin32 --with-jdk-home=”/cygdrive/c/Program Files/Java/jdk1.7”--with-ant-home=”/cygdrive/c/ant” --disable-win-mozab-driver--disable-ia2--disable-atl--disable-activex--enable-pch--disable-ccache
--disable-ia2 は4.2のみ指定してください。masterではエラーになります。
18LibreOffice Productivity Suite
② make
先ほどダウンロードした LibreOfce patched version のmake を実行
Cygwin 標準の make ではエラー!!実は make すれば必要な処理が実行される
autogen.shサブモジュールの取得ダウンロード
パッケージ、翻訳ファイル、辞書、ヘルプLibreOfce のビルドが始まる
時間が掛かるのでしばし待つ$ /opt/lo/bin/make …$
19LibreOffice Productivity Suite
③ 実行とデバッグ
ビルドできたら instdir/program/sofce.exe を実行LibreOfce が起動するVisual Studio を起動し、 sofce.bin プロセスにアタッチしてデバッグする
ソースコードデバッグが可能なはずインストーラー (msi) はworkdir/installation/LibreOfce_Dev/msi/install/en-US_ja_qtz 配下にある
$ ./instdir/program/soffice.exe…
20LibreOffice Productivity Suite
④ ビルドエラーが発生したら
エラーメッセージやログを見て修正時々コミットが原因で Windows のビルドが壊れることがある最近は、あっという間に修正される(?)
Tinderbox のビルド状況を見るhttp://tinderbox.libreofce.org/MASTER/status.html
ビルドエラー修正のコミットがないかリポジトリを見るhttp://cgit.freedesktop.org/libreofce/core/
21LibreOffice Productivity Suite
ビルドに成功するコミットハッシュ一覧( 2013 年12 月 30 日追記)
VS Express 版 + 日本語の環境でビルドに成功するコミットハッシュ一覧( 2013 年 12 月 19 日〜 12 月 29 日)
mastercommit 1542a655ea21da4cdcd4b836283e44fba5f35059 - 12/19commit f0c03edd639fd792b36d1bfc5fe54a52d67c9dee - 12/20commit 5d3b3b9fc15bac8bba286e64a6a0e28f2dbb8529 - 12/23commit 46205b2e4c16938a158cf3b2ae16107e34f7793 - 12/24commit dbd8a631bb23c588f52102e5dd2a61c9cd854bc3 - 12/27commit 32a32d572c91cddc156cd91fbb35f01fd3c56d97 - 12/28commit f039d36ec5404f76c5472d04593e04096bf4252d - 12/29ただしmergemodule.pmの修正が必要です(後述)。12/20 のこことか、 12/29 のここはビルドに失敗しました。
4.2commit dbd8709af0545b0372c28c5f36efba68bca580 - 12/27ただしmergemodule.pmの修正が必要です(後述)。4.2 ブランチの先端は大抵ビルド可能だと思われます。
22LibreOffice Productivity Suite
困っていることなど
23LibreOffice Productivity Suite
その 1
Cygwin が原因のエラーエラーが出たり出なかったり ...ツールのバージョンを下げると改善することがある
ただし 64 ビット版はこの小細工が使えない時も ...dash -c /opt/lo/bin/make の様にすると良いそうです( Mogi さんより)
$ /opt/lo/bin/make …$[build LEX] unoidl/source/sourceprovider-scanner 0 [main] bison 6960 fhandler_disk_file::fixup_mmap_after_fork: requested 0xFFEA0000 != 0x0 mem alloc base 0xFFEA0000, state 0x1000, size 20480, Win32 error 487 238 [main] bison 6960 C:\cygwin\bin\bison.exe: *** fatal error in forked process - recreate_mmaps_after_fork_failed 857 [main] bison 6960 open_stackdumpfile: Dumping stack trace to bison.exe.stackdump 1 [main] bison 1120 fork: child -1 - forked process 6960 died unexpectedly, retry 0, exit code 0x100, errno 11bison: m4 サブプロセスが失敗しました: Resource temporarily unavailableF:/lo4mas/core/solenv/gbuild/LinkTarget.mk:249: recipe for target 'F:/lo4mas/core/workdir/YaccTarget/unoidl/source/sourceprovider-parser.done' failedmake[1]: *** [F:/lo4mas/core/workdir/YaccTarget/unoidl/source/sourceprovider-parser.done] Error 1make[1]: *** Waiting for unfinished jobs....Makefile:219: recipe for target 'build' failedmake: *** [build] Error 2
24LibreOffice Productivity Suite
その 2
ウイルス対策ソフトが反応してビルドに失敗するBitDefender / other security tools breaking the build
https://wiki.documentfoundation.org/Development/Windows_Build_Dependencies※Wikiページの最後の方
対策Cygwin のテンポラリに作られる該当ファイルをウイルス対策ソフトのスキャン対象から除外するautogen.sh のオプションに --disable-cve-tests を指定
25LibreOffice Productivity Suite
その 3
インストーラー作成時のエラー対策mergemodule.pm を 1 行だけ修正confgure.ac か mergemodule.pm の不具合(多分) 可能な方は修正お願いします (私もします )
diff --git a/solenv/bin/modules/installer/windows/mergemodule.pm b/solenv/bin/modules/installer/windows/mergemodule.pmindex 8922f7c..4ba2a88 100644--- a/solenv/bin/modules/installer/windows/mergemodule.pm+++ b/solenv/bin/modules/installer/windows/mergemodule.pm@@ -75,7 +75,7 @@ sub merge_mergemodules_into_msi_database foreach $mergemodule ( @{$mergemodules} ) { my $filename = $mergemodule->{'Name'};- my $mergefile = $ENV{'MSM_PATH'} . $filename;+ my $mergefile = $ENV{'MSM_PATH'} . $installer::globals::separator . $filename; if ( ! -f $mergefile ) { installer::exiter::exit_program("ERROR: msm file not found: $filename ($mergefile)!", "mer my $completesource = $mergefile;
26LibreOffice Productivity Suite
All text and image content in this document is licensed under the Creative Commons Attribution-Share Alike 3.0 License (unless otherwise specified). "LibreOffice" and "The Document Foundation" are registered trademarks. Their respective logos and icons are subject to international copyright laws. The use of these therefore is subject to the trademark policy.
Thank you …
みんなでデバッグしよう!!
27LibreOffice Productivity Suite
参考文献 / Web ページ
Windows Build Dependencies(TDF Wiki)https://wiki.documentfoundation.org/Development/Windows_Build_Dependencies
Tinderbox Status Pagehttp://tinderbox.libreofce.org/MASTER/status.htmlhttp://tinderbox.libreofce.org/libreofce-4-2/status.html
libreofce/core main, development code repositoryhttp://cgit.freedesktop.org/libreofce/core/
Dev-tools misc. useful libreofce development toolshttp://cgit.freedesktop.org/libreofce/contrib/dev-tools/