Shinji Enoki's blog

LibreOfficeの話題を中心にする予定です

LibreOffice OnlineをDebian jessieでビルドしてみました。

LibreOffice Online(LOOL)がバージョンアップして良くなってきています。オープンソースカンファレンス2017 Tokyo/Fallのブースでデモをしようと思って、手元のDebian jessieでビルドしてみましたので、メモを残しておきます。

去年8月にも同様の記事(LibreOffice onlineをDebianでビルドしてみました)を書いていますが、手順が一部変わっています。

また、LibreOffice Online導入手順 2017年4月版 - LibrePC from iCRAFTCentOS版ですが、基本的にDebianと手順は同じでした。

以下のwsdのREADMEに沿って進め、必要に応じてloleafletのREADMEも参照します。

LibreOfficeのビルド

LibreOfficeソースコードを取得

$ git clone --depth=1 git://anongit.freedesktop.org/libreoffice/core libreoffice

ビルドに必要なパッケージをインストール(前回やっていたので不要)

$ sudo aptitude update
$ sudo aptitude safe-upgrade 
$ sudo aptitude build-dep libreoffice

ビルド

通常手元のレッツノートCF-N10(メモリ12GB,SSDに換装)だと4時間台で終わるのですが、途中他の作業していましたので6時間半くらいかかりました。

$ cd libreoffice
$ ./autogen.sh --with-lang="ja"
* WARNING : no suitable nasm (Netwide Assembler) found for internal jpeg-turbo
$ make

pocoのインストール

/opt/poco以下にmakeしてインストールしてもよいのですが、その場合はwsdの./configureで指定する必要があります。 今回はそのことを忘れていてエラーになったので、パッケージを入れました。

$ sudo vi /etc/apt/sources.list で以下を追記
 deb https://www.collaboraoffice.com/apt-poco/ /
$ sudo aptitude update
$ sudo aptitude install libpoco-dev

LOOLのビルドと設定

作業ユーザのhomeにgit cloneしてきた場合で指定しています

$ git clone git://anongit.freedesktop.org/libreoffice/online
$ cd online/
$ libtoolize
$ aclocal
$ automake --add-missing
$ autoreconf
$ autoheader
$  ./configure --enable-silent-rules --with-lokit-path=/home/ユーザ名/libreoffice/include --with-lo-path=/home/ユーザ名/libreoffice/instdir --enable-debug
$ sudo mkdir /etc/loolwsd
$ sudo cp etc/* /etc/loolwsd
sudo mkdir -p /usr/local/var/cache/loolwsd
↑今回はすでにあったのを削除して再作成しました
$ sudo chown eno. /usr/local/var/cache/loolwsd
↑作業ユーザ名. に読み替え
$ make run

npm installなどが走るのですが、途中でエラーになりました。

touch node_modules
Traceback (most recent call last):
  File "util/po2json.py", line 9, in 
    import polib
ImportError: No module named polib
Makefile:481: recipe for target 'dist/l10n/help-en_AU.json' failed
make[2]: *** [dist/l10n/help-en_AU.json] Error 1
make[2]: Leaving directory '/home/eno/2_code/LibreOffice_code/online/loleaflet'
Makefile:1720: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/eno/2_code/LibreOffice_code/online'
Makefile:732: recipe for target 'all' failed
make: *** [all] Error 2

python-polibパッケージをインストールしてみるといけました。

$ sudo aptitude install python-polib
$ make run

これでできました。起動したメッセージにしたがってブラウザでアクセスします。/opt/tmp/test.odsにファイルを置いていたので、以下のようにアクセスしました。LOOLの起動も1回目は意外に時間がかかりますが、2回目からは早くなります。

https://localhost:9980/loleaflet/dist/loleaflet.html?file_path=file:///opt/tmp/test.ods&host=wss://localhost:9980

補足

前回の時にLOOLのビルドで必要だった"libtool","libcap-dev", "nodejs", "npm"がインストールが必要かもしれません(今回はインストールされているのでわかりません。)

$ sudo aptitude install libtool libcap-dev nodejs node-jake node-uglify npm
$ sudo npm install -g npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

また、LibreOfficeのビルドですが、git pullしてmakeするとエラーになったので、上記手順のようにソースを取得しなしました。

$ git pull
$ ./autogen.sh --with-lang="ja"
* WARNING : no suitable nasm (Netwide Assembler) found for internal jpeg-turbo
$ make
[build LNK] StaticLibrary/libcodemaker_cpp.a
/home/eno/2_code/LibreOffice_code/libreoffice/workdir/CxxObject/store/source/store.o: 関数 `store_openDirectory' 内:
store.cxx:(.text+0x814): `store::OStoreDirectory_Impl::create(store::OStorePageManager*, _rtl_String*, _rtl_String*, storeAccessMode)' に対する定義されていない参照です
/home/eno/2_code/LibreOffice_code/libreoffice/workdir/CxxObject/store/source/store.o: 関数 `store_openStream' 内:
store.cxx:(.text+0xd34): `store::OStoreLockBytes::create(store::OStorePageManager*, _rtl_String*, _rtl_String*, storeAccessMode)' に対する定義されていない参照です
collect2: error: ld returned 1 exit status
/home/eno/2_code/LibreOffice_code/libreoffice/store/Library_store.mk:10: recipe for target '/home/eno/2_code/LibreOffice_code/libreoffice/instdir/program/libstorelo.so' failed
make[1]: *** [/home/eno/2_code/LibreOffice_code/libreoffice/instdir/program/libstorelo.so] Error 1
make[1]: *** 未完了のジョブを待っています....
Makefile:266: recipe for target 'build' failed
make: *** [build] Error 2
$ make clean
$ ./autogen.sh --with-lang="ja"
$ make
でも再度エラーになりました。