yetist
前一阵子看了下Loong Arch Linux里的openmotif,发现在这个网址已经有PKGBUILD文件了:
https://github.com/loongarchlinux/extra/tree/main/openmotif
但用pacman安装无openmotif package。试了一下编译,发现会有一个"undefined reference to 'main'"错误过不去。网上搜了一下,按这里的提示:
https://motif.ics.com/forum/compilation-error-no-main-wmluiltokc
https://www.linuxquestions.org/questions/linux-enterprise-47/error-when-compling-motif-4175669180/
在motif-2.3.8/tools/wml/wmluiltok.l文件头加%option main即可解决。我修正了PKGBUILD文件,添加了一个新patch,编译没问题了,不知是否能把这个patch加进去?
新加的wmluiltok.l_no_main.patch 内容:
--- motif-2.3.8/tools/wml/wmluiltok.l.orig 2017-03-28 06:24:31.000000000 +0800
+++ motif-2.3.8/tools/wml/wmluiltok.l 2024-01-30 15:47:33.660572782 +0800
@@ -1,3 +1,5 @@
+%option main
+
%{
/*
* Motif
PKGBUILD文件里的相关部分:
prepare() {
cd motif-$pkgver
patch -p1 -i ../no-demos.patch # Don't build demos
# fix compilation error: "undefined reference to 'main'", see discussions at:
# https://motif.ics.com/forum/compilation-error-no-main-wmluiltokc
# https://www.linuxquestions.org/questions/linux-enterprise-47/error-when-compling-motif-4175669180/
patch -p1 -b -i ../wmluiltok.l_no_main.patch
touch NEWS AUTHORS
autoreconf -if
}
另外,作为可选项,还可以加入另一个patch支持loongarch64架构(但编译时不加似乎也没问题):
config.sub_loong.patch,内容:
--- motif-2.3.8/config.sub.orig 2016-11-10 15:37:09.000000000 +0800
+++ motif-2.3.8/config.sub 2024-01-30 15:52:14.598315725 +0800
@@ -246,7 +246,7 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- 1750a | 580 \
+ 1750a | 580 | loongarch64 \
| a29k \\
| aarch64 | aarch64_be \\
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \\
@@ -368,7 +368,7 @@ case $basic_machine in
exit 1
;;
# Recognize the basic CPU types with company name.
- 580-* \
+ 580-* | loongarch64-* \
| a29k-\* \\
| aarch64-\* | aarch64_be-\* \\
| alpha-\* | alphaev[4-8]-\* | alphaev56-\* | alphaev6[78]-\* \\
@@ -782,6 +782,9 @@ case $basic_machine in
leon-\*|leon[3-9]-\*)
basic_machine=sparc-\`echo $basic_machine | sed 's/-.\*//'\`
;;
+ loong64)
+ basic_machine=loongarch64-unknown
+ ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux