ARM架构下麒麟v10操作系统源码编译libreoffice

环境信息

架构:ARM
操作系统:麒麟v10-20210524版本
libreoffice版本:7.1.8.1
源码下载链接:https://download.documentfoundation.org/libreoffice/src/7.1.8/libreoffice-7.1.8.1.tar.xz?idx=1

安装依赖

yum install -y "@Standard" "@Development Tools"
# 如果已经安装可以不安装standard和Development Tools
yum install -y automake autoconf cups-devel fontconfig-devel \
gperf libxslt-devel python3-devel libXext-devel libICE-devel \
libSM-devel libXrender-devel xorg-x11-xauth x11* libX11 \
libXrandr-devel cairo-devel  gtk3-devel gstreamer-devel \
gstreamer-plugins-base gstreamer1-*  gstreamer* \
glibc-headers  gcc-c++ fakeroot 

预编译

将源码包上传到/root目录下

tar xf /root/libreoffice-7.1.8.1.tar.xz -C /opt
cd /opt/libreoffice-7.1.8.1
./autogen.sh --without-java --without-junit \
--with-lang=zh-CN --disable-postgresql-sdbc \
--without-doxygen --with-package-format=rpm --enable-epm \
--srcdir=/opt/libreoffice-7.1.8.1 --enable-option-checking=fatal

预编译选项解释:

  1. –without-java: 表示不用java
  2. –with-lang=zh-CN:启用简体及繁体中文用户界面
  3. –disable-postgresql-sdbc:由于我不用pg数据库,所以在这里禁用掉
  4. –with-package-format=rpm --enable-epm:将编译结果打包成rpm包,打包完成后在./workdir/installation/ 目录下

预编译结果

To build, run:
/usr/bin/make
To view some help, run:
/usr/bin/make/help
After the build has finished successfully, you can immediately run
what you built using the command: instdir/program/soffice
If you want to run the smoketest, run: /usr/bin/make check
HOST config (config.warn)

开始编译

由于libreoffice不允许直接用root用户来编译,所以先创建一个普通用户用于编译

useradd libreoffice
cd /opt && chown -R libreoffice:libreoffice libreoffice-7.1.8.1 
su libreoffice && cd /opt/libreoffice-7.1.8.1 
make -j 16  
# -j 16表示用16个cpu来跑编译,如果不指定默认使用全部cpu来跑

注意:服务器要通互联网,因为编译过程中程序会下载依赖包,由于依赖包网址在国外,所以会慢一点,耐心等待啦。另外依赖包下载完了之后编译也需要一定的时间,大概一个小时左右。

验证

编译结果忘记截图了,可以用获取版本的方式来验证是否编译成功

./instdir/program/soffice --version

在这里插入图片描述
将一个pptx文件转换为pdf格式

/opt/libreoffice-7.1.8/instdir/program/soffice --headless --invisible --convert-to pdf:writer_pdf_Export ./aa.pptx

在这里插入图片描述

最后

到以上步骤已经编译完成啦,有问题欢迎评论或者私聊我,每天进步一点点。

参考资料

https://wiki.documentfoundation.org/Development/BuildingOnLinux/zh-cn
https://www.libreofficechina.org/how-to-build-libreoffice-zh-cn/

Logo

开源操作系统年度技术会议(简称OS2ATC)已经连续举办了九届,在促进我国操作系统相关教学、研究与产业的发展,加强学术交流,展示产业界成果,展开跨学科的交流等方面已经卓有成效。

更多推荐