Hi all!
I try to build a package with a c program that uses libusb by including <usb.h>. Although I added the DEPENDS line and in my bb file and the option -l usb to the compiler call (see below), the compilation failes with "error: usb.h: No such file or directory".
Some hints:
- I can imagine when I built the package at the first time, the dependencies of libusb have been parsed successfully.
- Compiling that program on my Ubuntu machine works perfectly.
Any suggestions from the professionals?
Here is my bb-file:
DESCRIPTION = "Vitalwerterfassung"
SECTION = "base"
MAINTAINER = "me
LICENSE = "GPL"
PR = "isst.r0"
DEPENDS += "libusb"
FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/vitalwerterfassung"
SRC_URI = "file://vitalwerterfassung.c"
do_compile() {
cp ${WORKDIR}/vitalwerterfassung.c .
${CC} -lusb -o vitalwerterfassung.out vitalwerterfassung.c
}
do_install() {
install -m 0755 vitalwerterfassung.out ${D}/${bindir}
Alles anzeigen
edit: Meanwhile I looked into some other Packages that use the c compiler. There is an additional entry ${CFLAGS} ${LDFLAGS}. I changed the corresponding line and now it looks like this:
The error that is produced now looks a little different, but seems to point to the same problem as certain libusb-specific functions can not be found:
/tmp/cc9F79nf.o: In function `ReadData':
vitalwerterfassung.c:(.text+0x138): undefined reference to `usb_control_msg'
/tmp/cc9F79nf.o: In function `SendData':
vitalwerterfassung.c:(.text+0x1d4): undefined reference to `usb_control_msg'
/tmp/cc9F79nf.o: In function `main':
vitalwerterfassung.c:(.text+0x3bc): undefined reference to `usb_init'
vitalwerterfassung.c:(.text+0x3d4): undefined reference to `usb_find_busses'
vitalwerterfassung.c:(.text+0x3ec): undefined reference to `usb_find_devices'
vitalwerterfassung.c:(.text+0x404): undefined reference to `usb_busses'
vitalwerterfassung.c:(.text+0x464): undefined reference to `usb_open'
vitalwerterfassung.c:(.text+0x4c0): undefined reference to `usb_control_msg'
vitalwerterfassung.c:(.text+0x534): undefined reference to `usb_control_msg'
vitalwerterfassung.c:(.text+0x968): undefined reference to `usb_close'
collect2: ld returned 1 exit status
Alles anzeigen