UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor shlee6
Visitor
146 Views
Registered: ‎08-07-2019

How to link dbus in example source code in petalinux 2019.1?

Jump to solution

Dear all.

 

I'm trying to build dbus-server / client sample code in petalinux 2019.1.

Firstly, I enable dbus and dbus-glib using petalinux-config -c rootfs (base -> dbus & dbus-glib)

And I generated dbus apps and modified dbus-server.bb to link and include dbus and dbus-glib.

 

When I build example source code, error code of build is as following:

| dbus-server.c:35:10: fatal error: dbus/dbus.h: No such file or directory
| #include <dbus/dbus.h>

 

I doesn't have enough understood of yocto  and .bb so I can't catch what problem is.

 

My .bb file is as following.

1 #
2 # This file is the dbus-server recipe.
3 #
4
5 SUMMARY = "Simple dbus-server application"
6 SECTION = "PETALINUX/apps"
7 LICENSE = "MIT"
8 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
9
10 SRC_URI = "file://dbus-server.c \
11 file://Makefile \
12 file://
13 "
14
15 S = "${WORKDIR}"
16 DEPENDS = "dbus dbus-glib dbus-glib-native glib-2.0 glib-2.0-native"
17
18 do_compile() {
19 ${CC} ${CFLAGS} ${LDFLAGS} -o dbus-server dbus-server.c -ldbus-glib -ldbus
20 }
21
22 do_install() {
23 install -d ${D}${bindir}
24 install -m 0755 dbus-server ${D}${bindir}
25 }
26
27 FILES_${PN} += " dbus-server"

Could you guide me to solve this problem?

If you add any comment, it will be very helpful to me. Thanks.

 

0 Kudos
1 Solution

Accepted Solutions
Visitor shlee6
Visitor
73 Views
Registered: ‎08-07-2019

Re: How to link dbus in example source code in petalinux 2019.1?

Jump to solution

Here is my self solution.

I hope it is helpful to you when meet similar problem like this topic.

 

1 #
2 # This file is the dbus-server recipe.
3 #
4
5 SUMMARY = "Simple dbus-server application"
6 SECTION = "PETALINUX/apps"
7 LICENSE = "MIT"
8 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
9
10 SRC_URI = "file://dbus-server.c \
11 file://Makefile \
12 "
13
14 S = "${WORKDIR}"
15 DEPENDS = "dbus dbus-glib glib-2.0"
16
17
18 do_compile() {
19 #oe_runmake
20 ${CC} ${LDFLAGS} -I=/usr/include/dbus-1.0 \
21 -I=/usr/lib64/dbus-1.0/include \
22 -I=/usr/include/glib-2.0 \
23 -I=/usr/lib64/glib-2.0/include \
24 dbus-server.c -o dbus-server \
25 -L=/usr/lib64/libdbus-1.so \
26 -L=/usr/lib64/libdbus-glib-1.so \
27 -L=/usr/lib64/libglib-2.0.so \
28 -ldbus-1 -ldbus-glib-1 -lglib-2.0
29 }
30
31 do_install() {
32 install -d ${D}${bindir}
33 install -m 0755 dbus-server ${D}${bindir}
34 }

View solution in original post

0 Kudos
2 Replies
Visitor shlee6
Visitor
74 Views
Registered: ‎08-07-2019

Re: How to link dbus in example source code in petalinux 2019.1?

Jump to solution

Here is my self solution.

I hope it is helpful to you when meet similar problem like this topic.

 

1 #
2 # This file is the dbus-server recipe.
3 #
4
5 SUMMARY = "Simple dbus-server application"
6 SECTION = "PETALINUX/apps"
7 LICENSE = "MIT"
8 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
9
10 SRC_URI = "file://dbus-server.c \
11 file://Makefile \
12 "
13
14 S = "${WORKDIR}"
15 DEPENDS = "dbus dbus-glib glib-2.0"
16
17
18 do_compile() {
19 #oe_runmake
20 ${CC} ${LDFLAGS} -I=/usr/include/dbus-1.0 \
21 -I=/usr/lib64/dbus-1.0/include \
22 -I=/usr/include/glib-2.0 \
23 -I=/usr/lib64/glib-2.0/include \
24 dbus-server.c -o dbus-server \
25 -L=/usr/lib64/libdbus-1.so \
26 -L=/usr/lib64/libdbus-glib-1.so \
27 -L=/usr/lib64/libglib-2.0.so \
28 -ldbus-1 -ldbus-glib-1 -lglib-2.0
29 }
30
31 do_install() {
32 install -d ${D}${bindir}
33 install -m 0755 dbus-server ${D}${bindir}
34 }

View solution in original post

0 Kudos
Visitor shlee6
Visitor
52 Views
Registered: ‎08-07-2019

Re: How to link dbus in example source code in petalinux 2019.1?

Jump to solution

Better .bb file and Makefile config in yocto.

 

In recipes/dbus-server .bb file is as following.

1 #
2 # This file is the dbus-server recipe.
3 #
4
5 SUMMARY = "Simple dbus-server application"
6 SECTION = "PETALINUX/apps"
7 LICENSE = "MIT"
8 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
9
10 SRC_URI = "file://dbus-server.c \
11 file://Makefile \
12 file://in.softprayog.dbus-server.conf \
13 "
14
15 S = "${WORKDIR}"
16 DEPENDS += "dbus dbus-glib glib-2.0"
17
18 CFLAGS_append += "-I ${S}/recipe-sysroot/usr/include/dbus-1.0"
19 CFLAGS_append += "-I ${S}/recipe-sysroot/usr/lib64/dbus-1.0/include"
20
21
22
23 do_compile() {
24 oe_runmake
25 }
26
27 do_install() {
28 install -d ${D}${bindir}
29 install -m 0755 dbus-server ${D}${bindir}
30 install -d ${D}/etc/dbus-1/system.d/
31 install -m 0755 in.softprayog.dbus-server.conf ${D}/etc/dbus-1/system.d/in.softprayog.dbus-server.conf
32 }

 

Makefile

1 APP = dbus-server
2
3 # Add any other object files to this list below
4 APP_OBJS = dbus-server.o
5
6 all: build
7
8 build: $(APP)
9
10 $(APP): $(APP_OBJS)
11 $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS) -ldbus-1 -ldbus-glib-1
12
13 clean:
14 -rm -f $(APP) *.elf *.gdb *.o

 

I build and test dbus server/client example in https://www.softprayog.in/programming/d-bus-tutorial.

I used petalinux 2019.1.

0 Kudos