dbus-c++ doesn't work?

Claudio Contino ckonte at gmail.com
Tue Aug 19 02:05:47 PDT 2008


I joined the other mailing list (for new people: the discussion started here
http://lists.freedesktop.org/archives/dbus/2008-August/010287.html)

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:

echo_client_mt-echo-client.o: In function
`main':
echo-client.cpp:(.text+0xa3): undefined reference to
`pthread_create'
echo-client.cpp:(.text+0xc2): undefined reference to
`pthread_create'
echo-client.cpp:(.text+0xe1): undefined reference to
`pthread_create'
echo-client.cpp:(.text+0x128): undefined reference to
`pthread_join'
echo-client.cpp:(.text+0x13b): undefined reference to
`pthread_join'
echo-client.cpp:(.text+0x14e): undefined reference to
`pthread_join'
collect2: ld returned 1 exit status

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.
however I get again a segmentation fault running my simple example (compiled
both with and without -pthread option), can you reproduce this behavior too?

regards,
Claudio Contino

On Mon, Aug 18, 2008 at 10:16 PM, Andreas Volz <lists at brachttal.net> wrote:

> Am Mon, 18 Aug 2008 14:45:02 +0200 schrieb Claudio Contino:
>
> > Hello,
> >
> > I'm a computer science student and I need an IPC API written in C++
> > for a project I'm working at. I thought DBUS was the best choice, but
> > I have some problems with C++ bindings.
> > I have written this very very simple piece of code:
> >
> > #include <dbus-c++-1/dbus-c++/dbus.h>
> >
> > DBus::BusDispatcher dispatcher;
> >
> > int main()
> > {
> >     DBus::default_dispatcher = &dispatcher;
> >     DBus::Connection bus = DBus::Connection::SessionBus();
> >     return 0;
> > }
> >
> > but I get a segmentation fault on DBus::Connection::SessionBus();
> > this is the backtrace stack:
> >
> > #0 0xb7edbfb7    std::_List_node_base::hook()
> > (/usr/lib/libstdc++.so.6:??) #1 0xb7f9d340
> > DBus::Dispatcher::queue_connection() (/usr/lib/libdbus-c++-1.so.0:??)
> > #2 0xb7f99089    DBus::Connection::setup()
> > (/usr/lib/libdbus-c++-1.so.0:??) #3 0xb7f9a943
> > DBus::Connection::Connection() (/usr/lib/libdbus-c++-1.so.0:??)
> > #4 0xb7f9b1d7    DBus::Connection::SessionBus()
> > (/usr/lib/libdbus-c++-1.so.0:??)
> > #5 0x804b2fb    main()
> > (/home/claudio/Documents/progetti/codeblocks/dbus_prova/main.cpp:8)
> >
> > I'm using dbus-c++ compiled today from GIT and dbus daemon 1.2.3
> > should I move to another API or I am doing something incorrect?
>
> I've an ideas what the problem could be. Try to insert this at the
> start of your app:
>
> #define DBUS_HAS_THREADS_INIT_DEFAULT
> #define DBUS_HAS_RECURSIVE_MUTEX
> #define HAVE_PTHREAD 1
> #define HAVE_PTHREAD_H 1
>
> Then compile your demo application with -pthread option.
>
> Alternative try my the unofficial GIT repo here:
>
> http://gitorious.org/projects/dbus-cplusplus
>
> Would be interesting if you get the same crash. I assume it's a problem
> with pthread runtime dependency. If it works then I'll add some more
> words about that topic.
>
> BTW: You may discuss that topic on the list
> <dbus-cplusplus-devel-owner at lists.sourceforge.net> if you like. Join
> here:
>
> https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel
>
> regards
> Andreas
>
> -
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080819/843b5741/attachment.htm 


More information about the dbus mailing list