build - 使用 "--disable-dbus"选项时,Debian 软件包构建明显失败

标签 build debian

我正在尝试构建 Debian 软件包 evince ,在 Debian Buster 上,使用 Debian 构建过程:

apt-get source evince

然后

cd evince-3.30.2/
dpkg-buildpackage --build=binary --no-sign

当我使用dbus构建包时,构建过程成功(默认设置)。

当我更改配置并添加 --disable-dbus 时,构建过程失败并出现以下错误:

ev-application.c: In function ‘ev_application_new’:
ev-application.c:106:42: error: ‘APPLICATION_NAME’ undeclared (first use in this function); did you mean ‘G_APPLICATION_CLASS’?
                    "application-id", APPLICATION_NAME,
                                      ^~~~~~~~~~~~~~~~
                                      G_APPLICATION_CLASS
ev-application.c:106:42: note: each undeclared identifier is reported only once for each function it appears in
ev-application.c:109:1: error: control reaches end of non-void function [-Werror=return-type]
 }
^

以下是 debian/rules 的片段有效的文件:

override_dh_auto_configure:
  dh_auto_configure -- \
    --libexecdir=/usr/lib/evince \
    --enable-djvu \
    --enable-dvi \
    --enable-ps \
    --enable-introspection \
    --enable-gtk-doc \
    --disable-libgnome-desktop \
    --disable-multimedia \
    --disable-nautilus \
    --disable-browser-plugin \
    --without-keyring

这是没有的(唯一的更改是添加 --disable-dbus ):

override_dh_auto_configure:
  dh_auto_configure -- \
    --libexecdir=/usr/lib/evince \
    --enable-djvu \
    --enable-dvi \
    --enable-ps \
    --enable-introspection \
    --enable-gtk-doc \
    --disable-dbus \
    --disable-libgnome-desktop \
    --disable-multimedia \
    --disable-nautilus \
    --disable-browser-plugin \
    --without-keyring

该错误是什么意思,如何修复它?

更新 2021-09-01

我已经修复了APPLICATION_NAME正如@cody 所建议的。

我还在 debian/evince.install 中删除了对 dbus 的一行引用

但是使用 --disable-dbus 进行构建现在以另一个错误结束:

/usr/bin/ld: .libs/evince-scan.o: in function `get_object_types':
./help/reference/shell/evince-scan.c:43: undefined reference to `ev_media_player_keys_get_type'
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:867: scan-build.stamp] Error 1
make[4]: *** [Makefile:506: all-recursive] Error 1
make[3]: *** [Makefile:591: all-recursive] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:730: all-recursive] Error 1
make[1]: *** [Makefile:595: all] Error 2
dh_auto_build: make -j4 returned exit code 2
make: *** [debian/rules:11: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

最佳答案

看起来这是该版本的 evince 源代码中的一个错误。如果你看most recent version of ev-application.c ,您会注意到 APPLICATION_NAME 是在相邻的 #ifdef ENABLE_DBUS 之外定义的:

#define APPLICATION_NAME             "org.gnome.Evince"
#ifdef ENABLE_DBUS
#define APPLICATION_DBUS_OBJECT_PATH "/org/gnome/evince/Evince"
#define APPLICATION_DBUS_INTERFACE   "org.gnome.evince.Application"
...
#endif

但是如果你看看 the version in Debian Buster ,您会注意到它是在 #ifdef:

内部定义的
#ifdef ENABLE_DBUS
#define APPLICATION_NAME             "org.gnome.Evince"
#define APPLICATION_DBUS_OBJECT_PATH "/org/gnome/evince/Evince"
#define APPLICATION_DBUS_INTERFACE   "org.gnome.evince.Application"
...
#endif

所以在Debian版本中,如果dbus被禁用,APPLICATION_NAME将不会被定义。我相信您需要做的就是更改 ev-application.c 将 APPLICATION_NAME 的定义移到 #ifdef ENABLE_DBUS 之外,并且它应该可以编译。

这似乎是fixed也在 Debian 存储库中。

关于build - 使用 "--disable-dbus"选项时,Debian 软件包构建明显失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63533967/

相关文章:

git - 应该使用 Git 来存储持续集成构建吗?

xcode - 无法在 iPhone 3G 中安装使用 Xcode 4.2 构建的应用程序

c++ - 使用 Catch 库无法解析的外部符号

linux - 针对正在运行的内核构建外部模块

java - Maven 构建错误 - 无法执行目标 org.apache.maven.plugins :maven-assembly-plugin:2. 5.5

linux - 通过 NPM 在 Debian Lenny (5.0) 中安装 Forever - 错误

linux - 在 debian 中更新包

Debian apt-get upgrade 如何只安装安全更新?

c++ - 使用 fstream 向所有用户发送消息

android - 通过局域网将 Android Studio 连接到设备