Problem with self-made bb-file

Hello,

I want to compile a self-written program in the "OE-style". Therefore
I followed http://www.gumstix.net/Software/view/Build-system-overview/Hello-world-tutorial/111.html

The bb-file looks like that:
DESCRIPTION = "sample programm"
PR = "r0"
DEPENDS = "libpng"
SRC_URI = " \
   file://files.tar.gz \
"
S = "${WORKDIR}"
do_install () {
     install -d ${D}${bindir}/
     install -m 0755 ${S}/sampleprog${D}${bindir}/
}
FILES_${PN} = "${bindir}/sampleprog"

When I do a "bitbake sampleprog" I get:
NOTE: Executing runqueue
NOTE: Running task 321 of 448 (ID: 8,
/home/developer/my_oe/sampleprog/sampleprog_1.0.0.bb, do_install)
NOTE: package sampleprog-1.0.0: started
NOTE: package sampleprog-1.0.0-r0: task do_install: started
ERROR: function do_install failed

The logfile says:
/home/developer/oe//tmp/staging/i686-linux/usr/bin/install-sh:
/home/developer/oe//tmp/work/armv7a-angstrom-linux-gnueabi/sampleprog-1.0.0-r0/sampleprog
does not exist.

What could be the problem? It seems that the SRC_URI is completly
ignored and bitbake does not try to fetch, unpack and compile
files.tar.gz which is under the files folder.
Robert

Hello,

I want to compile a self-written program in the "OE-style". Therefore
I followed http://www.gumstix.net/Software/view/Build-system-overview/Hello-world-tutorial/111.html

The bb-file looks like that:
DESCRIPTION = "sample programm"
PR = "r0"
DEPENDS = "libpng"
SRC_URI = " \
  file://files.tar.gz \
"
S = "${WORKDIR}"
do_install () {
    install -d ${D}${bindir}/
    install -m 0755 ${S}/sampleprog${D}${bindir}/
}
FILES_${PN} = "${bindir}/sampleprog"

When I do a "bitbake sampleprog" I get:
NOTE: Executing runqueue
NOTE: Running task 321 of 448 (ID: 8,
/home/developer/my_oe/sampleprog/sampleprog_1.0.0.bb, do_install)
NOTE: package sampleprog-1.0.0: started
NOTE: package sampleprog-1.0.0-r0: task do_install: started
ERROR: function do_install failed

The logfile says:
/home/developer/oe//tmp/staging/i686-linux/usr/bin/install-sh:
/home/developer/oe//tmp/work/armv7a-angstrom-linux-gnueabi/sampleprog-1.0.0-r0/sampleprog
does not exist.

What could be the problem? It seems that the SRC_URI is completly
ignored and bitbake does not try to fetch, unpack and compile

You don't declare any compile steps.
Try doing 'bitbake sampleprog -c rebuild -D'

regards,

Koen

What could be the problem? It seems that the SRC_URI is completly
ignored and bitbake does not try to fetch, unpack and compile

You don't declare any compile steps.
Try doing 'bitbake sampleprog -c rebuild -D'

Okay, worked, thanks!

I got a library from a third party (3 header files and a lib). While
compiling the sample program I get
NOTE: Couldn't find shared library provider for libFromThirdParty.so

Whats the right way to integrate this lib? Make a package wich only
contains the include-files and the lib? Until now I put the lib in a
seperate folder ("lib") and add to the Makefile:

...
LFLAGS = -L./lib -lFromThirdParty -lpng -lpthread
...

Robert

Whats the right way to integrate this lib?

I tried it with this bb file:

PR = "r0"
SRC_URI = "file://libv.so \
     file://vr2.h \
     file://vr2ll.h \
     file://vrp.h"

do_stage () {
  install -m 0644 vr2.h ${STAGING_INCDIR}/
  install -m 0644 vr2ll.h ${STAGING_INCDIR}/
  install -m 0644 vrp.h ${STAGING_INCDIR}/
  oe_libinstall -a -so libv.so ${STAGING_LIBDIR}
}

do_install () {
  oe_runmake 'DESTDIR=${D}' install
  oe_libinstall -a -so libv.so ${D}${libdir}
}

bitbake -b libv_1.0.0.bb -c stage -D
...
NOTE: Preparing runqueue
NOTE: Marking Active Tasks
ERROR: Task do_stage does not exist for target libv

Hmmm, there is a do_stage. Or what do I miss?
Robert

Whats the right way to integrate this lib?

I tried it with this bb file:

PR = "r0"
SRC_URI = "file://libv.so \
     file://vr2.h \
     file://vr2ll.h \
     file://vrp.h"

do_stage () {
  install -m 0644 vr2.h ${STAGING_INCDIR}/
  install -m 0644 vr2ll.h ${STAGING_INCDIR}/
  install -m 0644 vrp.h ${STAGING_INCDIR}/
  oe_libinstall -a -so libv.so ${STAGING_LIBDIR}
}

do_install () {
  oe_runmake 'DESTDIR=${D}' install
  oe_libinstall -a -so libv.so ${D}${libdir}
}

bitbake -b libv_1.0.0.bb -c stage -D

-c populate_staging

regards,

Koen

bitbake -b libv_1.0.0.bb -c stage -D

-c populate_staging

Okay, works, thanks. In the chat you said LDFLAGs is populated by default.
Does this mean I do not use LDFLAGS in the Makefile anymore? It is all
done by bitbake?

I tried to use such a Makefile:

#LFLAGS = -lpng
OBJ = src1.o src2.o src3.o src4.o
sampleprog: $(OBJ)
  $(CXX) $(LFLAGS) -o sampleprog $(OBJ) $(LDFLAGS)
%.o: %.c
  $(CXX) $(CFLAGS) -c $<

Now with a
DEPENDS = "libpng"
in the bb file LDFLAGS is automatically populated with "-Lpng"?

Robert

bitbake -b libv_1.0.0.bb -c stage -D

-c populate_staging

Okay, works, thanks. In the chat you said LDFLAGs is populated by default.
Does this mean I do not use LDFLAGS in the Makefile anymore? It is all
done by bitbake?

I tried to use such a Makefile:

#LFLAGS = -lpng
OBJ = src1.o src2.o src3.o src4.o
sampleprog: $(OBJ)
  $(CXX) $(LFLAGS) -o sampleprog $(OBJ) $(LDFLAGS)
%.o: %.c
  $(CXX) $(CFLAGS) -c $<

Now with a
DEPENDS = "libpng"
in the bb file LDFLAGS is automatically populated with "-Lpng"?

No, it will populate it with:

koen@dominion:/OE/org.openembedded.dev/packages/linux$ MACHINE=beagleboard bitbake -e cairo | grep "LDFLAGS="
# BUILD_LDFLAGS=-L${STAGING_LIBDIR_NATIVE} -Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-O1
export BUILD_LDFLAGS="-L/OE/angstrom-dev/staging/x86_64-linux/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/staging/x86_64-linux/usr/lib -Wl,-rpath,/OE/angstrom-dev/staging/x86_64-linux/usr/lib -Wl,-O1"
# LDFLAGS=${TARGET_LDFLAGS}
export LDFLAGS="-L/OE/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-O1 -Wl,--hash-style=gnu"
# TARGET_LDFLAGS=-L${STAGING_DIR_TARGET}${layout_libdir} -Wl,-rpath-link,${STAGING_DIR_TARGET}${layout_libdir} -Wl,-O1 ${TARGET_LINK_HASH_STYLE}
export TARGET_LDFLAGS="-L/OE/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-O1 -Wl,--hash-style=gnu"
koen@dominion:/OE/org.openembedded.dev/packages/linux$

Your makefile is responsible for providing the proper -l<foo> flags , OE will add the proper -L paths. Your makefile makes compilation work, OE passes in flags to make *cross* compilation work for that makefile.

regards,

Koen