libreoffice を windows 上でビルドする update2

Post on 25-Jan-2017

91 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

LibreOffice を Windows 上でビルドするUPDATE 2

(” lode” を使ったビルド環境構築)Tomofumi Yagi <yagitmknada[at]gmail.com>

2016-7-9 第 12 回 関西 LibreOffice 勉強会 LT

2

注記● 本資料は、第 12 回 関西 LibreOffice 勉強会の発表

内容に若干の追加修正をおこなったものです。

3

UPDATE?2?

4

以前、発表した内容を再度 UPDATE します● 前回、前々回

5

今日、特に言いたいこと

“lode”を使え、◯ーク。Windowsでも

lode = LibreOffice Development Environment

6

最初に、ビルドとは?● 公開されている LibreOffice のソースコード( = 設

計図)から、実際に動作する LibreOffice (バイナリ)を作る

7

まずはこのページを見てください( TDF Wiki )

8

行き方 1

https://wiki.documentfoundation.org/を開き、”Development”のリンクをクリック

9

行き方 2

https://wiki.documentfoundation.org/Developmentページの Building LibreOffice - Tips and Tricks

”on Windows”のリンクをクリック

10

行き方 4

”Building LibreOffice on Windows with Cygwin and MSVC”ページを下へスクロールすると

11

行き方 5

注意書きがあるので

”LODE”の部分(リンク)をクリックして

12

行き方 6

先ほどのページにたどり着きます ...https://wiki.documentfoundation.org/Development/lode

13

補足● Wiki の内容は更新されるので、最新の内容をチェック

することが重要– このスライドの内容は恐らくすぐ古くなります

– Wiki の構成は見直している最中とのことなので、そのうち分かりやすなると思います ...

14

LibreOfficeをビルドするための環境を構築して

みます

15

必要なリソースなど● 今時の CPU( と OS)● 今時のメモリ● 今時のストレージ

– LibreOffice のソースコード、バイナリ、 lode がインストールするツール等で 15 〜 28GB 程度

● インターネット接続– いろいろダウンロードします

16

インストールが必要な開発ツール等1.Cygwin

– lode を使うためにも必要。 PowerShell スクリプトを 1 つ走らせるだけでCygwin 本体に加え、ビルドに必要なパッケージのインストールが完了します

2.lode– 必要なツール類(専用の make.exe 、 Apache Ant など)の殆んど全てを

lode がインストールしてくれます3.JDK

– 今なら JDK84.Visual Studio

– Visual Studio 2015 か 2013

17

インストールが必要な開発ツール等1.Cygwin

lode を使うためにも必要。 PowerShell スクリプトを 1 つ走らせるだけでCygwin 本体に加え、ビルドに必要なパッケージのインストールが完了します

2.“lode”必要なツール類(専用の make.exe 、 Apache Ant など)の殆んど全てをlode がインストールしてくれます

3.JDK– 今なら JDK8

4.Visual Studio– Visual Studio 2015 か 2013

ビルド環境の構築がとにかく

簡単になりました !

18

Step1:Cygwin のインストール1.コマンドプロンプト(か PowerShell )を管理者として実行2.次のコマンドを実行(実際は 1 行)

Cygwin 環境がインストールされ、ターミナルのウインドウが開くので、コマンドプロンプトは閉じます

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('http://dev-www.libreoffice.org/bin/cygwin/install_cygwin.ps1'))"

19

注意点● 先のコマンドは、セキュリティ設定をバイパスし、管理

者権限でインターネット上のスクリプトを実行します。要注意!

● 不安な場合は、 Wiki の手順どおりにスクリプトを実行してください– https://wiki.documentfoundation.org/Develo

pment/lode#bootstrap_cygwin

20

Step2:lode のインストール● Cygwin のターミナル上で、次のコマンドを実行

lode のリポジトリを clone します

すぐ終わります

$ git clone git://gerrit.libreoffice.org/lode

21

lode のインストール 2● lode のディレクトリに移動し、セットアップを実行

– 必要なツール( make 等)がインストールされLibreOffice のソースコードが clone されます

● 時間が掛かります

$ cd lode

$./setup –-prereq$./setup --dev

22

lode のインストール 3● lode のメッセージにしたがって、環境変数 LODE_HOME を

設定します。例えば…

– Cygwin ターミナルを起動した時に自動的に設定されるよう .bash_profile 等に追記しておきましょう

$export LODE_HOME=/home/$USERNAME/lode

23

Step3:JDK のインストール● LibreOffice のソースコードを clone する待ち時間

を使ってインストールしましょう ( その 1)● オラクルのサイトからダウンロードしてインストール

– http://www.oracle.com/technetwork/java/javase/downloads/index.html

24

補足● 32 ビット版の LibreOffice をビルドしたい時は

Windows x86 をダウンロードしてインストール● 64 ビット版の LibreOffice をビルドしたい時は

Windows x64 をダウンロードしてインストール ● どちらもビルドする人は両方インストール● Wiki のとおりに Chocolatey を使ってインストールし

ても OK– https://wiki.documentfoundation.org/Development/

lode#Preparing_Windows_with_Chocolatey

25

Step4:Visual Studio のインストール● LibreOffice のソースコードを clone する待ち時間

を使ってインストールしましょう ( その 2)● 無料版の Visual Studio Community 2015 でも

ビルドできます● https://www.visualstudio.com/ja-jp/produ

cts/visual-studio-community-vs.aspx– Visual Studio 2015 では「カスタム」インストールが

必要 ( 補足を参照 )

26

補足● 最初に、インストールの種類で「カスタム」を選択し

Visual C++ とユニバーサル Windows アプリ開発ツール (Windows 10 SDK など ) をインストールしましょう– 「規定」だと、これらのツールがインストールされず、ビル

ドできません● Wiki のとおりに Chocolatey を使ってインストールし

ても OK( これも Visual C++ のインストールが必要 )– https://wiki.documentfoundation.org/Developme

nt/lode#Preparing_Windows_with_Chocolatey

27

ビルド環境が構築できたのでLibreOfficeをビルドしてみます

28

Step1:autogen.sh を実行● LibreOffice のソースコードがあるディレクトリで

autogen.sh を実行 ( 実際は 1 行 )

– 多くの場合/home/$USERNAME/lode/dev/coreだと思います

$./autogen.sh –-with-distro=LibreOfficeWin64 --with-jang=ja –-enable-debug –-without-werror --disable-firebird-sdbc

29

補足● 引数のそれぞれの意味は autogen.sh --help してください● オプションの内容は autogen.lastrun に記録されます。エ

ラーが出なくなったら、このファイルを autogen.input にリネームし、以後は autogen.input を使ってオプションを指定します。 autogen.sh はオプション無しで実行します。

● –-disable-firebird-sdbc は Visual Studio 2015 でビルドする場合に必要です (2016年 7月現在 )

30

Step2:make を実行● autogen.sh がエラーを出すことなく終了したら、 make を実

– /bin/make でなく、上記の場所にある専用の make を実行します

$ $LODE_HOME/opt/bin/make

31

補足● /bin/make でなく、 $LODE_HOME/opt/bin にある専用の

make を実行します( autogen.sh のメッセージのとおり)● 初回は、必要とされるファイルのダウンロードがあるので非常に時間が掛かります( LibreOffice が利用する他の OSS のソースコードや翻訳されたメッセージがダウンロードされる)

● ビルド自体も非常に時間が掛かります(数十分〜数時間、あるいはそれ以上)

● Cygwin ターミナルのウインドウを最小化したり、標準出力、標準エラー出力をファイル等にリダイレクトすると、ビルドに掛かる時間が短縮されます(!)

32

ビルドの完了● 次のような形でコマンド入力状態に戻ってくるはず

[build ALL] All modules but instset: UnoControls accessibility animations apple_remote avmedia basctl basegfx basic bean binaryurp bridges canvas chart2 cli_ure codemaker comphelper configmgr connectivity cppcanvas cppu cppuhelper cpputools cui dbaccess desktop dictionaries drawinglayer dtrans editeng embeddedobj embedserv eventattacher extensions external msc-externals accessories apache-commons beanshell boost breakpad clew clucene coinmp collada2gltf cppunit curl expat firebird glew glm glyphy graphite hsqldb hunspell hyphen icu jfreereport jpeg-turbo lcms2 libabw libcdr libcmis libebook libetonyek libexttextcat libfreehand libgltf liblangtag libmspub libmwaw libodfgen liborcus libpagemaker libpng librevenge libvisio libwpd libwpg libwps libxml2 libxmlsec libxslt lpsolve mdds mdnsresponder misc_extensions more_fonts mythes neon nss opencollada openssl poppler postgresql python3 redland rhino ucpp xsltml zlib extras filter forms formula fpicker framework helpcompiler helpcontent2 hwpfilter i18nlangtag i18npool i18nutil idl Idlc io javaunohelper jurt jvmaccess jvmfwk l10ntools librelogo libreofficekit lingucomponent linguistic lotuswordpro nlpsolver o3tl odk offapi officecfg onlineupdate oovbaapi oox opencl package postprocess pyuno readlicense_oo registry remotebridges reportbuilder reportdesign ridljar rsc sal salhelper sax sc scaddins sccomp scp2 scripting sd sdext setup_native sfx2 shell slideshow smoketest solenv soltools sot starmath stoc store svgio svl svtools svx sw swext sysui test testtools toolkit tools tubes ucb ucbhelper udkapi uitest unodevtools unoidl unoil unotest unotools unoxml ure uui vbahelper vcl winaccessibility wizards writerfilter writerperfect xmerge xmlhelp xmloff xmlreader xmlscript xmlsecurity[build PRL] CustomTarget/instsetoo_native/install/install.phony[build CHK] sd[build CHK] libreoffice[build SLC] sw[build SLC] libreoffice[build CUS] instsetoo_native/install[build BIN] instsetoo_native[build MOD] instsetoo_native[build MOD] libreoffice[build BIN] top level modules: libreoffice[build ALL] top level modules: build-non-l10n-only build-l10n-only

real 83m20.393suser 0m0.000ssys 0m0.031s

33

ビルドの途中でエラーが出たら?● エラーメッセージをよく見て対処● メーリングリストや IRC で聞く● 最近の master のビルダビリティは、それなりに高い

はず ( たまに壊れるが修正は早い )

34

ビルドしたLibreOfficeの起動とデバッグ

35

LibreOffice の起動 1( 起動してデバッグ )● Visual Studio を起動する● core/windows/soffice.sln を開く● 「ローカル Windowsデバッガー」ボタンをクリック

– LibreOffice が起動してデバッグ可能な状態になります– ソースコードデバッグが可能(デバッグオプションを付 けてビルドした場合。

Visual Studio 2015 についての注意点は後述)– インストールをしなくてもデバッグできます

● デバッグ方法については Wiki を見てください– “Building LibreOffice on Windows with Cygwin and MSVC”

● https://wiki.documentfoundation.org/Development/BuildingOnWindows

36

LibreOffice の起動 2( 起動するだけ )● instdir/program/soffice.exe を実行

– インストール作業不要で実行できます– インストーラーはこの辺にあります

● workdir/installation/LibreOffice_Dev/msi/install/en- US_ja_qtz 配下

$ instdir/program/soffice.exe

37

その他のトピック

38

なぜ --without-werror なのか?● スライド 27 ページの、ここの部分

● lode を使うと、デフォルトで --with-werror● 日本語環境では、文字コードに関する警告が出てしまうのでコンパイルエラー扱いに !

– Visual Studio がデフォルトでソースコード内の文字コードを CP932( 日本語環境の場合 ) と解釈するため UTF-8 のソースコードに対して警告が出る ... orz

$./autogen.sh –-with-distro=LibreOfficeWin64 --with-jang=ja –-enable-debug -–without-werror --disable-firebird-sdbc

39

なぜ --without-firebird-sdbc なのか?● スライド 27 ページの、ここの部分

● Firebird 2.x は、 Visual Studio 2015 ではビルドできないから● GSoC で学生の方が頑張ってます。そのうち解消するはず

– GSoC Update firebird to 3.0● https://gerrit.libreoffice.org/#/c/25673/

$./autogen.sh –-with-distro=LibreOfficeWin64 --with-jang=ja –-enable-debug -–without-werror --disable-firebird-sdbc

40

Visual Studio でソースコードデバッグできない?

● 恐らく Visual Studio 2015 だけで発生● Visual Studio がデバッグ情報を読み込んでない様子● 7 月 11 日前後の commit で壊れたかも ( 追跡中 )

41

64 ビット版 LibreOffice が起動できない?● これも恐らく Visual Studio 2015 だけで発生● --enable-release-build でビルドして作成したイン

ストーラーを使うと発生● 開発メーリングリストではこの辺のスレッド

– http://nabble.documentfoundation.org/MSVC-14-0-U3-LO-msi-package-put-VC-redist-libraries-in-wrong-directory-td4189802.html

● 急ぐ場合は Visual Studio 2015 に含まれるvcredist_x64.exe を事前に実行しておけば起動可能

42

Visual Studio 2015 への移行● メリット

– Modern C++サポート● C++11/14/17

– /UTF-8オプションの追加 (Update 2 以降 )– UCRTへの移行

● Visual Studio 15 も来るし ...● デメリット

– --enable-werror(文字コード ) の問題– Firebird がビルドできない問題– ソースコードデバッグできない問題– リリースビルドに関する問題( 64 ビット)

● 所感– master で VS2013 のサポートが廃止されるのは時間の問題だと思われる– VS2015 でビルドする人も徐々に出てきている様なので、デメリットについては時間が解決するはず

● 不便に感じたら、自分で直すのも当然あり。パッチを書こう!

43

質疑応答

何かありましたら ...

44

ご清聴ありがとうございました

“lode”を使いましょう

45

参考文献等● lode - LibreOffice Development Environment

– https://wiki.documentfoundation.org/Development/lode● Welcome to The Document Foundation’s wiki

– https://wiki.documentfoundation.org/Main_Page● Building LibreOffice on Windows with Cygwin

and MSVC– https://wiki.documentfoundation.org/Development/BuildingOnWindows

46

参考文献等● GSoC Update firebird to 3.0

– https://gerrit.libreoffice.org/#/c/25673/● MSVC 14.0 U3: LO msi package put VC redist

libraries in wrong directory(Document Foundation Mail Archive)– http://nabble.documentfoundation.org/MSVC-14-0-U3-LO-msi-pack

age-put-VC-redist-libraries-in-wrong-directory-td4189802.html

top related