Environmental description
Operating system: Huawei Euler operating system openEuler 22.03 lts x86_64
Libreoffice version: the latest version 7.6
Compilation and installation process
1. Install compilation tools and dependency packages
sudo yum install -y snappy snappy-devel autoconf automake libtool git gcc gcc-c + + gcc-objc + + make cmake openssl openssl-devel zlib zlib-devel bzip2 bzip2-devel bzip2-libs readline readline-devel bison zip unzip tar tcl java-1.8.0* bison* ncurses* wget libyaml libyaml-devel python-setuptools libcurl-devel gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel libpcap-dev* cups-devel fontconfig pkg-config fontconfig-devel gperf libxslt libxslt-devel gtk2 gtk2-devel libICE libICE-devel libSM libSM-devel gtk3 gtk3-devel dbus-glib dbus-glib-devel gstreamer* perl* nss-devel nspr-devel libatomic_ops libatomic_ops-devel fakeroot rpm-build flex</ pre> <blockquote></blockquote> <p>2. Get the source code</p> <pre>wget -c http://download.documentfoundation.org/libreoffice/src/7.6.2/libreoffice-7.6.2.1.tar.xz wget -c http://download.documentfoundation.org/libreoffice/src/7.6.2/libreoffice-translations-7.6.2.1.tar.xz
3. Unzip the source code
tar xf libreoffice-7.6.2.1.tar.xz tar xf libreoffice-translations-7.6.2.1.tar.xz
4. Create the input file autogen.input
# Switch directory cd libreoffice-7.6.2.1 # Create a file vim autogen.input
# Specify the installation path. If not specified, it will be installed under the /usr/local/lib/libreoffice/ path by default: --prefix=/opt/libreoffice-7.6 # Generally, help documents are browsed directly online, so help is disabled: --without-help --without-helppack-integration # Enable simplified and traditional Chinese user interface: --with-lang=zh-CN zh-TW # Disable online updates and crash reporting functions: --disable-online-update --disable-breakpad # Disable Office Development Kit. If ODK is enabled, the doxygen dependency is additionally required: --disable-odk --without-doxygen # If you need rpm (or deb) package after compilation, you need to enable the following two items: --enable-epm --with-package-format=rpm # If you need to share the external_tarballs third-party source code package between compilations of multiple different versions or the system cannot be connected to the Internet, you can set the following options (according to the actual path setting): # --with-external-tar=<external_tarballs folder path> --with-external-tar=/home/libreoffice-external-tar # Now many functions are no longer used in java and can be disabled: --without-java # If you need to use the firebird database, enable the following three items: --enable-firebird-sdbc --without-system-firebird --enable-python=internal
5. Modify the makefile.in file to use the root account compilation permissions
vim makefile.in
1) Delete the “check-of-root” string in the line starting with “.PHONY:” (the strings corresponding to different versions are not exactly the same, just delete the “check-of-root” string and leave the others unchanged)
2) Delete the “check-of-root” string in the line starting with “bootstrap:”
6. Compile
make
The compilation process will download dependency packages based on the contents of the download.lst file and save them to the /home/libreoffice-external-tar directory.
This step takes a long time, so wait patiently for completion. If there is an error, please handle it according to the error content.
7. Installation
make install
8. Check and verify
# View file directory ls /opt/libreoffice-7.6/lib/libreoffice/ ls /opt/libreoffice-7.6/lib/libreoffice/program/ # View version and help information /opt/libreoffice-7.6/lib/libreoffice/program/soffice --version /opt/libreoffice-7.6/lib/libreoffice/program/soffice -h # View the binary file of the compiled sdk ls instdir/sdk/ ls instdir/sdk/bin/ ls instdir/sdk/lib/ # View the compiled rpm package ls workdir/installation/LibreOfficeDev/rpm/install/LibreOfficeDev_7.6.2.1_Linux_x86_64_rpm/RPMS/ ls workdir/installation/LibreOfficeDev_languagepack/rpm/install/LibreOfficeDev_7.6.2.1_Linux_x86_64_rpm_langpack_zh-CN/RPMS/
9. rpm package installed in other environments
rpm -ivh *.rpm --nodeps # Dependencies may be missing, you can install the corresponding dependency package according to the error message
10. Start service test verification
# Start service soffice --headless --accept="socket,host=0.0.0.0,port=8100;urp;" --nofirststartwizard # Test conversion # Convert word to pdf soffice --invisible --convert-to pdf xxx.docx; # Convert word to epub soffice --invisible --convert-to epub xxx.docx; # Convert word to html soffice --invisible --convert-to "html:XHTML Writer File:UTF8" xxx.docx; # Convert word to txt soffice --invisible --convert-to "txt:Text (encoded):UTF8" xxx.docx; #Convert html to pdf soffice --headless --convert-to pdf xxx.html --outdir /home/xxx.pdf
Reference for problems with Chinese fonts: Centos installation of Chinese fonts_centos installation of Chinese fonts_Sky Birds Visible Blog-CSDN Blog
Compilation under the x86 architecture is relatively smooth, and errors are rarely reported. The following errors may occur when compiling and installing in the arm environment:
FAQ
1. Missing error in messages.po file when executing make compilation.
[Detailed description]: When executing make compilation, the messages.po file is missing. The specific error is as follows:
missing /home/libreoffice-7.6.2.1/translstions/source/zh-CN/oox/messages.po
missing /home/libreoffice-7.6.2.1/translstions/source/zh-CN/oox/messages.po
make[1]: *** No rule to make target ‘/home/libreoffice-7.6.2.1/translstions/source/zh-CN/readlicense_oo/docs.po’, needed by ‘/home/libreoffice-7.6.2.1/ workdir/CustomTarget/readlicense_oo/readme/readme.xrm’. Stop.
Solution:
This step is due to the lack of packages. Download the source code package of translstions and the source code of libreoffice in the same path and unzip it.
2. When executing make compile time, /_sysconfigdata__linux_aarch64-unknown-linux-gnu.py does not exist in the tarball error
[Detailed description]: When executing make compilation, the error /_sysconfigdata__linux_aarch64-unknown-linux-gnu.py does not exist in the tarball is reported. The specific error is as follows:
/home/libreoffice-7.6.2.1/external/python3/ExternalPackage_python3.mk:48: *** file /home/libreoffice-7.6.2.1/workdir/UnpackedTarball/python3/LO_lib/_sysconfigdata__linux_aarch64-unknown-linux-gnu.py does not exist in the tarball. Stop.
make[1]: *** Waiting for unfinished jobs….
make: *** [makefile:282: build] Error 2
Solution:
1) Execute find . -name “*sysconfigdata*” to find sysconfigdata related files
find . -name "*sysconfigdata*"./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/__pycache__/_sysconfigdata__linux_aarch64-linux-gnu.cpython-38.pyc
./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/_sysconfigdata__linux_aarch64-linux-gnu.py
2) Copy _sysconfigdata__linux_aarch64-linux-gnu.py to _sysconfigdata__linux_aarch64-unknown-linux-gnu.py (the required file is _sysconfigdata__linux_aarch64-unknown-linux-gnu.py, the actual file _sysconfigdata__linux_aarch64-linux-gnu.py, that is The -unknown field is missing between aarch64 and linux, which is related to the configure.guess judgment logic)
cp ./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/_sysconfigdata__linux_aarch64-linux-gnu.py ./workdir/UnpackedTarball/python3/build/lib.linux-aarch64-3.8/_sysconfigdata__linux_aarch64-unknown -linux-gnu.py
Criticisms and corrections from all the big guys are welcome! ! !
References:
- LibreOffice · GitHub
- https://documentation.libreoffice.org/zh-cn/cn/
- https://www.libreoffice.org/
- http://download.documentfoundation.org/libreoffice/
- https://downloadarchive.documentfoundation.org/libreoffice/old/
- https://www.libreofficechina.org/how-to-build-libreoffice-zh-cn/
- Libreoffice 7.2.2 compilation and installation_51CTO blog_libreoffice installation tutorial
- Huawei Cloud Forum_Cloud Computing Forum_Developer Forum_Technical Forum-Huawei Cloud