分类: LINUX
2009-06-25 09:44:12
gcc `pkg-config --cflags --libs dbus-1` dbus-example.c -o dbus-example.o 使用dbus-glib的话 gcc `pkg-config --cflags --libs dbus-glib-1` dbus-example.c -o dbus-example.o
)
所以用: arm-unknown-linux-gnu-gcc -I/home/songys/dbus/lib/include/dbus-1.0/ -I/home/songys/dbus/lib/include -I/home/songys/dbus/lib/include/glib-2.0 -I/home/songys/dbus/lib/lib/glib-2.0/include -I/home/songys/dbus/lib/lib/dbus-1.0/include -L/home/songys/dbus/lib/lib -ldbus-1 `pkg-config --cflags --libs dbus-glib-1` test.c -o test
在开发板上运行命令:
# dbus-dameon --system
Failed to start message bus: Failed to open "/usr/local/etc/dbus-1/system.conf":
No such file or directory
于是我又到dbus-1.0.2中找了个system.conf
# dbus-dameon --system
Failed to start message bus: Failed to open :".....system.d" No such file or directory
于是响应目录下建了个system.d文件夹
# dbus-dameon --system
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_soc ket
No such file or directory
自己就硬着头皮建一个system_bus_soc ket,结果
# dbus-dameon --system
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_soc ket:Address already in use
郁闷,删掉system_bus_soc ket,只留/var/run/dbus/
# dbus-dameon --system
Failed to start message bus:Could not get UID and GID for username "messagebus"
网上让用/usr/sbin/adduser messagebus,奶奶的开发板上没有这个命令,难道在编译busy-box,还是算了吧,麻烦,忽然看到网上说可以用添加文件的方式添加用户,/etc/passwd下,在pc linux下用一下/usr/sbin/adduser messagebus,发现就在/etc/passwd下,添加了一行messagebus:x:500:500::/home/messagebus:/bin/bash,看开发板上,只是有个root,于是复制进去,root后/bin/sh,所以为了保持一致,也改为messagebus:x:500:500::/home/messagebus:/bin/sh
passwd内容如下:
root::0:0:root:/:/bin/sh
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:Nobody:/:
messagebus:x:500:500::/home/messagebus:/bin/sh
# dbus-dameon --system
哈哈,该死的错误没了,高兴
4. dbus-daemon --system --print-pid --print-address
rm /home/songys/dbus/lib/var/run/dbus/pid
dbus-launch --sh-syntax --exit-with-session
dbus-launch /tmp/test
测试程序运行成功, 但是2个session互发消息的测试还没有调试出来5555555