<div dir="ltr">I joined the other mailing list (for new people: the discussion started here <a href="http://lists.freedesktop.org/archives/dbus/2008-August/010287.html">http://lists.freedesktop.org/archives/dbus/2008-August/010287.html</a>)<br>
<br>I tried to add the macros and to compile with -pthread as you suggest, but I get the same result :( also tried to download dbus-cplusplus but it fail while compiling the example echo-client:<br><br>echo_client_mt-echo-client.o: In function `main': <br>
echo-client.cpp:(.text+0xa3): undefined reference to `pthread_create' <br>echo-client.cpp:(.text+0xc2): undefined reference to `pthread_create' <br>echo-client.cpp:(.text+0xe1): undefined reference to `pthread_create' <br>
echo-client.cpp:(.text+0x128): undefined reference to `pthread_join' <br>echo-client.cpp:(.text+0x13b): undefined reference to `pthread_join' <br>echo-client.cpp:(.text+0x14e): undefined reference to `pthread_join' <br>
collect2: ld returned 1 exit status<br><br>I have installed libpthread of course! so I substitute echo-client.cpp (and echo-server.cpp too) with a "do nothing" int main() {return 0;} and now I can compile dbus-cplusplus successfully.<br>
however I get again a segmentation fault running my simple example (compiled both with and without -pthread option), can you reproduce this behavior too?<br><br>regards,<br>Claudio Contino<br><br><div class="gmail_quote">
On Mon, Aug 18, 2008 at 10:16 PM, Andreas Volz <span dir="ltr"><<a href="mailto:lists@brachttal.net">lists@brachttal.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am Mon, 18 Aug 2008 14:45:02 +0200 schrieb Claudio Contino:<br>
<div><div></div><div class="Wj3C7c"><br>
> Hello,<br>
><br>
> I'm a computer science student and I need an IPC API written in C++<br>
> for a project I'm working at. I thought DBUS was the best choice, but<br>
> I have some problems with C++ bindings.<br>
> I have written this very very simple piece of code:<br>
><br>
> #include <dbus-c++-1/dbus-c++/dbus.h><br>
><br>
> DBus::BusDispatcher dispatcher;<br>
><br>
> int main()<br>
> {<br>
> DBus::default_dispatcher = &dispatcher;<br>
> DBus::Connection bus = DBus::Connection::SessionBus();<br>
> return 0;<br>
> }<br>
><br>
> but I get a segmentation fault on DBus::Connection::SessionBus();<br>
> this is the backtrace stack:<br>
><br>
> #0 0xb7edbfb7 std::_List_node_base::hook()<br>
> (/usr/lib/libstdc++.so.6:??) #1 0xb7f9d340<br>
> DBus::Dispatcher::queue_connection() (/usr/lib/libdbus-c++-1.so.0:??)<br>
> #2 0xb7f99089 DBus::Connection::setup()<br>
> (/usr/lib/libdbus-c++-1.so.0:??) #3 0xb7f9a943<br>
> DBus::Connection::Connection() (/usr/lib/libdbus-c++-1.so.0:??)<br>
> #4 0xb7f9b1d7 DBus::Connection::SessionBus()<br>
> (/usr/lib/libdbus-c++-1.so.0:??)<br>
> #5 0x804b2fb main()<br>
> (/home/claudio/Documents/progetti/codeblocks/dbus_prova/main.cpp:8)<br>
><br>
> I'm using dbus-c++ compiled today from GIT and dbus daemon 1.2.3<br>
> should I move to another API or I am doing something incorrect?<br>
<br>
</div></div>I've an ideas what the problem could be. Try to insert this at the<br>
start of your app:<br>
<br>
#define DBUS_HAS_THREADS_INIT_DEFAULT<br>
#define DBUS_HAS_RECURSIVE_MUTEX<br>
#define HAVE_PTHREAD 1<br>
#define HAVE_PTHREAD_H 1<br>
<br>
Then compile your demo application with -pthread option.<br>
<br>
Alternative try my the unofficial GIT repo here:<br>
<br>
<a href="http://gitorious.org/projects/dbus-cplusplus" target="_blank">http://gitorious.org/projects/dbus-cplusplus</a><br>
<br>
Would be interesting if you get the same crash. I assume it's a problem<br>
with pthread runtime dependency. If it works then I'll add some more<br>
words about that topic.<br>
<br>
BTW: You may discuss that topic on the list<br>
<<a href="mailto:dbus-cplusplus-devel-owner@lists.sourceforge.net">dbus-cplusplus-devel-owner@lists.sourceforge.net</a>> if you like. Join<br>
here:<br>
<br>
<a href="https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel</a><br>
<br>
regards<br>
Andreas<br>
<br>
-<br>
_______________________________________________<br>
dbus mailing list<br>
<a href="mailto:dbus@lists.freedesktop.org">dbus@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dbus" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dbus</a><br>
</blockquote></div><br></div>