arch linux 下emacs 编译telega-server 出错

arch linux 下emacs 编译telega-server 出错

环境

telegram-tdlib-git-1.8.14-1

1
yay -S telegram-tdlib-git

emacs 下的telega-server

cc 版本

cc (GCC) 12.2.1 20230201

执行telega 的时候会自动编译 telega-server

编译命令为

1
cc -I/usr//include -Wall -g -pthread -DWITH_APPINDICATOR -DWITH_AYATANA_APPINDICATOR `pkg-config --cflags ayatana-appindicator3-0.1` -o telega-server telega-server.c telega-dat.c telega-pngext.c telega-appindicator.c -L/usr//lib -Wl,-rpath,/usr//lib -ltdjson `pkg-config --libs ayatana-appindicator3-0.1`

报错如下

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
In file included from /usr/lib/glib-2.0/include/glibconfig.h:9,
from /usr/include/glib-2.0/glib/gtypes.h:34,
from /usr/include/glib-2.0/glib/galloca.h:34,
from /usr/include/glib-2.0/glib.h:32,
from /usr/include/gtk-3.0/gdk/gdkconfig.h:8,
from /usr/include/gtk-3.0/gdk/gdk.h:30,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from /usr/include/libayatana-appindicator3-0.1/libayatana-appindicator/app-indicator.h:33,
from telega-appindicator.c:38:
telega-appindicator.c: In function ‘appindicator_setup’:
telega-appindicator.c:63:26: warning: implicit declaration of function ‘IS_APP_INDICATOR’; did you mean ‘APP_INDICATOR’? [-Wimplicit-function-declaration]
63 |                 g_assert(IS_APP_INDICATOR(appind));
|                          ^~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1249:25: note: in definition of macro ‘G_LIKELY’
1249 | #define G_LIKELY(expr) (expr)
|                         ^~~~
telega-appindicator.c:63:17: note: in expansion of macro ‘g_assert’
63 |                 g_assert(IS_APP_INDICATOR(appind));
|                 ^~~~~~~~
/usr/bin/ld: /tmp/ccRjTkEb.o: in function `appindicator_setup':
/home/wcq/.config/emacs/.local/straight/repos/telega.el/server/telega-appindicator.c:63: undefined reference to `IS_APP_INDICATOR'
collect2: error: ld returned 1 exit status

解决办法

telega-appindicator.c:63 第63 行的 IS_APP_INDICATOR 改成 APP_INDICATOR

Licensed under CC BY-NC-SA 4.0