X11依赖项,编译没有X11的DBU,只启动Shell C++;Raspbian Linux的应用程序

X11依赖项,编译没有X11的DBU,只启动Shell C++;Raspbian Linux的应用程序,linux,shell,x11,dbus,raspbian,Linux,Shell,X11,Dbus,Raspbian,你好,亲爱的SO社区:) 我想让DBus做我的树莓圆周率。 当我在Pi桌面环境->(startx)中时,libdbus-c++-1中的示例代码运行良好 我在互联网上的研究和在stackoverflow上找到的例子对我没有帮助:[ 但是,当我处于Shell模式时,会收到错误消息 ./client terminate called after throwing an instance of 'DBus::Error' what(): /usr/bin/dbus-launch terminate

你好,亲爱的SO社区:)

我想让DBus做我的树莓圆周率。 当我在Pi桌面环境->(startx)中时,libdbus-c++-1中的示例代码运行良好

我在互联网上的研究和在stackoverflow上找到的例子对我没有帮助:[

但是,当我处于Shell模式时,会收到错误消息

./client
terminate called after throwing an instance of 'DBus::Error'
  what():  /usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.
Aborted
我也试过了

eval 'dbus-launch --auto-syntax' ./client

eval 'dbus-launch --auto-syntax' ./server
但它不起作用,服务器应用程序正在启动一个消息守护程序,但无法从客户端访问该守护程序。而且该守护程序保持活动状态

我得到:

terminate called after throwing an instance of 'DBus::Error'
  what():  The name org.freedesktop.DBus.Examples.Echo was not provided by any .service files
call1: Aborted
此外,它不显示在服务列表中

在这之后,我尝试了另一个命令

DISPLAY=":0" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/dbus/system_bus_socket" ./server
我得到:

terminate called after throwing an instance of 'DBus::Error'
  what():  Connection ":1.10" is not allowed to own the service "org.freedesktop.DBus.Examples.Echo" due to security policies in the configuration file
Aborted
:(在那之后也不起作用了,我找到了一种不用X11代码编译DBU的方法 与

不幸的是,它没有效果。仍然需要X11来启动我的应用程序。。。 我错了什么

但是命令像

eval 'dbus-launch --auto-syntax' dbus-monitor
我如何在不启动X11的情况下启动我的应用程序我不需要它,也不想要它。 谢谢你的帮助和时间

亲切问候 噢

# 更新 我现在觉得有点傻,但我找到了一种不用x11运行它的方法

首先,您需要启动一个dbus会话守护进程

dbus-launch
这将提示您的DBUS会话总线地址

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9rMVHdByuH,guid=10592ff7107f13dd241a02af531ab357
DBUS_SESSION_BUS_PID=2465

之后,您可以启动C++应用程序,如

DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-9rMVHdByuH,guid=10592ff7107f13dd241a02af531ab357" ./server
您可以使用注册服务

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-6aT4DZgmA1,guid=b1231a014a7b10e74e04f8ba531abdf9 dbus-send --session --dest=org.freedesktop.DBus   --type=method_call --print-reply                 /org/freedesktop/DBus org.freedesktop.DBus.ListNames
以及使用

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-6aT4DZgmA1,guid=b1231a014a7b10e74e04f8ba531abdf9 dbus-monitor

但还有一个问题,我怎么能自动完成呢?

很好的帖子。你显然比我更勤奋;我最终运行了一个显示缓冲区

但还有一个问题,我怎样才能自动完成呢

$dbus-launch 
将总线信息输出到标准输出,您是否尝试在之后运行该程序?例如

$dbus-launch ./server
dbus启动手册页显示:

您可以指定要运行的程序;在这种情况下,dbus启动将 启动会话总线实例,设置适当的环境 变量,以便指定的程序可以找到总线,然后 使用指定的参数执行指定的程序。请参阅 下面是一些例子

如果启动程序,dbus launch将不会打印信息 关于新总线到标准输出

但还有一个问题,我怎样才能自动完成呢

看看:

backticks或$()构造可用于从中读取信息 dbus启动


抱歉发了这么长的帖子:)你好,多根,我在你的页面上结束了,因为我在raspberry pi上遇到了类似的问题。在raspberry pi上找不到dbus launch命令,我有一个没有X服务器的无头pi安装。如何获取dbus launch包??
$dbus-launch ./server