感觉离成功只差一步了(也是最艰难的一步)。
安装依赖
# https://wiki.documentfoundation.org/Development/BuildingOnLinux
sudo apt-get install git build-essential zip ccache junit4 libkrb5-dev nasm graphviz python3 python3-dev qtbase5-dev libkf5coreaddons-dev libkf5i18n-dev libkf5config-dev libkf5windowsystem-dev libkf5kio-dev autoconf libcups2-dev libfontconfig1-dev gperf default-jdk doxygen libxslt1-dev xsltproc libxml2-utils libxrandr-dev libx11-dev bison flex libgtk-3-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev ant ant-optional
下载源码
wget http://mirrors.tuna.tsinghua.edu.cn/libreoffice/libreoffice/src/7.3.2/libreoffice-7.3.2.1.tar.xz
xz -dcT0 libreoffice-7.3.2.1.tar.xz | tar -x
cd libreoffice-7.3.2.1
在configure脚本中添加loongarch64的支持
vim configure
,找到这一段:
mips64el)
CPUNAME=GODSON64
RTL_ARCH=MIPS64_EL
EPM_FLAGS="-a mips64el"
PLATFORMID=linux_mips64_el
;;
在后面加上一段
loongarch64)
CPUNAME=GODSON64
RTL_ARCH=LOONGARCH64_EL
EPM_FLAGS="-a loongarch64el"
PLATFORMID=linux_loongarch64_el
;;
注意这里的CPUNAME写成GODSON64其实并不好,这里暂时先写成这样。
继续搜索mips64el
,然后在后面也加上loongarch64
:
# This is only used in Qt5/Qt6/KF5 checks to determine if /usr/lib64
# paths should be added to library search path. So lets put all 64-bit
# platforms there.
supports_multilib=
case "$host_cpu" in
x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64)
if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
supports_multilib="yes"
fi
;;
*)
;;
esac
开始编译
sudo apt install libgpgmepp-dev libgpgme-dev firebird-dev
./configure -with-system-nss --with-system-gpgmepp --with-system-firebird --disable-pdfium
make -j$(nproc)
如果不--disable-pdfium
,会报这个错:
/home/searchstar/SetupFiles/libreoffice-7.3.2.1/workdir/UnpackedTarball/pdfium/build/build_config.h:122:2: error: #error Please add support for your architecture in build/build_config.h
#error Please add support for your architecture in build/build_config.h
^~~~~
当然也可以把workdir/UnpackedTarball/pdfium/build/build_config.h
的122行改成#define ARCH_CPU_64_BITS 1
。
编译失败
很遗憾,在成功编译了一堆依赖之后,最终还是编译失败了:
/home/searchstar/SetupFiles/libreoffice-7.3.2.1/bridges/source/cpp_uno/gcc3_linux_mips64/cpp2uno.cxx:47:10: fatal error: sys/sysmips.h: 没有那个文件或目录
#include <sys/sysmips.h>
^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [/home/searchstar/SetupFiles/libreoffice-7.3.2.1/solenv/gbuild/LinkTarget.mk:333:/home/searchstar/SetupFiles/libreoffice-7.3.2.1/workdir/CxxObject/bridges/source/cpp_uno/gcc3_linux_mips64/cpp2uno.o] 错误 1
失败的地方是cpp_uno
,相关资料:
https://en.wikipedia.org/wiki/Universal_Network_Objects
https://help.libreoffice.org/latest/tg/text/sbasic/shared/uno_objects.html
大概看了一下源码,主要是一些跟体系结构有关的汇编需要修改。但是这已经超过我的能力范围了,希望有对LoongArch汇编比较熟的人在cpp_uno
里添加loongarch64
的支持。