title: X11 Dependency, Compile Dbus without X11, starting only Shell C++ Applications Raspbian Linux
body: <p>Hello Dear SO Community :)</p>
  
  <p>I am trying to get  DBus working on my Raspberry Pi.
  The example code from libdbus-c++-1 is working fine when i am in the Pi Desktop environment -> (startx)</p>
  
  <p>My researches on the internet and the examples i found on stackoverflow didnt help me :[.</p>
  
  <p>However, when i am in the Shell-Mode i get the error message</p>
  
  <pre><code>./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
  </code></pre>
  
  <p>i also tried  </p>
  
  <pre><code>eval 'dbus-launch --auto-syntax' ./client
  
  eval 'dbus-launch --auto-syntax' ./server
  </code></pre>
  
  <p>but it does not work, the server app is starting a message daemon but it is not reachable from the client. Also the daemon stays active.</p>
  
  <p>i got:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>also it does not shown in the services list.</p>
  
  <p>after this i tried another command </p>
  
  <pre><code>DISPLAY=":0" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/dbus/system_bus_socket" ./server
  </code></pre>
  
  <p>and i got:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>:( after that is also not working i found a way to compile the dbus without the X11 Code
  with </p>
  
  <pre><code>./configure --with-x=no
  </code></pre>
  
  <p>unfortunately it has no effect. Still require X11 to start my applications...
  What do i wrong?</p>
  
  <p>but commands like</p>
  
  <pre><code>eval 'dbus-launch --auto-syntax' dbus-monitor
  </code></pre>
  
  <p>How can i start my applications without starting X11 i dont need it and i dont want it.
  Thank you for your help and time.</p>
  
  <p>kindly regards
  oOm</p>
  
  #
  
  <p>Update
  i feel a bit silly now  but i found a way to run it without the x11</p>
  
  <p>first you need to start a dbus session daemon</p>
  
  <pre><code>dbus-launch
  </code></pre>
  
  <p>this will prompt you your DBUS_SESSION_BUS_ADRESS</p>
  
  <pre><code>DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9rMVHdByuH,guid=10592ff7107f13dd241a02af531ab357
  DBUS_SESSION_BUS_PID=2465
  </code></pre>
  
  <p>after that you can launch your c++ application like this</p>
  
  <pre><code>DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-9rMVHdByuH,guid=10592ff7107f13dd241a02af531ab357" ./server
  </code></pre>
  
  <p>you can registered services with</p>
  
  <pre><code>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
  </code></pre>
  
  <p>and monitoring the messages with</p>
  
  <pre><code>DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-6aT4DZgmA1,guid=b1231a014a7b10e74e04f8ba531abdf9 dbus-monitor
  </code></pre>
  
  <p>but one question is left, how can i do it automatically?</p>